diff options
author | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-04-19 21:43:42 +0500 |
---|---|---|
committer | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-04-19 21:43:42 +0500 |
commit | 611456362f520bd5b3380e7cf90cfb2aaadd18be (patch) | |
tree | 0eaec27c535b248bcfac6751f1bea94265b8d1cd /sql/field.h | |
parent | cc76701e8f47ca52ca209150f49ba665a215c1d0 (diff) | |
download | mariadb-git-611456362f520bd5b3380e7cf90cfb2aaadd18be.tar.gz |
Bug #27123 (partition + on duplicate key update + varchar = Can't find
record in table)
key_restore function didn't work as intended in the case of
VARCHAR or BLOB fields, stored the restored key in field->ptr instead
of to_record.
That produced the wrong key so search returned wrong result
mysql-test/r/partition.result:
result added
mysql-test/t/partition.test:
testcase
sql/field.cc:
Field_blob::store_length made static
sql/field.h:
Field_blob::store_length and set_ptr functions implemented in slightly
different way
sql/ha_ndbcluster.cc:
set_ptr_offset used
sql/key.cc:
set key_part->field->ptr to the proper place inside the to_record
so the restored key will be placed there as key_restore
is supposed to behave
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sql/field.h b/sql/field.h index 3d1ac7528c1..ac26ce13477 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1274,7 +1274,12 @@ public: } int reset(void) { bzero(ptr, packlength+sizeof(char*)); return 0; } void reset_fields() { bzero((char*) &value,sizeof(value)); } - void store_length(uint32 number); + static void store_length(char *ptr, uint packlength, uint32 number); + inline void store_length(uint32 number) + { + store_length(ptr, packlength, number); + } + inline uint32 get_length(uint row_offset=0) { return get_length(ptr+row_offset); } uint32 get_length(const char *ptr); @@ -1292,11 +1297,17 @@ public: memcpy(ptr,length,packlength); memcpy_fixed(ptr+packlength,&data,sizeof(char*)); } + void set_ptr_offset(my_ptrdiff_t ptr_diff, uint32 length,char *data) + { + char *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,char*); + store_length(ptr_ofs, packlength, length); + memcpy_fixed(ptr_ofs+packlength,&data,sizeof(char*)); + } inline void set_ptr(uint32 length,char *data) { - store_length(length); - memcpy_fixed(ptr+packlength,&data,sizeof(char*)); + set_ptr_offset(0, length, data); } + void get_key_image(char *buff,uint length, imagetype type); void set_key_image(char *buff,uint length); void sql_type(String &str) const; |