17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#include "drizzled/function/time/date.h"
23
#include "drizzled/temporal.h"
20
#include <drizzled/server_includes.h>
22
#include <drizzled/functions/time/date.h>
28
24
String *Item_date::val_str(String *str)
32
/* We have our subclass convert a Date temporal for us */
34
if (! get_temporal(temporal))
35
return (String *) NULL; /* get_temporal throws error. */
28
if (get_date(<ime, TIME_FUZZY_DATE))
37
30
if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
40
return (String *) NULL;
43
/* Convert the Date to a string and return it */
45
new_length= temporal.to_string(str->c_ptr(), MAX_DATE_STRING_REP_LENGTH);
46
assert(new_length < MAX_DATE_STRING_REP_LENGTH);
47
str->length(new_length);
35
make_date((DATE_TIME_FORMAT *) 0, <ime, str);
51
40
int64_t Item_date::val_int()
55
/* We have our subclass convert a Date temporal for us */
57
if (! get_temporal(temporal))
58
return 0; /* get_temporal throws error. */
60
/* Convert the Date to a string and return it */
62
temporal.to_int32_t(&int_value);
63
return (int64_t) int_value;
44
if (get_date(<ime, TIME_FUZZY_DATE))
46
return (int64_t) (ltime.year*10000L+ltime.month*100+ltime.day);
66
} /* namespace drizzled */