1
1
/*****************************************************************************
3
Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
307
307
const dfield_t* dfield) /*!< in: dfield */
311
ulint len = dfield_get_len(dfield);
312
const byte *data = static_cast<const byte *>(dfield_get_data(dfield));
313
len = dfield_get_len(dfield);
314
data = dfield_get_data(dfield);
314
316
if (dfield_is_null(dfield)) {
315
317
fputs("NULL", stderr);
408
408
val = mach_read_from_4(data);
410
410
if (!(prtype & DATA_UNSIGNED)) {
411
val &= ~UNSIGNED_MASK;
412
412
fprintf(stderr, "%ld", (long) val);
414
414
fprintf(stderr, "%lu", (ulong) val);
419
419
id = mach_read_from_6(data);
420
fprintf(stderr, "%llu", (ullint) id);
420
fprintf(stderr, "{%lu %lu}",
421
ut_dulint_get_high(id),
422
ut_dulint_get_low(id));
424
426
id = mach_read_from_7(data);
425
fprintf(stderr, "%llu", (ullint) id);
427
fprintf(stderr, "{%lu %lu}",
428
ut_dulint_get_high(id),
429
ut_dulint_get_low(id));
428
432
id = mach_read_from_8(data);
429
fprintf(stderr, "%llu", (ullint) id);
433
fprintf(stderr, "{%lu %lu}",
434
ut_dulint_get_high(id),
435
ut_dulint_get_low(id));
438
444
case DATA_TRX_ID:
439
445
id = mach_read_from_6(data);
441
fprintf(stderr, "trx_id " TRX_ID_FMT, id);
447
fprintf(stderr, "trx_id " TRX_ID_FMT,
448
TRX_ID_PREP_PRINTF(id));
444
451
case DATA_ROLL_PTR:
445
452
id = mach_read_from_7(data);
447
fprintf(stderr, "roll_ptr " TRX_ID_FMT, id);
454
fprintf(stderr, "roll_ptr {%lu %lu}",
455
ut_dulint_get_high(id), ut_dulint_get_low(id));
450
458
case DATA_ROW_ID:
451
459
id = mach_read_from_6(data);
453
fprintf(stderr, "row_id " TRX_ID_FMT, id);
461
fprintf(stderr, "row_id {%lu %lu}",
462
ut_dulint_get_high(id), ut_dulint_get_low(id));
457
id = mach_ull_read_compressed(data);
466
id = mach_dulint_read_compressed(data);
459
fprintf(stderr, "mix_id " TRX_ID_FMT, id);
468
fprintf(stderr, "mix_id {%lu %lu}",
469
ut_dulint_get_high(id), ut_dulint_get_low(id));
607
617
heap = mem_heap_create(size + dtuple_get_n_fields(entry)
608
618
* sizeof(big_rec_field_t) + 1000);
610
vector = static_cast<big_rec_t *>(mem_heap_alloc(heap, sizeof(big_rec_t)));
620
vector = mem_heap_alloc(heap, sizeof(big_rec_t));
612
622
vector->heap = heap;
613
vector->fields = static_cast<big_rec_field_t *>(mem_heap_alloc(heap, dtuple_get_n_fields(entry)
614
* sizeof(big_rec_field_t)));
623
vector->fields = mem_heap_alloc(heap, dtuple_get_n_fields(entry)
624
* sizeof(big_rec_field_t));
616
626
/* Decide which fields to shorten: the algorithm is to look for
617
627
a variable-length field that yields the biggest savings when
659
/* In DYNAMIC and COMPRESSED format, store
660
locally any non-BLOB columns whose maximum
661
length does not exceed 256 bytes. This is
662
because there is no room for the "external
663
storage" flag when the maximum length is 255
664
bytes or less. This restriction trivially
665
holds in REDUNDANT and COMPACT format, because
666
there we always store locally columns whose
667
length is up to local_len == 788 bytes.
668
@see rec_init_offsets_comp_ordinary */
669
if (ifield->col->mtype != DATA_BLOB
670
&& ifield->col->len < 256) {
674
/* In DYNAMIC and COMPRESSED format, store
675
locally any non-BLOB columns whose maximum
676
length does not exceed 256 bytes. This is
677
because there is no room for the "external
678
storage" flag when the maximum length is 255
679
bytes or less. This restriction trivially
680
holds in REDUNDANT and COMPACT format, because
681
there we always store locally columns whose
682
length is up to local_len == 788 bytes.
683
@see rec_init_offsets_comp_ordinary */
684
if (ifield->col->mtype != DATA_BLOB
685
&& ifield->col->len < 256) {
689
/* In DYNAMIC and COMPRESSED format, store
690
locally any non-BLOB columns whose maximum
691
length does not exceed 256 bytes. This is
692
because there is no room for the "external
693
storage" flag when the maximum length is 255
694
bytes or less. This restriction trivially
695
holds in REDUNDANT and COMPACT format, because
696
there we always store locally columns whose
697
length is up to local_len == 788 bytes.
698
@see rec_init_offsets_comp_ordinary */
699
if (ifield->col->mtype != DATA_BLOB
700
&& ifield->col->len < 256) {
705
670
longest = savings;
732
697
b->data = (char*) dfield_get_data(dfield) + local_prefix_len;
734
699
/* Allocate the locally stored part of the column. */
735
data = static_cast<unsigned char *>(mem_heap_alloc(heap, local_len));
700
data = mem_heap_alloc(heap, local_len);
737
702
/* Copy the local prefix. */
738
703
memcpy(data, dfield_get_data(dfield), local_prefix_len);
768
733
dtuple_convert_back_big_rec(
769
734
/*========================*/
770
dict_index_t* /*index __attribute__((unused))*/, /*!< in: index */
735
dict_index_t* index __attribute__((unused)), /*!< in: index */
771
736
dtuple_t* entry, /*!< in: entry whose data was put to vector */
772
737
big_rec_t* vector) /*!< in, own: big rec vector; it is
773
738
freed in this function */