~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/field.cc

MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#define LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE 128
50
50
#define DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE 128
51
51
#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
52
 
((ulong) ((LL(1) << min(arg, 4) * 8) - LL(1)))
 
52
((ulong) ((1LL << min(arg, 4) * 8) - 1LL))
53
53
 
54
54
#define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)))
55
55
#define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index)))
2871
2871
      res=0;
2872
2872
      error= 1;
2873
2873
    }
2874
 
    else if ((uint64_t) nr >= (LL(1) << 32))
 
2874
    else if ((uint64_t) nr >= (1LL << 32))
2875
2875
    {
2876
2876
      res=(int32) (uint32) ~0L;
2877
2877
      error= 1;
4006
4006
  longlong tmp= number_to_datetime(nr, &l_time, (thd->variables.sql_mode &
4007
4007
                                                 MODE_NO_ZERO_DATE) |
4008
4008
                                   MODE_NO_ZERO_IN_DATE, &error);
4009
 
  if (tmp == LL(-1))
 
4009
  if (tmp == -1LL)
4010
4010
  {
4011
4011
    error= 2;
4012
4012
  }
4062
4062
  
4063
4063
  thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, (my_time_t)temp);
4064
4064
  
4065
 
  return time_tmp.year * LL(10000000000) + time_tmp.month * LL(100000000) +
 
4065
  return time_tmp.year * 10000000000LL + time_tmp.month * 100000000LL +
4066
4066
         time_tmp.day * 1000000L + time_tmp.hour * 10000L +
4067
4067
         time_tmp.minute * 100 + time_tmp.second;
4068
4068
}
4666
4666
    nr=floor(nr/1000000.0);                     // Timestamp to date
4667
4667
  if (nr < 0.0 || nr > 99991231.0)
4668
4668
  {
4669
 
    tmp= LL(0);
 
4669
    tmp= 0LL;
4670
4670
    set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
4671
4671
                         ER_WARN_DATA_OUT_OF_RANGE,
4672
4672
                         nr, MYSQL_TIMESTAMP_DATE);
4693
4693
                                           MODE_NO_ZERO_DATE |
4694
4694
                                           MODE_INVALID_DATES))), &error);
4695
4695
 
4696
 
  if (nr == LL(-1))
 
4696
  if (nr == -1LL)
4697
4697
  {
4698
4698
    nr= 0;
4699
4699
    error= 2;
4920
4920
                          (thd->variables.sql_mode &
4921
4921
                           (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
4922
4922
                            MODE_INVALID_DATES))),
4923
 
                         &error) == LL(-1))
 
4923
                         &error) == -1LL)
4924
4924
  {
4925
4925
    tmp= 0L;
4926
4926
    error= 2;
5157
5157
                                           MODE_NO_ZERO_DATE |
5158
5158
                                           MODE_INVALID_DATES))), &error);
5159
5159
 
5160
 
  if (nr == LL(-1))
 
5160
  if (nr == -1LL)
5161
5161
  {
5162
5162
    nr= 0;
5163
5163
    error= 2;
5193
5193
  if (time_type == MYSQL_TIMESTAMP_DATE ||
5194
5194
      time_type == MYSQL_TIMESTAMP_DATETIME)
5195
5195
  {
5196
 
    tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
 
5196
    tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*1000000LL+
5197
5197
         (ltime->hour*10000L+ltime->minute*100+ltime->second));
5198
5198
    if (check_date(ltime, tmp != 0,
5199
5199
                   (TIME_FUZZY_DATE |
5274
5274
    Avoid problem with slow longlong arithmetic and sprintf
5275
5275
  */
5276
5276
 
5277
 
  part1=(long) (tmp/LL(1000000));
5278
 
  part2=(long) (tmp - (uint64_t) part1*LL(1000000));
 
5277
  part1=(long) (tmp/1000000LL);
 
5278
  part2=(long) (tmp - (uint64_t) part1*1000000LL);
5279
5279
 
5280
5280
  pos=(char*) val_buffer->ptr() + MAX_DATETIME_WIDTH;
5281
5281
  *pos--=0;
5305
5305
{
5306
5306
  longlong tmp=Field_datetime::val_int();
5307
5307
  uint32 part1,part2;
5308
 
  part1=(uint32) (tmp/LL(1000000));
5309
 
  part2=(uint32) (tmp - (uint64_t) part1*LL(1000000));
 
5308
  part1=(uint32) (tmp/1000000LL);
 
5309
  part2=(uint32) (tmp - (uint64_t) part1*1000000LL);
5310
5310
 
5311
5311
  ltime->time_type=     MYSQL_TIMESTAMP_DATETIME;
5312
5312
  ltime->neg=           0;