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
static const ulint UNSIGNED_MASK= 0x80000000;
410
412
if (!(prtype & DATA_UNSIGNED)) {
411
413
val &= ~UNSIGNED_MASK;
412
414
fprintf(stderr, "%ld", (long) val);
419
421
id = mach_read_from_6(data);
420
fprintf(stderr, "%llu", (ullint) id);
422
fprintf(stderr, "{%lu %lu}",
423
ut_dulint_get_high(id),
424
ut_dulint_get_low(id));
424
428
id = mach_read_from_7(data);
425
fprintf(stderr, "%llu", (ullint) id);
429
fprintf(stderr, "{%lu %lu}",
430
ut_dulint_get_high(id),
431
ut_dulint_get_low(id));
428
434
id = mach_read_from_8(data);
429
fprintf(stderr, "%llu", (ullint) id);
435
fprintf(stderr, "{%lu %lu}",
436
ut_dulint_get_high(id),
437
ut_dulint_get_low(id));
438
446
case DATA_TRX_ID:
439
447
id = mach_read_from_6(data);
441
fprintf(stderr, "trx_id " TRX_ID_FMT, id);
449
fprintf(stderr, "trx_id " TRX_ID_FMT,
450
TRX_ID_PREP_PRINTF(id));
444
453
case DATA_ROLL_PTR:
445
454
id = mach_read_from_7(data);
447
fprintf(stderr, "roll_ptr " TRX_ID_FMT, id);
456
fprintf(stderr, "roll_ptr {%lu %lu}",
457
ut_dulint_get_high(id), ut_dulint_get_low(id));
450
460
case DATA_ROW_ID:
451
461
id = mach_read_from_6(data);
453
fprintf(stderr, "row_id " TRX_ID_FMT, id);
463
fprintf(stderr, "row_id {%lu %lu}",
464
ut_dulint_get_high(id), ut_dulint_get_low(id));
457
id = mach_ull_read_compressed(data);
468
id = mach_dulint_read_compressed(data);
459
fprintf(stderr, "mix_id " TRX_ID_FMT, id);
470
fprintf(stderr, "mix_id {%lu %lu}",
471
ut_dulint_get_high(id), ut_dulint_get_low(id));
607
619
heap = mem_heap_create(size + dtuple_get_n_fields(entry)
608
620
* sizeof(big_rec_field_t) + 1000);
610
vector = static_cast<big_rec_t *>(mem_heap_alloc(heap, sizeof(big_rec_t)));
622
vector = mem_heap_alloc(heap, sizeof(big_rec_t));
612
624
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)));
625
vector->fields = mem_heap_alloc(heap, dtuple_get_n_fields(entry)
626
* sizeof(big_rec_field_t));
616
628
/* Decide which fields to shorten: the algorithm is to look for
617
629
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
672
longest = savings;
732
699
b->data = (char*) dfield_get_data(dfield) + local_prefix_len;
734
701
/* Allocate the locally stored part of the column. */
735
data = static_cast<unsigned char *>(mem_heap_alloc(heap, local_len));
702
data = mem_heap_alloc(heap, local_len);
737
704
/* Copy the local prefix. */
738
705
memcpy(data, dfield_get_data(dfield), local_prefix_len);
768
735
dtuple_convert_back_big_rec(
769
736
/*========================*/
770
dict_index_t* /*index __attribute__((unused))*/, /*!< in: index */
737
dict_index_t* index __attribute__((unused)), /*!< in: index */
771
738
dtuple_t* entry, /*!< in: entry whose data was put to vector */
772
739
big_rec_t* vector) /*!< in, own: big rec vector; it is
773
740
freed in this function */