~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/field.cc

  • Committer: Brian Aker
  • Date: 2008-07-07 14:25:25 UTC
  • mto: (77.1.25 codestyle)
  • mto: This revision was merged to the branch mainline in revision 82.
  • Revision ID: brian@tangent.org-20080707142525-xzy2nl3ie2ebwfln
LL() cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
#define LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE 128
53
53
#define DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE 128
54
54
#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
55
 
((ulong) ((LL(1) << min(arg, 4) * 8) - LL(1)))
 
55
((ulong) ((1LL << min(arg, 4) * 8) - 1LL))
56
56
 
57
57
#define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)))
58
58
#define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index)))
2874
2874
      res=0;
2875
2875
      error= 1;
2876
2876
    }
2877
 
    else if ((uint64_t) nr >= (LL(1) << 32))
 
2877
    else if ((uint64_t) nr >= (1LL << 32))
2878
2878
    {
2879
2879
      res=(int32) (uint32) ~0L;
2880
2880
      error= 1;
4009
4009
  longlong tmp= number_to_datetime(nr, &l_time, (thd->variables.sql_mode &
4010
4010
                                                 MODE_NO_ZERO_DATE) |
4011
4011
                                   MODE_NO_ZERO_IN_DATE, &error);
4012
 
  if (tmp == LL(-1))
 
4012
  if (tmp == -1LL)
4013
4013
  {
4014
4014
    error= 2;
4015
4015
  }
4065
4065
  
4066
4066
  thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, (my_time_t)temp);
4067
4067
  
4068
 
  return time_tmp.year * LL(10000000000) + time_tmp.month * LL(100000000) +
 
4068
  return time_tmp.year * 10000000000LL + time_tmp.month * 100000000LL +
4069
4069
         time_tmp.day * 1000000L + time_tmp.hour * 10000L +
4070
4070
         time_tmp.minute * 100 + time_tmp.second;
4071
4071
}
4669
4669
    nr=floor(nr/1000000.0);                     // Timestamp to date
4670
4670
  if (nr < 0.0 || nr > 99991231.0)
4671
4671
  {
4672
 
    tmp= LL(0);
 
4672
    tmp= 0LL;
4673
4673
    set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
4674
4674
                         ER_WARN_DATA_OUT_OF_RANGE,
4675
4675
                         nr, MYSQL_TIMESTAMP_DATE);
4696
4696
                                           MODE_NO_ZERO_DATE |
4697
4697
                                           MODE_INVALID_DATES))), &error);
4698
4698
 
4699
 
  if (nr == LL(-1))
 
4699
  if (nr == -1LL)
4700
4700
  {
4701
4701
    nr= 0;
4702
4702
    error= 2;
4923
4923
                          (thd->variables.sql_mode &
4924
4924
                           (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
4925
4925
                            MODE_INVALID_DATES))),
4926
 
                         &error) == LL(-1))
 
4926
                         &error) == -1LL)
4927
4927
  {
4928
4928
    tmp= 0L;
4929
4929
    error= 2;
5160
5160
                                           MODE_NO_ZERO_DATE |
5161
5161
                                           MODE_INVALID_DATES))), &error);
5162
5162
 
5163
 
  if (nr == LL(-1))
 
5163
  if (nr == -1LL)
5164
5164
  {
5165
5165
    nr= 0;
5166
5166
    error= 2;
5196
5196
  if (time_type == MYSQL_TIMESTAMP_DATE ||
5197
5197
      time_type == MYSQL_TIMESTAMP_DATETIME)
5198
5198
  {
5199
 
    tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
 
5199
    tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*1000000LL+
5200
5200
         (ltime->hour*10000L+ltime->minute*100+ltime->second));
5201
5201
    if (check_date(ltime, tmp != 0,
5202
5202
                   (TIME_FUZZY_DATE |
5277
5277
    Avoid problem with slow longlong arithmetic and sprintf
5278
5278
  */
5279
5279
 
5280
 
  part1=(long) (tmp/LL(1000000));
5281
 
  part2=(long) (tmp - (uint64_t) part1*LL(1000000));
 
5280
  part1=(long) (tmp/1000000LL);
 
5281
  part2=(long) (tmp - (uint64_t) part1*1000000LL);
5282
5282
 
5283
5283
  pos=(char*) val_buffer->ptr() + MAX_DATETIME_WIDTH;
5284
5284
  *pos--=0;
5308
5308
{
5309
5309
  longlong tmp=Field_datetime::val_int();
5310
5310
  uint32 part1,part2;
5311
 
  part1=(uint32) (tmp/LL(1000000));
5312
 
  part2=(uint32) (tmp - (uint64_t) part1*LL(1000000));
 
5311
  part1=(uint32) (tmp/1000000LL);
 
5312
  part2=(uint32) (tmp - (uint64_t) part1*1000000LL);
5313
5313
 
5314
5314
  ltime->time_type=     MYSQL_TIMESTAMP_DATETIME;
5315
5315
  ltime->neg=           0;