mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
merge with 3.23.51
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-mysql_fix_extensions.sh: Delete: scripts/mysql_fix_extensions.sh Build-tools/Do-rpm: Auto merged Makefile.am: Auto merged client/mysqldump.c: Auto merged client/mysqltest.c: Auto merged extra/resolve_stack_dump.c: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/mysqld_error.h: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0sel.c: Auto merged isam/pack_isam.c: Auto merged libmysql/libmysql.c: Auto merged mysql-test/r/func_if.result: Auto merged mysql-test/t/join.test: Auto merged mysys/array.c: Auto merged mysys/charset.c: Auto merged mysys/default.c: Auto merged mysys/hash.c: Auto merged mysys/my_thr_init.c: Auto merged mysys/raid.cc: Auto merged mysql-test/t/type_decimal.test: Auto merged sql/hostname.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_timefunc.h: Auto merged sql/log.cc: Auto merged sql/mini_client.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged strings/Makefile.am: Auto merged
This commit is contained in:
@ -28,6 +28,9 @@ Created 9/17/2000 Heikki Tuuri
|
||||
#include "rem0cmp.h"
|
||||
#include "log0log.h"
|
||||
|
||||
/* A dummy variable used to fool the compiler */
|
||||
ibool row_mysql_identically_false = FALSE;
|
||||
|
||||
/* List of tables we should drop in background. ALTER TABLE in MySQL requires
|
||||
that the table handler can drop the table in background when there are no
|
||||
queries to it any more. Protected by the kernel mutex. */
|
||||
@ -63,15 +66,48 @@ row_mysql_store_blob_ref(
|
||||
byte* dest, /* in: where to store */
|
||||
ulint col_len, /* in: dest buffer size: determines into
|
||||
how many bytes the BLOB length is stored,
|
||||
this may vary from 1 to 4 bytes */
|
||||
byte* data, /* in: BLOB data */
|
||||
ulint len) /* in: BLOB length */
|
||||
the space for the length may vary from 1
|
||||
to 4 bytes */
|
||||
byte* data, /* in: BLOB data; if the value to store
|
||||
is SQL NULL this should be NULL pointer */
|
||||
ulint len) /* in: BLOB length; if the value to store
|
||||
is SQL NULL this should be 0; remember
|
||||
also to set the NULL bit in the MySQL record
|
||||
header! */
|
||||
{
|
||||
ulint sum = 0;
|
||||
ulint i;
|
||||
|
||||
/* MySQL might assume the field is set to zero except the length and
|
||||
the pointer fields */
|
||||
|
||||
memset(dest, '\0', col_len);
|
||||
|
||||
/* In dest there are 1 - 4 bytes reserved for the BLOB length,
|
||||
and after that 8 bytes reserved for the pointer to the data.
|
||||
In 32-bit architectures we only use the first 4 bytes of the pointer
|
||||
slot. */
|
||||
|
||||
ut_a(col_len - 8 > 1 || len < 256);
|
||||
ut_a(col_len - 8 > 2 || len < 256 * 256);
|
||||
ut_a(col_len - 8 > 3 || len < 256 * 256 * 256);
|
||||
|
||||
/* We try to track an elusive bug which probably was fixed
|
||||
May 9, 2002, but better be sure: we probe the data buffer
|
||||
to make sure it is in valid allocated memory */
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
|
||||
sum += (ulint)(data + i);
|
||||
}
|
||||
|
||||
/* The variable below is identically false, we just fool the
|
||||
compiler to not optimize away our loop */
|
||||
if (row_mysql_identically_false) {
|
||||
|
||||
printf("Sum %lu\n", sum);
|
||||
}
|
||||
|
||||
mach_write_to_n_little_endian(dest, col_len - 8, len);
|
||||
|
||||
ut_memcpy(dest + col_len - 8, (byte*)&data, sizeof(byte*));
|
||||
|
Reference in New Issue
Block a user