~ubuntu-branches/ubuntu/hardy/mysql-dfsg-5.0/hardy-updates

« back to all changes in this revision

Viewing changes to sql/field.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-04-02 16:10:53 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070402161053-zkil9hjq9k5p1uzv
Tags: 5.0.37-0ubuntu1
* New upstream bugfix release.
  - Fixes replication failure with auto-increment and on duplicate key
    update, a regression introduced into 5.0.24. (LP: #95821)
* debian/control: Set Ubuntu maintainer.
* debian/rules: Change comments from 'Debian etch' to 'Ubuntu 7.04'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
 
1
/* Copyright (C) 2000-2006 MySQL AB
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
5
 
   the Free Software Foundation; either version 2 of the License, or
6
 
   (at your option) any later version.
 
5
   the Free Software Foundation; version 2 of the License.
7
6
 
8
7
   This program is distributed in the hope that it will be useful,
9
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
30
29
class Send_field;
31
30
class Protocol;
32
31
struct st_cache_field;
33
 
void field_conv(Field *to,Field *from);
 
32
int field_conv(Field *to,Field *from);
34
33
 
35
34
inline uint get_enum_pack_length(int elements)
36
35
{
726
725
 
727
726
class Field_double :public Field_real {
728
727
public:
 
728
  my_bool not_fixed;
729
729
  Field_double(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
730
730
               uchar null_bit_arg,
731
731
               enum utype unireg_check_arg, const char *field_name_arg,
733
733
               uint8 dec_arg,bool zero_arg,bool unsigned_arg)
734
734
    :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
735
735
                unireg_check_arg, field_name_arg, table_arg,
736
 
                dec_arg, zero_arg, unsigned_arg)
 
736
                dec_arg, zero_arg, unsigned_arg),
 
737
     not_fixed(dec_arg >= NOT_FIXED_DEC)
737
738
    {}
738
739
  Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg,
739
740
               struct st_table *table_arg, uint8 dec_arg)
740
 
    :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
741
 
                NONE, field_name_arg, table_arg, dec_arg, 0, 0)
 
741
    :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
 
742
                NONE, field_name_arg, table_arg, dec_arg, 0, 0),
 
743
     not_fixed(dec_arg >= NOT_FIXED_DEC)
 
744
    {}
 
745
  Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg,
 
746
               struct st_table *table_arg, uint8 dec_arg, my_bool not_fixed_srg)
 
747
    :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
 
748
                NONE, field_name_arg, table_arg, dec_arg, 0, 0), 
 
749
    not_fixed(not_fixed_srg)
742
750
    {}
743
751
  enum_field_types type() const { return FIELD_TYPE_DOUBLE;}
744
752
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
755
763
  uint32 pack_length() const { return sizeof(double); }
756
764
  void sql_type(String &str) const;
757
765
  uint32 max_length() { return 53; }
 
766
  uint size_of() const { return sizeof(*this); }
758
767
};
759
768
 
760
769
 
1035
1044
  bool zero_pack() const { return 0; }
1036
1045
  int reset(void)
1037
1046
  {
1038
 
    charset()->cset->fill(charset(),ptr,field_length,' ');
 
1047
    charset()->cset->fill(charset(),ptr,field_length,
 
1048
                          (has_charset() ? ' ' : 0));
1039
1049
    return 0;
1040
1050
  }
1041
1051
  int store(const char *to,uint length,CHARSET_INFO *charset);
1242
1252
  uint max_packed_col_length(uint max_length);
1243
1253
  void free() { value.free(); }
1244
1254
  inline void clear_temporary() { bzero((char*) &value,sizeof(value)); }
1245
 
  friend void field_conv(Field *to,Field *from);
 
1255
  friend int field_conv(Field *to,Field *from);
1246
1256
  uint size_of() const { return sizeof(*this); }
1247
1257
  bool has_charset(void) const
1248
1258
  { return charset() == &my_charset_bin ? FALSE : TRUE; }
1298
1308
  {
1299
1309
      flags|=ENUM_FLAG;
1300
1310
  }
 
1311
  Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
1301
1312
  enum_field_types type() const { return FIELD_TYPE_STRING; }
1302
1313
  enum Item_result cmp_type () const { return INT_RESULT; }
1303
1314
  enum Item_result cast_to_int_type () const { return INT_RESULT; }