summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authoringo@mysql.com <>2004-06-24 14:54:28 +0200
committeringo@mysql.com <>2004-06-24 14:54:28 +0200
commitfa86cada0c058773e1826d7dbbbf1e5d39f4f91f (patch)
treebeb44ebd0753758abb89605e77b2cc6a647f308e /sql/field.h
parentc9b1946c054e3f04a5dc61bd6add323eec95293e (diff)
downloadmariadb-git-fa86cada0c058773e1826d7dbbbf1e5d39f4f91f.tar.gz
bug#2686 - index_merge select on BerkeleyDB table with varchar PK causes mysqld to crash.
Added put_length() to get_length() and unpack_key() to pack_key(). Keys were packed with the minimum size of the length field for the key part and unpacked with length size of the base column. For the purpose of optimal key packing we have the method pack_key(), while rows are packed with pack(). Now keys are unpacked with unpack_key() and no longer with unpack() which is used for rows.
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index 5a1ab163266..d93ed1db9b5 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -189,6 +189,10 @@ public:
{
return pack(to,from,max_length);
}
+ virtual const char *unpack_key(char* to, const char *from, uint max_length)
+ {
+ return unpack(to,from);
+ }
virtual uint packed_col_length(const char *to, uint length)
{ return length;}
virtual uint max_packed_col_length(uint max_length)
@@ -890,6 +894,7 @@ public:
inline uint32 get_length(uint row_offset=0)
{ return get_length(ptr+row_offset); }
uint32 get_length(const char *ptr);
+ void put_length(char *pos, uint32 length);
bool binary() const { return binary_flag; }
inline void get_ptr(char **str)
{
@@ -923,6 +928,7 @@ public:
const char *unpack(char *to, const char *from);
char *pack_key(char *to, const char *from, uint max_length);
char *pack_key_from_key_image(char* to, const char *from, uint max_length);
+ const char *unpack_key(char* to, const char *from, uint max_length);
int pack_cmp(const char *a, const char *b, uint key_length);
int pack_cmp(const char *b, uint key_length);
uint packed_col_length(const char *col_ptr, uint length);