~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/time_functions.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-19 14:24:27 UTC
  • mto: This revision was merged to the branch mainline in revision 2445.
  • Revision ID: olafvdspek@gmail.com-20111019142427-sun0tnp0u27gqg31
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
}
126
126
 
127
127
 
128
 
type::timestamp_t str_to_datetime_with_warn(Session *session,
129
 
                                            const char *str, 
130
 
                                            uint32_t length, 
131
 
                                            type::Time *l_time,
132
 
                                            uint32_t flags)
 
128
type::timestamp_t str_to_datetime_with_warn(Session *session, const char *str,  uint32_t length,  type::Time *l_time, uint32_t flags)
133
129
{
134
130
  type::cut_t was_cut= type::VALID;
135
 
  type::timestamp_t ts_type;
136
 
 
137
 
  ts_type= l_time->store(str, length,
138
 
                         (flags | (session->variables.sql_mode &
139
 
                                   (MODE_INVALID_DATES |
140
 
                                    MODE_NO_ZERO_DATE))),
141
 
                         was_cut);
 
131
  type::timestamp_t ts_type= l_time->store(str, length, (flags | (session->variables.sql_mode & (MODE_INVALID_DATES | MODE_NO_ZERO_DATE))), was_cut);
142
132
  if (was_cut || ts_type <= type::DRIZZLE_TIMESTAMP_ERROR)
143
 
    make_truncated_value_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
144
 
                                 str, length, ts_type,  NULL);
 
133
    make_truncated_value_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN, str, length, ts_type,  NULL);
145
134
 
146
135
  return ts_type;
147
136
}
148
137
 
149
138
 
150
 
bool
151
 
str_to_time_with_warn(Session *session, const char *str, uint32_t length, type::Time *l_time)
 
139
bool str_to_time_with_warn(Session *session, const char *str, uint32_t length, type::Time *l_time)
152
140
{
153
141
  int warning;
154
142
  bool ret_val= l_time->store(str, length, warning, type::DRIZZLE_TIMESTAMP_TIME);
155
143
  if (ret_val || warning)
156
 
    make_truncated_value_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
157
 
                                 str, length, type::DRIZZLE_TIMESTAMP_TIME, NULL);
 
144
    make_truncated_value_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN, str, length, type::DRIZZLE_TIMESTAMP_TIME, NULL);
158
145
  return ret_val;
159
146
}
160
147