summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2006-04-10 14:30:00 -0700
committerunknown <jimw@mysql.com>2006-04-10 14:30:00 -0700
commit15bec6c5e591ca66a840c41a289878efe82ae00f (patch)
tree4d8e8f6b65a1dc14de22bc7fc4857ef7feb61393 /sql/field.h
parentfc1a194ef2d50c59dbff9be704634c2e51eaf53e (diff)
parent2ccae984d1c2a1f19df9839526f662ac655ceb3e (diff)
downloadmariadb-git-15bec6c5e591ca66a840c41a289878efe82ae00f.tar.gz
Merge bk-internal:/home/bk/mysql-5.0
into mysql.com:/home/jimw/my/mysql-5.0-clean sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_ndbcluster.cc: Auto merged
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/sql/field.h b/sql/field.h
index a4bdcc4da02..f4d27e46877 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1312,17 +1312,18 @@ public:
uchar *bit_ptr; // position in record where 'uneven' bits store
uchar bit_ofs; // offset to 'uneven' high bits
uint bit_len; // number of 'uneven' high bits
+ uint bytes_in_rec;
Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg);
enum_field_types type() const { return FIELD_TYPE_BIT; }
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; }
- uint32 key_length() const { return (uint32) field_length + (bit_len > 0); }
- uint32 max_length() { return (uint32) field_length * 8 + bit_len; }
+ uint32 key_length() const { return (uint32) (field_length + 7) / 8; }
+ uint32 max_length() { return field_length; }
uint size_of() const { return sizeof(*this); }
Item_result result_type () const { return INT_RESULT; }
- void reset(void) { bzero(ptr, field_length); }
+ void reset(void) { bzero(ptr, bytes_in_rec); }
int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr);
int store(longlong nr, bool unsigned_val);
@@ -1344,9 +1345,8 @@ public:
{ Field_bit::store(buff, length, &my_charset_bin); }
void sort_string(char *buff, uint length)
{ get_key_image(buff, length, itRAW); }
- uint32 pack_length() const
- { return (uint32) field_length + (bit_len > 0); }
- uint32 pack_length_in_rec() const { return field_length; }
+ uint32 pack_length() const { return (uint32) (field_length + 7) / 8; }
+ uint32 pack_length_in_rec() const { return bytes_in_rec; }
void sql_type(String &str) const;
char *pack(char *to, const char *from, uint max_length=~(uint) 0);
const char *unpack(char* to, const char *from);
@@ -1363,13 +1363,11 @@ public:
class Field_bit_as_char: public Field_bit {
public:
- uchar create_length;
Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg);
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
- uint32 max_length() { return (uint32) create_length; }
uint size_of() const { return sizeof(*this); }
int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr) { return Field_bit::store(nr); }