~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/tztime.cc

Merged PatG's removal of various DBUG stuff with still keeping DBUG_ASSERT calls since they seem to be breaking test runs

Show diffs side-by-side

added added

removed removed

Lines of Context:
885
885
  uint i;
886
886
  int shift= 0;
887
887
 
888
 
  DBUG_ENTER("TIME_to_gmt_sec");
889
888
 
890
889
  if (!validate_timestamp_range(t))
891
 
    DBUG_RETURN(0);
 
890
    return(0);
892
891
 
893
892
 
894
893
  /* We need this for correct leap seconds handling */
933
932
      This means that source time can't be represented as my_time_t due to
934
933
      limited my_time_t range.
935
934
    */
936
 
    DBUG_RETURN(0);
 
935
    return(0);
937
936
  }
938
937
 
939
938
  /* binary search for our range */
949
948
    if (local_t > (my_time_t) (TIMESTAMP_MAX_VALUE - shift * SECS_PER_DAY +
950
949
                               sp->revtis[i].rt_offset - saved_seconds))
951
950
    {
952
 
      DBUG_RETURN(0);                           /* my_time_t overflow */
 
951
      return(0);                           /* my_time_t overflow */
953
952
    }
954
953
    local_t+= shift * SECS_PER_DAY;
955
954
  }
972
971
  if (local_t < TIMESTAMP_MIN_VALUE)
973
972
    local_t= 0;
974
973
 
975
 
  DBUG_RETURN(local_t);
 
974
  return(local_t);
976
975
}
977
976
 
978
977
 
1563
1562
  my_bool return_val= 1;
1564
1563
  char db[]= "mysql";
1565
1564
  int res;
1566
 
  DBUG_ENTER("my_tz_init");
1567
1565
 
1568
1566
  /*
1569
1567
    To be able to run this from boot, we allocate a temporary THD
1570
1568
  */
1571
1569
  if (!(thd= new THD))
1572
 
    DBUG_RETURN(1);
 
1570
    return(1);
1573
1571
  thd->thread_stack= (char*) &thd;
1574
1572
  thd->store_globals();
1575
1573
  lex_start(thd);
1687
1685
 
1688
1686
    tz_leapcnt++;
1689
1687
 
1690
 
    DBUG_PRINT("info",
1691
 
               ("time_zone_leap_second table: tz_leapcnt: %u  tt_time: %lu  offset: %ld",
1692
 
                tz_leapcnt, (ulong) tz_lsis[tz_leapcnt-1].ls_trans,
1693
 
                tz_lsis[tz_leapcnt-1].ls_corr));
1694
1688
 
1695
1689
    res= table->file->index_next(table->record[0]);
1696
1690
  }
1751
1745
    my_pthread_setspecific_ptr(THR_THD,  0);
1752
1746
    my_pthread_setspecific_ptr(THR_MALLOC,  0);
1753
1747
  }
1754
 
  DBUG_RETURN(return_val);
 
1748
  return(return_val);
1755
1749
}
1756
1750
 
1757
1751
 
1819
1813
#ifdef ABBR_ARE_USED
1820
1814
  char chars[max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1)))];
1821
1815
#endif
1822
 
  DBUG_ENTER("tz_load_from_open_tables");
1823
1816
 
1824
1817
  /* Prepare tz_info for loading also let us make copy of time zone name */
1825
1818
  if (!(alloc_buff= (char*) alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) +
1939
1932
    chars[tz_info->charcnt]= 0;
1940
1933
    tz_info->charcnt++;
1941
1934
 
1942
 
    DBUG_PRINT("info",
1943
 
      ("time_zone_transition_type table: tz_id=%u tt_id=%u tt_gmtoff=%ld "
1944
 
       "abbr='%s' tt_isdst=%u", tzid, ttid, ttis[ttid].tt_gmtoff,
1945
 
       chars + ttis[ttid].tt_abbrind, ttis[ttid].tt_isdst));
1946
 
#else
1947
 
    DBUG_PRINT("info",
1948
 
      ("time_zone_transition_type table: tz_id=%u tt_id=%u tt_gmtoff=%ld "
1949
 
       "tt_isdst=%u", tzid, ttid, ttis[ttid].tt_gmtoff, ttis[ttid].tt_isdst));
1950
1935
#endif
1951
1936
 
1952
1937
    /* ttid is increasing because we are reading using index */
2003
1988
    types[tz_info->timecnt]= ttid;
2004
1989
    tz_info->timecnt++;
2005
1990
 
2006
 
    DBUG_PRINT("info",
2007
 
      ("time_zone_transition table: tz_id: %u  tt_time: %lu  tt_id: %u",
2008
 
       tzid, (ulong) ttime, ttid));
2009
1991
 
2010
1992
    res= table->file->index_next_same(table->record[0],
2011
1993
                                      table->field[0]->ptr, 4);
2093
2075
  if (table)
2094
2076
    (void)table->file->ha_index_end();
2095
2077
 
2096
 
  DBUG_RETURN(return_val);
 
2078
  return(return_val);
2097
2079
}
2098
2080
 
2099
2081
 
2221
2203
  Tz_names_entry *tmp_tzname;
2222
2204
  Time_zone *result_tz= 0;
2223
2205
  long offset;
2224
 
  DBUG_ENTER("my_tz_find");
2225
 
  DBUG_PRINT("enter", ("time zone name='%s'",
2226
 
                       name ? ((String *)name)->c_ptr_safe() : "NULL"));
2227
2206
 
2228
2207
  if (!name)
2229
 
    DBUG_RETURN(0);
 
2208
    return(0);
2230
2209
 
2231
2210
  VOID(pthread_mutex_lock(&tz_LOCK));
2232
2211
 
2237
2216
                                                     (const uchar *)&offset,
2238
2217
                                                     sizeof(long))))
2239
2218
    {
2240
 
      DBUG_PRINT("info", ("Creating new Time_zone_offset object"));
2241
2219
 
2242
2220
      if (!(result_tz= new (&tz_storage) Time_zone_offset(offset)) ||
2243
2221
          my_hash_insert(&offset_tzs, (const uchar *) result_tz))
2272
2250
 
2273
2251
  VOID(pthread_mutex_unlock(&tz_LOCK));
2274
2252
 
2275
 
  DBUG_RETURN(result_tz);
 
2253
  return(result_tz);
2276
2254
}
2277
2255
 
2278
2256