~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/field.cc

  • Committer: Monty Taylor
  • Date: 2008-07-09 15:52:52 UTC
  • mto: (77.6.1 glibclient-merge)
  • mto: This revision was merged to the branch mainline in revision 112.
  • Revision ID: monty@inaugust.com-20080709155252-lnzmxxje1g40z3a7
Warning fixes. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
  //MYSQL_TYPE_NULL         MYSQL_TYPE_TIMESTAMP
86
86
    MYSQL_TYPE_NEWDECIMAL,  MYSQL_TYPE_VARCHAR,
87
87
  //MYSQL_TYPE_LONGLONG     MYSQL_TYPE_INT24
88
 
    MYSQL_TYPE_DECIMAL,     MYSQL_TYPE_DECIMAL,
 
88
  //MYSQL_TYPE_DECIMAL,     MYSQL_TYPE_DECIMAL,
89
89
  //MYSQL_TYPE_DATE         MYSQL_TYPE_TIME
90
90
    MYSQL_TYPE_VARCHAR,     MYSQL_TYPE_VARCHAR,
91
91
  //MYSQL_TYPE_DATETIME     MYSQL_TYPE_YEAR
454
454
  /* MYSQL_TYPE_YEAR -> */
455
455
  {
456
456
  //MYSQL_TYPE_DECIMAL      MYSQL_TYPE_TINY
457
 
    MYSQL_TYPE_DECIMAL,     MYSQL_TYPE_TINY,
 
457
    MYSQL_TYPE_NEWDECIMAL,  MYSQL_TYPE_TINY,
458
458
  //MYSQL_TYPE_SHORT        MYSQL_TYPE_LONG
459
459
    MYSQL_TYPE_SHORT,       MYSQL_TYPE_LONG,
460
460
  //MYSQL_TYPE_FLOAT        MYSQL_TYPE_DOUBLE
1385
1385
}
1386
1386
 
1387
1387
 
1388
 
my_decimal *Field::val_decimal(my_decimal *decimal)
 
