29 #include "data0data.ic"
32 #ifndef UNIV_HOTBACKUP
47 UNIV_INTERN byte data_error;
49 # ifndef UNIV_DEBUG_VALGRIND
51 UNIV_INTERN ulint data_dummy;
55 #ifndef UNIV_HOTBACKUP
70 ut_ad(tuple1 && tuple2);
71 ut_ad(tuple1->magic_n == DATA_TUPLE_MAGIC_N);
72 ut_ad(tuple2->magic_n == DATA_TUPLE_MAGIC_N);
83 for (i = 0; i < n_fields; i++) {
85 const dfield_t* field1 = dtuple_get_nth_field(tuple1, i);
86 const dfield_t* field2 = dtuple_get_nth_field(tuple2, i);
119 dfield_check_typed_no_assert(
123 if (dfield_get_type(field)->mtype > DATA_MYSQL
124 || dfield_get_type(field)->mtype < DATA_VARCHAR) {
127 "InnoDB: Error: data field type %lu, len %lu\n",
128 (ulong) dfield_get_type(field)->mtype,
150 "InnoDB: Error: index entry has %lu fields\n",
153 fputs(
"InnoDB: Tuple contents: ", stderr);
162 field = dtuple_get_nth_field(tuple, i);
164 if (!dfield_check_typed_no_assert(field)) {
183 if (dfield_get_type(field)->mtype > DATA_MYSQL
184 || dfield_get_type(field)->mtype < DATA_VARCHAR) {
187 "InnoDB: Error: data field type %lu, len %lu\n",
188 (ulong) dfield_get_type(field)->mtype,
211 field = dtuple_get_nth_field(tuple, i);
234 ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
241 for (i = 0; i < n_fields; i++) {
243 field = dtuple_get_nth_field(tuple, i);
250 data =
static_cast<const byte*
>(dfield_get_data(field));
251 #ifndef UNIV_DEBUG_VALGRIND
254 for (j = 0; j < len; j++) {
263 UNIV_MEM_ASSERT_RW(data, len);
273 #ifndef UNIV_HOTBACKUP
287 data =
static_cast<const byte*
>(dfield_get_data(dfield));
290 fputs(
"NULL", stderr);
298 for (i = 0; i < len; i++) {
300 putc(isprint(c) ? c :
' ', stderr);
304 fputs(
"(external)", stderr);
329 ibool print_also_hex;
332 data =
static_cast<const byte*
>(dfield_get_data(dfield));
335 fputs(
"NULL", stderr);
350 if (!(prtype & DATA_UNSIGNED)) {
352 fprintf(stderr,
"%ld", (
long) val);
354 fprintf(stderr,
"%lu", (ulong) val);
361 if (!(prtype & DATA_UNSIGNED)) {
363 fprintf(stderr,
"%ld", (
long) val);
365 fprintf(stderr,
"%lu", (ulong) val);
372 if (!(prtype & DATA_UNSIGNED)) {
374 fprintf(stderr,
"%ld", (
long) val);
376 fprintf(stderr,
"%lu", (ulong) val);
383 if (!(prtype & DATA_UNSIGNED)) {
385 fprintf(stderr,
"%ld", (
long) val);
387 fprintf(stderr,
"%lu", (ulong) val);
393 fprintf(stderr,
"%llu", (ullint)
id);
398 fprintf(stderr,
"%llu", (ullint)
id);
402 fprintf(stderr,
"%llu", (ullint)
id);
410 switch (prtype & DATA_SYS_PRTYPE_MASK) {
438 print_also_hex = FALSE;
440 for (i = 0; i < len; i++) {
444 print_also_hex = TRUE;
446 fprintf(stderr,
"\\x%02x", (
unsigned char) c);
453 fputs(
"(external)", stderr);
456 if (!print_also_hex) {
460 data =
static_cast<byte*
>(dfield_get_data(dfield));
466 fputs(
" Hex: ",stderr);
468 for (i = 0; i < len; i++) {
469 fprintf(stderr,
"%02lx", (ulint) *data++);
473 fputs(
"(external)", stderr);
489 ulint print_len =
ut_min(len, 1000);
491 if (len != print_len) {
492 fprintf(f,
"(total %lu bytes%s)",
497 fputs(
" SQL NULL", f);
515 fprintf(f,
"DATA TUPLE: %lu fields;\n", (ulong) n_fields);
517 for (i = 0; i < n_fields; i++) {
518 fprintf(f,
" %lu:", (ulong) i);
520 dfield_print_raw(f, dtuple_get_nth_field(tuple, i));
526 ut_ad(dtuple_validate(tuple));
553 ulint local_prefix_len;
572 if (UNIV_UNLIKELY(size > 1000000000)) {
574 "InnoDB: Warning: tuple size very big: %lu\n",
576 fputs(
"InnoDB: Tuple contents: ", stderr);
607 ulint longest_i = ULINT_MAX;
615 dfield = dtuple_get_nth_field(entry, i);
616 ifield = dict_index_get_nth_field(index, i);
633 if (longest >= savings) {
648 && ifield->
col->
len < 256) {
673 dfield = dtuple_get_nth_field(entry, longest_i);
674 ifield = dict_index_get_nth_field(index, longest_i);
677 b = &vector->
fields[n_fields];
680 b->
data = (
char*) dfield_get_data(dfield) + local_prefix_len;
686 memcpy(data, dfield_get_data(dfield), local_prefix_len);
688 memset(data + local_prefix_len, 0, BTR_EXTERN_FIELD_REF_SIZE);
694 UNIV_MEM_ALLOC(data + local_prefix_len,
695 BTR_EXTERN_FIELD_REF_SIZE);
726 for (; b < end; b++) {
730 dfield = dtuple_get_nth_field(entry, b->
field_no);
744 (
char*) b->
data - local_len,