mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge bk@192.168.21.1:mysql-5.1
into mysql.com:/d2/hf/mrg/mysql-5.1-opt BitKeeper/deleted/.del-CMakeLists.txt~1: Auto merged mysql-test/r/type_datetime.result: Auto merged mysql-test/r/windows.result: Auto merged mysql-test/t/windows.test: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_subselect.h: Auto merged sql/item_sum.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_yacc.yy: Auto merged storage/innobase/handler/ha_innodb.cc: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/include/mix1.inc: merging mysql-test/r/innodb_mysql.result: merging
This commit is contained in:
42
sql/field.cc
42
sql/field.cc
@@ -6403,6 +6403,15 @@ uint Field_string::max_packed_col_length(uint max_length)
|
||||
return (max_length > 255 ? 2 : 1)+max_length;
|
||||
}
|
||||
|
||||
uint Field_string::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
{
|
||||
uint bytes = my_charpos(field_charset, ptr, ptr + field_length,
|
||||
length / field_charset->mbmaxlen);
|
||||
memcpy(buff, ptr, bytes);
|
||||
if (bytes < length)
|
||||
bzero(buff + bytes, length - bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
|
||||
bool keep_type)
|
||||
@@ -6861,9 +6870,7 @@ uint Field_varstring::max_packed_col_length(uint max_length)
|
||||
return (max_length > 255 ? 2 : 1)+max_length;
|
||||
}
|
||||
|
||||
|
||||
void Field_varstring::get_key_image(char *buff, uint length,
|
||||
imagetype type_arg)
|
||||
uint Field_varstring::get_key_image(char *buff, uint length, imagetype type)
|
||||
{
|
||||
uint f_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
|
||||
uint local_char_length= length / field_charset->mbmaxlen;
|
||||
@@ -6882,6 +6889,7 @@ void Field_varstring::get_key_image(char *buff, uint length,
|
||||
*/
|
||||
bzero(buff+HA_KEY_BLOB_LENGTH+f_length, (length-f_length));
|
||||
}
|
||||
return HA_KEY_BLOB_LENGTH+f_length;
|
||||
}
|
||||
|
||||
|
||||
@@ -7286,7 +7294,7 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr,
|
||||
|
||||
/* The following is used only when comparing a key */
|
||||
|
||||
void Field_blob::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
uint Field_blob::get_key_image(char *buff,uint length, imagetype type_arg)
|
||||
{
|
||||
uint32 blob_length= get_length(ptr);
|
||||
char *blob;
|
||||
@@ -7298,16 +7306,17 @@ void Field_blob::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
MBR mbr;
|
||||
Geometry_buffer buffer;
|
||||
Geometry *gobj;
|
||||
const uint image_length= SIZEOF_STORED_DOUBLE*4;
|
||||
|
||||
if (blob_length < SRID_SIZE)
|
||||
{
|
||||
bzero(buff, SIZEOF_STORED_DOUBLE*4);
|
||||
return;
|
||||
bzero(buff, image_length);
|
||||
return image_length;
|
||||
}
|
||||
get_ptr(&blob);
|
||||
gobj= Geometry::construct(&buffer, blob, blob_length);
|
||||
if (!gobj || gobj->get_mbr(&mbr, &dummy))
|
||||
bzero(buff, SIZEOF_STORED_DOUBLE*4);
|
||||
bzero(buff, image_length);
|
||||
else
|
||||
{
|
||||
float8store(buff, mbr.xmin);
|
||||
@@ -7315,7 +7324,7 @@ void Field_blob::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
float8store(buff+16, mbr.ymin);
|
||||
float8store(buff+24, mbr.ymax);
|
||||
}
|
||||
return;
|
||||
return image_length;
|
||||
}
|
||||
#endif /*HAVE_SPATIAL*/
|
||||
|
||||
@@ -7336,6 +7345,7 @@ void Field_blob::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
}
|
||||
int2store(buff,length);
|
||||
memcpy(buff+HA_KEY_BLOB_LENGTH, blob, length);
|
||||
return HA_KEY_BLOB_LENGTH+length;
|
||||
}
|
||||
|
||||
|
||||
@@ -7633,7 +7643,7 @@ uint Field_blob::is_equal(create_field *new_field)
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
|
||||
void Field_geom::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
uint Field_geom::get_key_image(char *buff, uint length, imagetype type)
|
||||
{
|
||||
char *blob;
|
||||
const char *dummy;
|
||||
@@ -7641,16 +7651,17 @@ void Field_geom::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
ulong blob_length= get_length(ptr);
|
||||
Geometry_buffer buffer;
|
||||
Geometry *gobj;
|
||||
const uint image_length= SIZEOF_STORED_DOUBLE*4;
|
||||
|
||||
if (blob_length < SRID_SIZE)
|
||||
{
|
||||
bzero(buff, SIZEOF_STORED_DOUBLE*4);
|
||||
return;
|
||||
bzero(buff, image_length);
|
||||
return image_length;
|
||||
}
|
||||
get_ptr(&blob);
|
||||
gobj= Geometry::construct(&buffer, blob, blob_length);
|
||||
if (!gobj || gobj->get_mbr(&mbr, &dummy))
|
||||
bzero(buff, SIZEOF_STORED_DOUBLE*4);
|
||||
bzero(buff, image_length);
|
||||
else
|
||||
{
|
||||
float8store(buff, mbr.xmin);
|
||||
@@ -7658,6 +7669,7 @@ void Field_geom::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
float8store(buff + 16, mbr.ymin);
|
||||
float8store(buff + 24, mbr.ymax);
|
||||
}
|
||||
return image_length;
|
||||
}
|
||||
|
||||
|
||||
@@ -8441,7 +8453,7 @@ int Field_bit::cmp_offset(uint row_offset)
|
||||
}
|
||||
|
||||
|
||||
void Field_bit::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
uint Field_bit::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
{
|
||||
if (bit_len)
|
||||
{
|
||||
@@ -8449,7 +8461,9 @@ void Field_bit::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
*buff++= bits;
|
||||
length--;
|
||||
}
|
||||
memcpy(buff, ptr, min(length, bytes_in_rec));
|
||||
uint data_length = min(length, bytes_in_rec);
|
||||
memcpy(buff, ptr, data_length);
|
||||
return data_length + 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user