1388
my_decimal *Field::val_decimal(my_decimal *decimal __attribute__((__unused__)))
1389
1389
{
1390
1390
  /* This never have to be called */
1391
1391
  DBUG_ASSERT(0);
1635
1635
    Needs to be changed if/when we want to support different time formats.
1636
1636
*/
1637
1637
 
1638
 
int Field::store_time(MYSQL_TIME *ltime, timestamp_type type_arg)
 
1638
int Field::store_time(MYSQL_TIME *ltime,
 
1639
                      timestamp_type type_arg __attribute__((__unused__)))
1639
1640
{
1640
1641
  ASSERT_COLUMN_MARKED_FOR_WRITE;
1641
1642
  char buff[MAX_DATE_STRING_REP_LENGTH];
1960
1961
}
1961
1962
 
1962
1963
 
1963
 
int Field_new_decimal::store_time(MYSQL_TIME *ltime, timestamp_type t_type)
 
1964
int Field_new_decimal::store_time(MYSQL_TIME *ltime,
 
1965
                                  timestamp_type t_type __attribute__((__unused__)))
1964
1966
{
1965
1967
    my_decimal decimal_value;
1966
1968
    return store_value(date2my_decimal(ltime, &decimal_value));
3862
3864
  exception is different behavior of old/new timestamps during ALTER TABLE.
3863
3865
 */
3864
3866
 
3865
 
Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg,
 
3867
Field_timestamp::Field_timestamp(uchar *ptr_arg,
 
3868
                                 uint32 len_arg __attribute__((__unused__)),
3866
3869
                                 uchar *null_ptr_arg, uchar null_bit_arg,
3867
 
                                 enum utype unireg_check_arg,
3868
 
                                 const char *field_name_arg,
3869
 
                                 TABLE_SHARE *share,
3870
 
                                 CHARSET_INFO *cs)
 
3870
                                 enum utype unireg_check_arg,
 
3871
                                 const char *field_name_arg,
 
3872
                                 TABLE_SHARE *share,
 
3873
                                 CHARSET_INFO *cs)
3871
3874
  :Field_str(ptr_arg, MAX_DATETIME_WIDTH, null_ptr_arg, null_bit_arg,
3872
3875
             unireg_check_arg, field_name_arg, cs)
3873
3876
{
3933
3936
}
3934
3937
 
3935
3938
 
3936
 
int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
 
3939
int Field_timestamp::store(const char *from,
 
3940
                           uint len,
 
3941
                           CHARSET_INFO *cs __attribute__((__unused__)))
3937
3942
{
3938
3943
  ASSERT_COLUMN_MARKED_FOR_WRITE;
3939
3944
  MYSQL_TIME l_time;
3993
3998
}
3994
3999
 
3995
4000
 
3996
 
int Field_timestamp::store(longlong nr, bool unsigned_val)
 
4001
int Field_timestamp::store(longlong nr,
 
4002
                           bool unsigned_val __attribute__((__unused__)))
3997
4003
{
3998
4004
  ASSERT_COLUMN_MARKED_FOR_WRITE;
3999
4005
  MYSQL_TIME l_time;
4240
4246
** Stored as a 3 byte unsigned int
4241
4247
****************************************************************************/
4242
4248
 
4243
 
int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
 
4249
int Field_time::store(const char *from,
 
4250
                      uint len,
 
4251
                      CHARSET_INFO *cs __attribute__((__unused__)))
4244
4252
{
4245
4253
  MYSQL_TIME ltime;
4246
4254
  long tmp;
4282
4290
}
4283
4291
 
4284
4292
 
4285
 
int Field_time::store_time(MYSQL_TIME *ltime, timestamp_type time_type)
 
4293
int Field_time::store_time(MYSQL_TIME *ltime,
 
4294
                           timestamp_type time_type __attribute__((__unused__)))
4286
4295
{
4287
4296
  long tmp= ((ltime->month ? 0 : ltime->day * 24L) + ltime->hour) * 10000L +
4288
4297
            (ltime->minute * 100 + ltime->second);
4549
4558
}
4550
4559
 
4551
4560
 
4552
 
int Field_year::store(longlong nr, bool unsigned_val)
 
4561
int Field_year::store(longlong nr,
 
4562
                      bool unsigned_val __attribute__((__unused__)))
4553
4563
{
4554
4564
  ASSERT_COLUMN_MARKED_FOR_WRITE;
4555
4565
  if (nr < 0 || (nr >= 100 && nr <= 1900) || nr > 2155)
4640
4650
       store function.
4641
4651
*/
4642
4652
 
4643
 
int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
 
4653
int Field_newdate::store(const char *from,
 
4654
                         uint len,
 
4655
                         CHARSET_INFO *cs __attribute__((__unused__)))
4644
4656
{
4645
4657
  ASSERT_COLUMN_MARKED_FOR_WRITE;
4646
4658
  long tmp;
4690
4702
}
4691
4703
 
4692
4704
 
4693
 
int Field_newdate::store(longlong nr, bool unsigned_val)
 
4705
int Field_newdate::store(longlong nr,
 
4706
                         bool unsigned_val __attribute__((__unused__)))
4694
4707
{
4695
4708
  ASSERT_COLUMN_MARKED_FOR_WRITE;
4696
4709
  MYSQL_TIME l_time;
4872
4885
** Stored as a 8 byte unsigned int. Should sometimes be change to a 6 byte int.
4873
4886
****************************************************************************/
4874
4887
 
4875
 
int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
 
4888
int Field_datetime::store(const char *from,
 
4889
                          uint len,
 
4890
                          CHARSET_INFO *cs __attribute__((__unused__)))
4876
4891
{
4877
4892
  ASSERT_COLUMN_MARKED_FOR_WRITE;
4878
4893
  MYSQL_TIME time_tmp;
4925
4940
}
4926
4941
 
4927
4942
 
4928
 
int Field_datetime::store(longlong nr, bool unsigned_val)
 
4943
int Field_datetime::store(longlong nr,
 
4944
                          bool unsigned_val __attribute__((__unused__)))
4929
4945
{
4930
4946
  ASSERT_COLUMN_MARKED_FOR_WRITE;
4931
4947
  MYSQL_TIME not_used;
5727
5743
}
5728
5744
 
5729
5745
 
5730
 
uint Field_string::get_key_image(uchar *buff, uint length, imagetype type_arg)
 
5746
uint Field_string::get_key_image(uchar *buff,
 
5747
                                 uint length,
 
5748
                                 imagetype type_arg __attribute__((__unused__)))
5731
5749
{
5732
5750
  uint bytes = my_charpos(field_charset, (char*) ptr,
5733
5751
                          (char*) ptr + field_length,
6084
6102
*/
6085
6103
 
6086
6104
const uchar *
6087
 
Field_varstring::unpack_key(uchar *to, const uchar *key, uint max_length,
 
6105
Field_varstring::unpack_key(uchar *to __attribute__((__unused__)),
 
6106
                            const uchar *key, uint max_length,
6088
6107
                            bool low_byte_first __attribute__((unused)))
6089
6108
{
6090
6109
  /* get length of the blob key */
6237
6256
  return (max_length > 255 ? 2 : 1)+max_length;
6238
6257
}
6239
6258
 
6240
 
uint Field_varstring::get_key_image(uchar *buff, uint length, imagetype type)
 
6259
uint Field_varstring::get_key_image(uchar *buff,
 
6260
                                    uint length,
 
6261
                                    imagetype type __attribute__((__unused__)))
6241
6262
{
6242
6263
  uint f_length=  length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
6243
6264
  uint local_char_length= length / field_charset->mbmaxlen;
6373
6394
}
6374
6395
 
6375
6396
 
6376
 
void Field_blob::store_length(uchar *i_ptr, 
6377
 
                              uint i_packlength, 
6378
 
                              uint32 i_number, 
6379
 
                              bool low_byte_first)
 
6397
void Field_blob::store_length(uchar *i_ptr,
 
6398
                              uint i_packlength,
 
6399
                              uint32 i_number,
 
6400
                              bool low_byte_first __attribute__((__unused__)))
6380
6401
{
6381
6402
  switch (i_packlength) {
6382
6403
  case 1:
6408
6429
}
6409
6430
 
6410
6431
 
6411
 
uint32 Field_blob::get_length(const uchar *pos, uint packlength_arg, bool low_byte_first)
 
6432
uint32 Field_blob::get_length(const uchar *pos,
 
6433
                              uint packlength_arg,
 
6434
                              bool low_byte_first __attribute__((__unused__)))
6412
6435
{
6413
6436
  switch (packlength_arg) {
6414
6437
  case 1:
6669
6692
 
6670
6693
/* The following is used only when comparing a key */
6671
6694
 
6672
 
uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg)
 
6695
uint Field_blob::get_key_image(uchar *buff,
 
6696
                               uint length,
 
6697
                               imagetype type_arg __attribute__((__unused__)))
6673
6698
{
6674
6699
  uint32 blob_length= get_length(ptr);
6675
6700
  uchar *blob;
6862
6887
 
6863
6888
   @return  New pointer into memory based on from + length of the data
6864
6889
*/
6865
 
const uchar *Field_blob::unpack(uchar *to, 
 
6890
const uchar *Field_blob::unpack(uchar *to __attribute__((__unused__)),
6866
6891
                                const uchar *from,
6867
6892
                                uint param_data,
6868
6893
                                bool low_byte_first)
7151
7176
}
7152
7177
 
7153
7178
 
7154
 
int Field_enum::store(longlong nr, bool unsigned_val)
 
7179
int Field_enum::store(longlong nr,
 
7180
                      bool unsigned_val __attribute__((__unused__)))
7155
7181
{
7156
7182
  ASSERT_COLUMN_MARKED_FOR_WRITE;
7157
7183
  int error= 0;
7360
7386
}
7361
7387
 
7362
7388
 
7363
 
int Field_set::store(longlong nr, bool unsigned_val)
 
7389
int Field_set::store(longlong nr,
 
7390
                     bool unsigned_val __attribute__((__unused__)))
7364
7391
{
7365
7392
  ASSERT_COLUMN_MARKED_FOR_WRITE;
7366
7393
  int error= 0;
7581
7608
                        uint fld_type_modifier, Item *fld_default_value,
7582
7609
                        Item *fld_on_update_value, LEX_STRING *fld_comment,
7583
7610
                        char *fld_change, List<String> *fld_interval_list,
7584
 
                        CHARSET_INFO *fld_charset, uint fld_geom_type,
 
7611
                        CHARSET_INFO *fld_charset,
 
7612
                        uint fld_geom_type __attribute__((__unused__)),
7585
7613
                        enum column_format_type column_format)
7586
7614
{
7587
7615
  uint sign_len, allowed_type_modifier= 0;
7588
7616
  ulong max_field_charlength= MAX_FIELD_CHARLENGTH;
7589
7617
 
7590
7618
  DBUG_ENTER("Create_field::init()");
7591
 
  
 
7619
 
7592
7620
  field= 0;
7593
7621
  field_name= fld_name;
7594
7622
  def= fld_default_value;