24 #include <drizzled/plugin/client.h>
25 #include <drizzled/type/time.h>
29 void plugin::Client::store(
const type::Time *from)
31 const size_t buff_len= 40;
36 switch (from->time_type)
38 case type::DRIZZLE_TIMESTAMP_DATETIME:
39 length= snprintf(buff, (buff_len-length),
"%04d-%02d-%02d %02d:%02d:%02d",
46 if (from->second_part)
47 length+= snprintf(buff+length, (buff_len-length),
".%06d", (
int)from->second_part);
50 case type::DRIZZLE_TIMESTAMP_DATE:
51 length= snprintf(buff, (buff_len-length),
"%04d-%02d-%02d",
57 case type::DRIZZLE_TIMESTAMP_TIME:
58 day= (from->year || from->month) ? 0 : from->day;
59 length= snprintf(buff, (buff_len-length),
"%s%02ld:%02d:%02d",
61 (long) day*24L+(
long) from->hour,
64 if (from->second_part)
65 length+= snprintf(buff+length, (buff_len-length),
".%06d", (
int)from->second_part);
68 case type::DRIZZLE_TIMESTAMP_NONE:
69 case type::DRIZZLE_TIMESTAMP_ERROR:
78 void plugin::Client::store(
const char *from)
80 return from ? store(from, strlen(from)) : store();
TODO: Rename this file - func.h is stupid.