21
21
/* Functions to handle date and time */
24
#include <drizzled/error.h>
25
#include <drizzled/util/test.h>
26
#include <drizzled/tztime.h>
27
#include <drizzled/session.h>
28
#include <drizzled/time_functions.h>
24
#include "drizzled/error.h"
25
#include "drizzled/util/test.h"
26
#include "drizzled/tztime.h"
27
#include "drizzled/session.h"
28
#include "drizzled/time_functions.h"
127
type::timestamp_t str_to_datetime_with_warn(Session *session,
127
type::timestamp_t str_to_datetime_with_warn(const char *str,
130
129
type::Time *l_time,
133
type::cut_t was_cut= type::VALID;
134
133
type::timestamp_t ts_type;
134
Session *session= current_session;
136
ts_type= l_time->store(str, length,
137
(flags | (session->variables.sql_mode &
138
(MODE_INVALID_DATES |
139
MODE_NO_ZERO_DATE))),
136
ts_type= str_to_datetime(str, length, l_time,
137
(flags | (session->variables.sql_mode &
138
(MODE_INVALID_DATES |
139
MODE_NO_ZERO_DATE))),
141
141
if (was_cut || ts_type <= type::DRIZZLE_TIMESTAMP_ERROR)
142
142
make_truncated_value_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
143
143
str, length, ts_type, NULL);
150
str_to_time_with_warn(Session *session, const char *str, uint32_t length, type::Time *l_time)
149
str_to_time_with_warn(const char *str, uint32_t length, type::Time *l_time)
153
bool ret_val= l_time->store(str, length, warning, type::DRIZZLE_TIMESTAMP_TIME);
152
bool ret_val= str_to_time(str, length, l_time, &warning);
154
153
if (ret_val || warning)
155
make_truncated_value_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
154
make_truncated_value_warning(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
156
155
str, length, type::DRIZZLE_TIMESTAMP_TIME, NULL);