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
72 if (len == UNIV_SQL_NULL) {
77 if (0 != memcmp(dfield_get_data(field), data, len)) {
99 ut_ad(tuple1 && tuple2);
100 ut_ad(tuple1->magic_n == DATA_TUPLE_MAGIC_N);
101 ut_ad(tuple2->magic_n == DATA_TUPLE_MAGIC_N);
112 for (i = 0; i < n_fields; i++) {
114 const dfield_t* field1 = dtuple_get_nth_field(tuple1, i);
115 const dfield_t* field2 = dtuple_get_nth_field(tuple2, i);
148 dfield_check_typed_no_assert(
152 if (dfield_get_type(field)->mtype > DATA_MYSQL
153 || dfield_get_type(field)->mtype < DATA_VARCHAR) {
156 "InnoDB: Error: data field type %lu, len %lu\n",
157 (ulong) dfield_get_type(field)->mtype,
179 "InnoDB: Error: index entry has %lu fields\n",
182 fputs(
"InnoDB: Tuple contents: ", stderr);
191 field = dtuple_get_nth_field(tuple, i);
193 if (!dfield_check_typed_no_assert(field)) {
212 if (dfield_get_type(field)->mtype > DATA_MYSQL
213 || dfield_get_type(field)->mtype < DATA_VARCHAR) {
216 "InnoDB: Error: data field type %lu, len %lu\n",
217 (ulong) dfield_get_type(field)->mtype,
240 field = dtuple_get_nth_field(tuple, i);
263 ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
270 for (i = 0; i < n_fields; i++) {
272 field = dtuple_get_nth_field(tuple, i);
277 const byte* data = dfield_get_data(field);
278 #ifndef UNIV_DEBUG_VALGRIND
281 for (j = 0; j < len; j++) {
290 UNIV_MEM_ASSERT_RW(data, len);
300 #ifndef UNIV_HOTBACKUP
312 const byte *data =
static_cast<const byte *
>(dfield_get_data(dfield));
315 fputs(
"NULL", stderr);
323 for (i = 0; i < len; i++) {
325 putc(isprint(c) ? c :
' ', stderr);
329 fputs(
"(external)", stderr);
354 ibool print_also_hex;
357 data =
static_cast<const byte *
>(dfield_get_data(dfield));
360 fputs(
"NULL", stderr);
369 static const ulint UNSIGNED_MASK= 0x80000000;
377 if (!(prtype & DATA_UNSIGNED)) {
379 fprintf(stderr,
"%ld", (
long) val);
381 fprintf(stderr,
"%lu", (ulong) val);
388 if (!(prtype & DATA_UNSIGNED)) {
390 fprintf(stderr,
"%ld", (
long) val);
392 fprintf(stderr,
"%lu", (ulong) val);
399 if (!(prtype & DATA_UNSIGNED)) {
401 fprintf(stderr,
"%ld", (
long) val);
403 fprintf(stderr,
"%lu", (ulong) val);
410 if (!(prtype & DATA_UNSIGNED)) {
411 val &= ~UNSIGNED_MASK;
412 fprintf(stderr,
"%ld", (
long) val);
414 fprintf(stderr,
"%lu", (ulong) val);
420 fprintf(stderr,
"%llu", (ullint)
id);
425 fprintf(stderr,
"%llu", (ullint)
id);
429 fprintf(stderr,
"%llu", (ullint)
id);
437 switch (prtype & DATA_SYS_PRTYPE_MASK) {
465 print_also_hex = FALSE;
467 for (i = 0; i < len; i++) {
471 print_also_hex = TRUE;
473 fprintf(stderr,
"\\x%02x", (
unsigned char) c);
480 fputs(
"(external)", stderr);
483 if (!print_also_hex) {
487 data =
static_cast<const byte *
>(dfield_get_data(dfield));
493 fputs(
" Hex: ",stderr);
495 for (i = 0; i < len; i++) {
496 fprintf(stderr,
"%02lx", (ulint) *data++);
500 fputs(
"(external)", stderr);
516 ulint print_len =
ut_min(len, 1000);
518 if (len != print_len) {
519 fprintf(f,
"(total %lu bytes%s)",
524 fputs(
" SQL NULL", f);
542 fprintf(f,
"DATA TUPLE: %lu fields;\n", (ulong) n_fields);
544 for (i = 0; i < n_fields; i++) {
545 fprintf(f,
" %lu:", (ulong) i);
547 dfield_print_raw(f, dtuple_get_nth_field(tuple, i));
553 ut_ad(dtuple_validate(tuple));
580 ulint local_prefix_len;
598 if (UNIV_UNLIKELY(size > 1000000000)) {
600 "InnoDB: Warning: tuple size very big: %lu\n",
602 fputs(
"InnoDB: Tuple contents: ", stderr);
629 ulint longest_i = ULINT_MAX;
637 dfield = dtuple_get_nth_field(entry, i);
638 ifield = dict_index_get_nth_field(index, i);
655 if (longest >= savings) {
670 && ifield->
col->
len < 256) {
685 && ifield->
col->
len < 256) {
700 && ifield->
col->
len < 256) {
725 dfield = dtuple_get_nth_field(entry, longest_i);
726 ifield = dict_index_get_nth_field(index, longest_i);
729 b = &vector->
fields[n_fields];
732 b->
data = (
char*) dfield_get_data(dfield) + local_prefix_len;
735 data =
static_cast<unsigned char *
>(
mem_heap_alloc(heap, local_len));
738 memcpy(data, dfield_get_data(dfield), local_prefix_len);
740 memset(data + local_prefix_len, 0, BTR_EXTERN_FIELD_REF_SIZE);
746 UNIV_MEM_ALLOC(data + local_prefix_len,
747 BTR_EXTERN_FIELD_REF_SIZE);
778 for (; b < end; b++) {
782 dfield = dtuple_get_nth_field(entry, b->
field_no);
793 (
char*) b->
data - local_len,
UNIV_INTERN void dtuple_convert_back_big_rec(dict_index_t *index, dtuple_t *entry, big_rec_t *vector)
UNIV_INLINE ulint dict_index_get_n_fields(const dict_index_t *index)
UNIV_INLINE ulint dfield_is_ext(const dfield_t *field)
UNIV_INTERN int dtuple_coll_cmp(const dtuple_t *tuple1, const dtuple_t *tuple2)
UNIV_INTERN void ut_print_buf(FILE *file, const void *buf, ulint len)
UNIV_INLINE ibool dict_table_is_comp(const dict_table_t *table)
UNIV_INLINE ulint dtype_get_mtype(const dtype_t *type)
UNIV_INLINE ulint mach_read_from_3(const byte *b) __attribute__((nonnull
#define DICT_TF_FORMAT_ZIP
#define mem_heap_free(heap)
UNIV_INLINE ibool page_zip_rec_needs_ext(ulint rec_size, ulint comp, ulint n_fields, ulint zip_size) __attribute__((const ))
UNIV_INTERN ibool dfield_data_is_binary_equal(const dfield_t *field, ulint len, const byte *data)
UNIV_INTERN void dtuple_print(FILE *f, const dtuple_t *tuple)
UNIV_INLINE ulint dtuple_get_n_fields(const dtuple_t *tuple)
#define DICT_MAX_INDEX_COL_LEN
DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum indexed column length (or indexed pref...
UNIV_INTERN big_rec_t * dtuple_convert_big_rec(dict_index_t *index, dtuple_t *entry, ulint *n_ext)
UNIV_INLINE ulint ut_min(ulint n1, ulint n2)
UNIV_INLINE ulint dict_index_get_n_unique_in_tree(const dict_index_t *index)
UNIV_INLINE void dfield_set_data(dfield_t *field, const void *data, ulint len)
UNIV_INLINE ulint dict_table_zip_size(const dict_table_t *table)
UNIV_INLINE ulint dfield_get_len(const dfield_t *field)
UNIV_INLINE ulint dict_table_get_format(const dict_table_t *table)
UNIV_INTERN void dtuple_set_n_fields(dtuple_t *tuple, ulint n_fields)
UNIV_INTERN void dfield_print(const dfield_t *dfield)
UNIV_INLINE ulint dict_index_is_clust(const dict_index_t *index) __attribute__((pure))
UNIV_INTERN ibool dtuple_check_typed(const dtuple_t *tuple)
UNIV_INLINE ib_uint64_t mach_read_from_6(const byte *b) __attribute__((nonnull
UNIV_INLINE void * mem_heap_alloc(mem_heap_t *heap, ulint n)
#define mem_heap_create(N)
UNIV_INLINE ib_uint64_t mach_read_from_7(const byte *b) __attribute__((nonnull
UNIV_INLINE ulint dfield_is_null(const dfield_t *field)
UNIV_INLINE int cmp_dfield_dfield(const dfield_t *dfield1, const dfield_t *dfield2)
UNIV_INLINE ulint rec_get_converted_size(dict_index_t *index, const dtuple_t *dtuple, ulint n_ext)
#define BTR_EXTERN_FIELD_REF_SIZE
UNIV_INTERN ibool dtuple_check_typed_no_assert(const dtuple_t *tuple)
UNIV_INLINE ulint mach_read_from_4(const byte *b) __attribute__((nonnull
UNIV_INLINE ulint mach_read_from_1(const byte *b) __attribute__((nonnull
UNIV_INLINE ulint mach_read_from_2(const byte *b) __attribute__((nonnull
UNIV_INTERN void dfield_print_also_hex(const dfield_t *dfield)
UNIV_INTERN ibool dfield_check_typed(const dfield_t *field)
UNIV_INLINE void dfield_set_ext(dfield_t *field)
UNIV_INLINE ib_uint64_t mach_read_from_8(const byte *b) __attribute__((nonnull
UNIV_INLINE ib_uint64_t mach_ull_read_compressed(const byte *b) __attribute__((nonnull
UNIV_INLINE ulint dtype_get_prtype(const dtype_t *type)