~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_timefunc.cc

  • Committer: Brian Aker
  • Date: 2008-08-05 04:10:42 UTC
  • mfrom: (261.2.8 codestyle)
  • mto: This revision was merged to the branch mainline in revision 263.
  • Revision ID: brian@tangent.org-20080805041042-1l4893r3bwy2lxz2
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
  if (!warning)
125
125
    return 0;
126
126
 
127
 
  make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 
127
  make_truncated_value_warning(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
128
128
                               str->ptr(), str->length(),
129
129
                               DRIZZLE_TIMESTAMP_TIME, NullS);
130
130
  return make_datetime(format, ltime, str);
151
151
    return 1;
152
152
  if (warning)
153
153
  {
154
 
    make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 
154
    make_truncated_value_warning(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
155
155
                                 str->ptr(), str->length(),
156
156
                                 DRIZZLE_TIMESTAMP_TIME, NullS);
157
157
    make_time(format, l_time, str);
185
185
{
186
186
  uint sec;
187
187
 
188
 
  memset((char *)ltime, 0, sizeof(*ltime));
 
188
  memset(ltime, 0, sizeof(*ltime));
189
189
  
190
190
  if (seconds < 0)
191
191
  {
214
214
  char buf[22];
215
215
  int len= (int)(int64_t10_to_str(seconds, buf, unsigned_flag ? 10 : -10)
216
216
                 - buf);
217
 
  make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 
217
  make_truncated_value_warning(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
218
218
                               buf, len, DRIZZLE_TIMESTAMP_TIME,
219
219
                               NullS);
220
220
  
288
288
  CHARSET_INFO *cs= &my_charset_bin;
289
289
 
290
290
  if (!sub_pattern_end)
291
 
    memset((char*) l_time, 0, sizeof(*l_time));
 
291
    memset(l_time, 0, sizeof(*l_time));
292
292
 
293
293
  for (; ptr != end && val != val_end; ptr++)
294
294
  {
582
582
    {
583
583
      if (!my_isspace(&my_charset_latin1,*val))
584
584
      {
585
 
        make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 
585
        make_truncated_value_warning(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
586
586
                                     val_begin, length,
587
587
                                     cached_timestamp_type, NullS);
588
588
        break;
595
595
  {
596
596
    char buff[128];
597
597
    strmake(buff, val_begin, min(length, sizeof(buff)-1));
598
 
    push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
 
598
    push_warning_printf(current_thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
599
599
                        ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE),
600
600
                        date_time_type, buff, "str_to_date");
601
601
  }
885
885
      /* Change values[0...i-1] -> values[0...count-1] */
886
886
      bmove_upp((uchar*) (values+count), (uchar*) (values+i),
887
887
                sizeof(*values)*i);
888
 
      memset((uchar*) values, 0, sizeof(*values)*(count-i));
 
888
      memset(values, 0, sizeof(*values)*(count-i));
889
889
      break;
890
890
    }
891
891
  }
1299
1299
  size_t length= 0;
1300
1300
  CHARSET_INFO *cs=str_value->charset();
1301
1301
 
1302
 
  memset((char*) interval, 0, sizeof(*interval));
 
1302
  memset(interval, 0, sizeof(*interval));
1303
1303
  if ((int) int_type <= INTERVAL_MICROSECOND)
1304
1304
  {
1305
1305
    value= args->val_int();
2359
2359
        str_value= *res;                        // Not malloced string
2360
2360
        res= &str_value;
2361
2361
      }
2362
 
      push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 
2362
      push_warning_printf(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
2363
2363
                          ER_TRUNCATED_WRONG_VALUE,
2364
2364
                          ER(ER_TRUNCATED_WRONG_VALUE), char_type,
2365
2365
                          res->c_ptr_safe());
2373
2373
        str->copy(*res);
2374
2374
        res= str;
2375
2375
      }
2376
 
      memset((char*) res->ptr() + res->length(), 0,
 
2376
      memset(res->ptr() + res->length(), 0,
2377
2377
             (uint) cast_length - res->length());
2378
2378
      res->length(cast_length);
2379
2379
    }
2502
2502
 
2503
2503
bool Item_date_typecast::get_time(DRIZZLE_TIME *ltime)
2504
2504
{
2505
 
  memset((char *)ltime, 0, sizeof(DRIZZLE_TIME));
 
2505
  memset(ltime, 0, sizeof(DRIZZLE_TIME));
2506
2506
  return args[0]->null_value;
2507
2507
}
2508
2508
 
2681
2681
  if (l_time1.neg != l_time2.neg)
2682
2682
    l_sign= -l_sign;
2683
2683
  
2684
 
  memset((char *)&l_time3, 0, sizeof(l_time3));
 
2684
  memset(&l_time3, 0, sizeof(l_time3));
2685
2685
  
2686
2686
  l_time3.neg= calc_time_diff(&l_time1, &l_time2, -l_sign,
2687
2687
                              &seconds, &microseconds);
2769
2769
  if (l_time1.neg != l_time2.neg)
2770
2770
    l_sign= -l_sign;
2771
2771
 
2772
 
  memset((char *)&l_time3, 0, sizeof(l_time3));
 
2772
  memset(&l_time3, 0, sizeof(l_time3));
2773
2773
  
2774
2774
  l_time3.neg= calc_time_diff(&l_time1, &l_time2, l_sign,
2775
2775
                              &seconds, &microseconds);
2818
2818
                   str->alloc(MAX_DATE_STRING_REP_LENGTH))))
2819
2819
    return 0;
2820
2820
 
2821
 
  memset((char *)&ltime, 0, sizeof(ltime));
 
2821
  memset(&ltime, 0, sizeof(ltime));
2822
2822
  ltime.neg= 0;
2823
2823
 
2824
2824
  /* Check for integer overflows */
2847
2847
    char *ptr= int64_t10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10);
2848
2848
    int len = (int)(ptr - buf) +
2849
2849
      sprintf(ptr, ":%02u:%02u", (uint)minute, (uint)second);
2850
 
    make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 
2850
    make_truncated_value_warning(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
2851
2851
                                 buf, len, DRIZZLE_TIMESTAMP_TIME,
2852
2852
                                 NullS);
2853
2853
  }
3207
3207
    goto null_date;
3208
3208
 
3209
3209
  null_value= 0;
3210
 
  memset((char*) ltime, 0, sizeof(*ltime));
 
3210
  memset(ltime, 0, sizeof(*ltime));
3211
3211
  date_time_format.format.str=    (char*) format->ptr();
3212
3212
  date_time_format.format.length= format->length();
3213
3213
  if (extract_date_time(&date_time_format, val->ptr(), val->length(),