~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/time.cc

merge latest from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
uint32_t calc_week(DRIZZLE_TIME *l_time, uint32_t week_behaviour, uint32_t *year)
100
100
{
101
101
  uint32_t days;
102
 
  ulong daynr=calc_daynr(l_time->year,l_time->month,l_time->day);
103
 
  ulong first_daynr=calc_daynr(l_time->year,1,1);
 
102
  uint32_t daynr= calc_daynr(l_time->year,l_time->month,l_time->day);
 
103
  uint32_t first_daynr= calc_daynr(l_time->year,1,1);
104
104
  bool monday_first= test(week_behaviour & WEEK_MONDAY_FIRST);
105
105
  bool week_year= test(week_behaviour & WEEK_YEAR);
106
106
  bool first_weekday= test(week_behaviour & WEEK_FIRST_WEEKDAY);
182
182
 
183
183
        /* Functions to handle periods */
184
184
 
185
 
ulong convert_period_to_month(ulong period)
 
185
uint32_t convert_period_to_month(uint32_t period)
186
186
{
187
 
  ulong a,b;
 
187
  uint32_t a,b;
188
188
  if (period == 0)
189
189
    return 0L;
190
190
  if ((a=period/100) < YY_PART_YEAR)
196
196
}
197
197
 
198
198
 
199
 
ulong convert_month_to_period(ulong month)
 
199
uint32_t convert_month_to_period(uint32_t month)
200
200
{
201
 
  ulong year;
 
201
  uint32_t year;
202
202
  if (month == 0L)
203
203
    return 0L;
204
204
  if ((year=month/12) < 100)
445
445
      separators++;
446
446
      /* Store in separator_map which parts are punct characters */
447
447
      if (my_ispunct(&my_charset_utf8_general_ci, *ptr))
448
 
        separator_map|= (ulong) 1 << (offset-1);
 
448
        separator_map|= 1 << (offset-1);
449
449
      else if (!my_isspace(&my_charset_utf8_general_ci, *ptr))
450
450
        return 1;
451
451
    }
482
482
    /* remove fractional seconds from later tests */
483
483
    uint32_t pos= dt_pos[6] -1;
484
484
    /* Remove separator before %f from sep map */
485
 
    separator_map= ((separator_map & ((ulong) (1 << pos)-1)) |
486
 
                    ((separator_map & ~((ulong) (1 << pos)-1)) >> 1));
 
485
    separator_map= ((separator_map & ((1 << pos)-1)) |
 
486
                    ((separator_map & ~((1 << pos)-1)) >> 1));
487
487
    if (part_map & 64)                        
488
488
    {
489
489
      separators--;                             // There is always a separator
508
508
  */
509
509
  offset= dt_pos[6] <= 3 ? 3 : 6;
510
510
  /* Remove separator before %p from sep map */
511
 
  separator_map= ((separator_map & ((ulong) (1 << offset)-1)) |
512
 
                  ((separator_map & ~((ulong) (1 << offset)-1)) >> 1));
 
511
  separator_map= ((separator_map & ((1 << offset)-1)) |
 
512
                  ((separator_map & ~((1 << offset)-1)) >> 1));
513
513
 
514
514
  format_str= 0;
515
515
  switch (format_type) {
617
617
DATE_TIME_FORMAT *date_time_format_copy(THD *thd, DATE_TIME_FORMAT *format)
618
618
{
619
619
  DATE_TIME_FORMAT *new_format;
620
 
  ulong length= sizeof(*format) + format->format.length + 1;
 
620
  uint32_t length= sizeof(*format) + format->format.length + 1;
621
621
 
622
622
  if (thd)
623
623
    new_format= (DATE_TIME_FORMAT *) thd->alloc(length);
744
744
    cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff),
745
745
                       ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
746
746
                       type_str, str.c_ptr(), field_name,
747
 
                       (ulong) thd->row_count);
 
747
                       (uint32_t) thd->row_count);
748
748
  else
749
749
  {
750
750
    if (time_type > DRIZZLE_TIMESTAMP_ERROR)
826
826
    period= (calc_daynr(ltime->year,ltime->month,ltime->day) +
827
827
             sign * (long) interval.day);
828
828
    /* Daynumber from year 0 to 9999-12-31 */
829
 
    if ((ulong) period > MAX_DAY_NUMBER)
 
829
    if (period > MAX_DAY_NUMBER)
830
830
      goto invalid_date;
831
831
    get_date_from_daynr((long) period,&ltime->year,&ltime->month,&ltime->day);
832
832
    break;
833
833
  case INTERVAL_YEAR:
834
834
    ltime->year+= sign * (long) interval.year;
835
 
    if ((ulong) ltime->year >= 10000L)
 
835
    if (ltime->year >= 10000L)
836
836
      goto invalid_date;
837
837
    if (ltime->month == 2 && ltime->day == 29 &&
838
838
        calc_days_in_year(ltime->year) != 366)
843
843
  case INTERVAL_MONTH:
844
844
    period= (ltime->year*12 + sign * (long) interval.year*12 +
845
845
             ltime->month-1 + sign * (long) interval.month);
846
 
    if ((ulong) period >= 120000L)
 
846
    if (period >= 120000L)
847
847
      goto invalid_date;
848
848
    ltime->year= (uint) (period / 12);
849
849
    ltime->month= (uint) (period % 12L)+1;