~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/date.cc

  • Committer: Brian Aker
  • Date: 2011-01-25 00:16:39 UTC
  • mto: (2109.1.6 drizzle-build)
  • mto: This revision was merged to the branch mainline in revision 2112.
  • Revision ID: brian@tangent.org-20110125001639-lezc0b7obhbutj5l
Fix store_time to take reference.

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
  return 0;
124
124
}
125
125
 
126
 
int Field_date::store_time(type::Time *ltime,
 
126
int Field_date::store_time(type::Time &ltime,
127
127
                           type::timestamp_t time_type)
128
128
{
129
129
  long tmp;
130
130
  int error= 0;
131
131
  if (time_type == type::DRIZZLE_TIMESTAMP_DATE || time_type == type::DRIZZLE_TIMESTAMP_DATETIME)
132
132
  {
133
 
    tmp= ltime->year*10000 + ltime->month*100 + ltime->day;
 
133
    tmp= ltime.year*10000 + ltime.month*100 + ltime.day;
134
134
 
135
135
    type::cut_t cut_error= type::VALID;
136
 
    if (ltime->check(tmp != 0,
 
136
    if (ltime.check(tmp != 0,
137
137
                     (TIME_FUZZY_DATE |
138
138
                      (current_session->variables.sql_mode &
139
139
                       (MODE_NO_ZERO_DATE | MODE_INVALID_DATES))), cut_error))
140
140
    {
141
141
      char buff[type::Time::MAX_STRING_LENGTH];
142
142
      String str(buff, sizeof(buff), &my_charset_utf8_general_ci);
143
 
      ltime->convert(str, type::DRIZZLE_TIMESTAMP_DATE);
 
143
      ltime.convert(str, type::DRIZZLE_TIMESTAMP_DATE);
144
144
      set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED,
145
145
                           str.ptr(), str.length(), type::DRIZZLE_TIMESTAMP_DATE, 1);
146
146
    }
147
147
 
148
148
    error= static_cast<int>(cut_error);
149
149
 
150
 
    if (not error && ltime->time_type != type::DRIZZLE_TIMESTAMP_DATE &&
151
 
        (ltime->hour || ltime->minute || ltime->second || ltime->second_part))
 
150
    if (not error && ltime.time_type != type::DRIZZLE_TIMESTAMP_DATE &&
 
151
        (ltime.hour || ltime.minute || ltime.second || ltime.second_part))
152
152
    {
153
153
      char buff[type::Time::MAX_STRING_LENGTH];
154
154
      String str(buff, sizeof(buff), &my_charset_utf8_general_ci);
155
 
      ltime->convert(str);
 
155
      ltime.convert(str);
156
156
      set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_NOTE,
157
157
                           ER_WARN_DATA_TRUNCATED,
158
158
                           str.ptr(), str.length(), type::DRIZZLE_TIMESTAMP_DATE, 1);