summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorunknown <kent@mysql.com>2006-02-28 23:29:58 +0100
committerunknown <kent@mysql.com>2006-02-28 23:29:58 +0100
commit3addd306a66b146ae5500f1bce5e6ddba036c8e8 (patch)
treeefd2f0f295954c586163d618728c858a8dde7543 /sql/field.h
parent59b6ab1fe01f48fb4def09f9565b842aa78e5f8e (diff)
parentfb936d2a86416127c031f3972f669e1c2b4291b3 (diff)
downloadmariadb-git-3addd306a66b146ae5500f1bce5e6ddba036c8e8.tar.gz
Merge
configure.in: Auto merged client/mysqlimport.c: Auto merged include/config-win.h: Auto merged mysql-test/r/create.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/disabled.def: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged sql/field.h: Auto merged sql/log_event.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_partition.cc: Auto merged sql/sql_table.cc: Auto merged mysql-test/t/mysqldump.test: SCCS merged
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/sql/field.h b/sql/field.h
index ad8b34594b7..3fbdc0d0aa9 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -173,8 +173,9 @@ public:
virtual int cmp(const char *,const char *)=0;
virtual int cmp_binary(const char *a,const char *b, uint32 max_length=~0L)
{ return memcmp(a,b,pack_length()); }
- int cmp_offset(uint row_offset) { return cmp(ptr,ptr+row_offset); }
- int cmp_binary_offset(uint row_offset)
+ virtual int cmp_offset(uint row_offset)
+ { return cmp(ptr,ptr+row_offset); }
+ virtual int cmp_binary_offset(uint row_offset)
{ return cmp_binary(ptr, ptr+row_offset); };
virtual int key_cmp(const byte *a,const byte *b)
{ return cmp((char*) a,(char*) b); }
@@ -1317,6 +1318,20 @@ public:
};
+/*
+ Note:
+ To use Field_bit::cmp_binary() you need to copy the bits stored in
+ the beginning of the record (the NULL bytes) to each memory you
+ want to compare (where the arguments point).
+
+ This is the reason:
+ - Field_bit::cmp_binary() is only implemented in the base class
+ (Field::cmp_binary()).
+ - Field::cmp_binary() currenly use pack_length() to calculate how
+ long the data is.
+ - pack_length() includes size of the bits stored in the NULL bytes
+ of the record.
+*/
class Field_bit :public Field {
public:
uchar *bit_ptr; // position in record where 'uneven' bits store
@@ -1342,6 +1357,8 @@ public:
my_decimal *val_decimal(my_decimal *);
int cmp(const char *a, const char *b)
{ return cmp_binary(a, b); }
+ int cmp_binary_offset(uint row_offset)
+ { return cmp_offset(row_offset); }
int cmp_max(const char *a, const char *b, uint max_length);
int key_cmp(const byte *a, const byte *b)
{ return cmp_binary((char *) a, (char *) b); }