84
84
#define REC_NEW_STATUS_SHIFT 0
86
86
#define REC_OLD_HEAP_NO 5
87
#define REC_HEAP_NO_MASK 0xFFF8UL
88
#if 0 /* defined in rem0rec.h for use of page0zip.c */
87
89
#define REC_NEW_HEAP_NO 4
88
#define REC_HEAP_NO_MASK 0xFFF8UL
89
90
#define REC_HEAP_NO_SHIFT 3
91
93
#define REC_OLD_N_OWNED 6 /* This is single byte bit-field */
92
94
#define REC_NEW_N_OWNED 5 /* This is single byte bit-field */
140
139
/***************************************************************
141
140
Sets an old-style record field to SQL null.
142
141
The physical size of the field is not changed. */
145
144
rec_set_nth_field_sql_null(
146
145
/*=======================*/
147
146
rec_t* rec, /* in: record */
148
147
ulint n); /* in: index of the field */
150
/***************************************************************
151
Sets the value of the ith field extern storage bit of an old-style record. */
154
rec_set_nth_field_extern_bit_old(
155
/*=============================*/
156
rec_t* rec, /* in: old-style record */
157
ulint i, /* in: ith field */
158
ibool val, /* in: value to set */
159
mtr_t* mtr); /* in: mtr holding an X-latch to the page where
160
rec is, or NULL; in the NULL case we do not
161
write to log about the change */
162
/***************************************************************
163
Sets the value of the ith field extern storage bit of a new-style record. */
166
rec_set_nth_field_extern_bit_new(
167
/*=============================*/
168
rec_t* rec, /* in: record */
169
dict_index_t* index, /* in: record descriptor */
170
ulint ith, /* in: ith field */
171
ibool val, /* in: value to set */
172
mtr_t* mtr); /* in: mtr holding an X-latch to the page
173
where rec is, or NULL; in the NULL case
174
we do not write to log about the change */
176
149
/**********************************************************
177
150
Gets a bit field from within 1 byte. */
180
153
rec_get_bit_field_1(
181
154
/*================*/
182
rec_t* rec, /* in: pointer to record origin */
183
ulint offs, /* in: offset from the origin down */
184
ulint mask, /* in: mask used to filter bits */
185
ulint shift) /* in: shift right applied after masking */
155
const rec_t* rec, /* in: pointer to record origin */
156
ulint offs, /* in: offset from the origin down */
157
ulint mask, /* in: mask used to filter bits */
158
ulint shift) /* in: shift right applied after masking */
220
193
rec_get_bit_field_2(
221
194
/*================*/
222
rec_t* rec, /* in: pointer to record origin */
223
ulint offs, /* in: offset from the origin down */
224
ulint mask, /* in: mask used to filter bits */
225
ulint shift) /* in: shift right applied after masking */
195
const rec_t* rec, /* in: pointer to record origin */
196
ulint offs, /* in: offset from the origin down */
197
ulint mask, /* in: mask used to filter bits */
198
ulint shift) /* in: shift right applied after masking */
258
231
/**********************************************************
232
The following function is used to get the pointer of the next chained record
236
rec_get_next_ptr_const(
237
/*===================*/
238
/* out: pointer to the next chained record, or
240
const rec_t* rec, /* in: physical record */
241
ulint comp) /* in: nonzero=compact page format */
245
ut_ad(REC_NEXT_MASK == 0xFFFFUL);
246
ut_ad(REC_NEXT_SHIFT == 0);
248
field_value = mach_read_from_2(rec - REC_NEXT);
250
if (UNIV_UNLIKELY(field_value == 0)) {
255
if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) {
256
#if UNIV_PAGE_SIZE <= 32768
257
/* Note that for 64 KiB pages, field_value can 'wrap around'
258
and the debug assertion is not valid */
260
/* In the following assertion, field_value is interpreted
261
as signed 16-bit integer in 2's complement arithmetics.
262
If all platforms defined int16_t in the standard headers,
263
the expression could be written simpler as
264
(int16_t) field_value + ut_align_offset(...) < UNIV_PAGE_SIZE
266
ut_ad((field_value >= 32768
267
? field_value - 65536
269
+ ut_align_offset(rec, UNIV_PAGE_SIZE)
272
/* There must be at least REC_N_NEW_EXTRA_BYTES + 1
273
between each record. */
274
ut_ad((field_value > REC_N_NEW_EXTRA_BYTES
275
&& field_value < 32768)
276
|| field_value < (uint16) -REC_N_NEW_EXTRA_BYTES);
278
return((byte*) ut_align_down(rec, UNIV_PAGE_SIZE)
279
+ ut_align_offset(rec + field_value, UNIV_PAGE_SIZE));
281
ut_ad(field_value < UNIV_PAGE_SIZE);
283
return((byte*) ut_align_down(rec, UNIV_PAGE_SIZE)
288
/**********************************************************
289
The following function is used to get the pointer of the next chained record
295
/* out: pointer to the next chained record, or
297
rec_t* rec, /* in: physical record */
298
ulint comp) /* in: nonzero=compact page format */
300
return((rec_t*) rec_get_next_ptr_const(rec, comp));
303
/**********************************************************
259
304
The following function is used to get the offset of the next chained record
260
305
on the same page. */
263
308
rec_get_next_offs(
264
309
/*==============*/
265
/* out: the page offset of the next chained record, or
267
rec_t* rec, /* in: physical record */
268
ulint comp) /* in: nonzero=compact page format */
310
/* out: the page offset of the next
311
chained record, or 0 if none */
312
const rec_t* rec, /* in: physical record */
313
ulint comp) /* in: nonzero=compact page format */
270
315
ulint field_value;
271
316
#if REC_NEXT_MASK != 0xFFFFUL
310
361
/**********************************************************
311
The following function is used to set the next record offset field of the
362
The following function is used to set the next record offset field
363
of an old-style record. */
317
rec_t* rec, /* in: physical record */
318
ulint comp, /* in: nonzero=compact page format */
319
ulint next) /* in: offset of the next record, or 0 if none */
366
rec_set_next_offs_old(
367
/*==================*/
368
rec_t* rec, /* in: old-style physical record */
369
ulint next) /* in: offset of the next record */
322
372
ut_ad(UNIV_PAGE_SIZE > next);
327
377
# error "REC_NEXT_SHIFT != 0"
334
/* The following two statements calculate
335
next - offset_of_rec mod 64Ki, where mod is the modulo
336
as a non-negative number */
338
field_value = (ulint)((lint)next
339
- (lint)ut_align_offset(
340
rec, UNIV_PAGE_SIZE));
341
field_value &= REC_NEXT_MASK;
346
mach_write_to_2(rec - REC_NEXT, field_value);
380
mach_write_to_2(rec - REC_NEXT, next);
383
/**********************************************************
384
The following function is used to set the next record offset field
385
of a new-style record. */
388
rec_set_next_offs_new(
389
/*==================*/
390
rec_t* rec, /* in/out: new-style physical record */
391
ulint next) /* in: offset of the next record */
396
ut_ad(UNIV_PAGE_SIZE > next);
398
if (UNIV_UNLIKELY(!next)) {
348
mach_write_to_2(rec - REC_NEXT, next);
401
/* The following two statements calculate
402
next - offset_of_rec mod 64Ki, where mod is the modulo
403
as a non-negative number */
405
field_value = (ulint)
407
- (lint) ut_align_offset(rec, UNIV_PAGE_SIZE));
408
field_value &= REC_NEXT_MASK;
411
mach_write_to_2(rec - REC_NEXT, field_value);
352
414
/**********************************************************
447
509
previous directory record. */
452
/* out: number of owned records */
453
rec_t* rec, /* in: physical record */
454
ulint comp) /* in: nonzero=compact page format */
514
/* out: number of owned records */
515
const rec_t* rec) /* in: old-style physical record */
460
ret = rec_get_bit_field_1(rec,
461
comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
462
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
463
ut_ad(ret <= REC_MAX_N_OWNED);
517
return(rec_get_bit_field_1(rec, REC_OLD_N_OWNED,
518
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT));
468
521
/**********************************************************
469
522
The following function is used to set the number of owned records. */
474
rec_t* rec, /* in: physical record */
475
ulint comp, /* in: nonzero=compact page format */
527
/* out: TRUE on success */
528
rec_t* rec, /* in: old-style physical record */
476
529
ulint n_owned) /* in: the number of owned */
479
ut_ad(n_owned <= REC_MAX_N_OWNED);
481
rec_set_bit_field_1(rec, n_owned,
482
comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
483
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
531
rec_set_bit_field_1(rec, n_owned, REC_OLD_N_OWNED,
532
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
535
/**********************************************************
536
The following function is used to get the number of records owned by the
537
previous directory record. */
542
/* out: number of owned records */
543
const rec_t* rec) /* in: new-style physical record */
545
return(rec_get_bit_field_1(rec, REC_NEW_N_OWNED,
546
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT));
549
/**********************************************************
550
The following function is used to set the number of owned records. */
555
rec_t* rec, /* in/out: new-style physical record */
556
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
557
ulint n_owned)/* in: the number of owned */
559
rec_set_bit_field_1(rec, n_owned, REC_NEW_N_OWNED,
560
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
561
if (UNIV_LIKELY_NULL(page_zip)
562
&& UNIV_LIKELY(rec_get_status(rec)
563
!= REC_STATUS_SUPREMUM)) {
564
page_zip_rec_set_owned(page_zip, rec, n_owned);
486
568
/**********************************************************
490
572
rec_get_info_bits(
491
573
/*==============*/
493
rec_t* rec, /* in: physical record */
494
ulint comp) /* in: nonzero=compact page format */
500
ret = rec_get_bit_field_1(rec,
501
comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
502
REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
503
ut_ad((ret & ~REC_INFO_BITS_MASK) == 0);
508
/**********************************************************
509
The following function is used to set the info bits of a record. */
514
rec_t* rec, /* in: physical record */
515
ulint comp, /* in: nonzero=compact page format */
516
ulint bits) /* in: info bits */
519
ut_ad((bits & ~REC_INFO_BITS_MASK) == 0);
521
rec_set_bit_field_1(rec, bits,
522
comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
575
const rec_t* rec, /* in: physical record */
576
ulint comp) /* in: nonzero=compact page format */
578
return(rec_get_bit_field_1(
579
rec, comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
580
REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT));
583
/**********************************************************
584
The following function is used to set the info bits of a record. */
587
rec_set_info_bits_old(
588
/*==================*/
589
rec_t* rec, /* in: old-style physical record */
590
ulint bits) /* in: info bits */
592
rec_set_bit_field_1(rec, bits, REC_OLD_INFO_BITS,
593
REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
595
/**********************************************************
596
The following function is used to set the info bits of a record. */
599
rec_set_info_bits_new(
600
/*==================*/
601
rec_t* rec, /* in/out: new-style physical record */
602
ulint bits) /* in: info bits */
604
rec_set_bit_field_1(rec, bits, REC_NEW_INFO_BITS,
523
605
REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
571
650
rec_set_info_and_status_bits(
572
651
/*=========================*/
573
rec_t* rec, /* in: physical record */
574
ulint comp, /* in: nonzero=compact page format */
652
rec_t* rec, /* in/out: physical record */
575
653
ulint bits) /* in: info bits */
577
655
#if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \
578
656
& (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)
579
657
# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap"
582
rec_set_status(rec, bits & REC_NEW_STATUS_MASK);
584
ut_ad(!(bits & ~(REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)));
586
rec_set_info_bits(rec, comp, bits & ~REC_NEW_STATUS_MASK);
659
rec_set_status(rec, bits & REC_NEW_STATUS_MASK);
660
rec_set_info_bits_new(rec, bits & ~REC_NEW_STATUS_MASK);
589
663
/**********************************************************
613
687
The following function is used to set the deleted bit. */
616
rec_set_deleted_flag(
617
/*=================*/
618
rec_t* rec, /* in: physical record */
619
ulint comp, /* in: nonzero=compact page format */
690
rec_set_deleted_flag_old(
691
/*=====================*/
692
rec_t* rec, /* in: old-style physical record */
620
693
ulint flag) /* in: nonzero if delete marked */
624
val = rec_get_info_bits(rec, comp);
627
val |= REC_INFO_DELETED_FLAG;
629
val &= ~REC_INFO_DELETED_FLAG;
632
rec_set_info_bits(rec, comp, val);
697
val = rec_get_info_bits(rec, FALSE);
700
val |= REC_INFO_DELETED_FLAG;
702
val &= ~REC_INFO_DELETED_FLAG;
705
rec_set_info_bits_old(rec, val);
708
/**********************************************************
709
The following function is used to set the deleted bit. */
712
rec_set_deleted_flag_new(
713
/*=====================*/
714
rec_t* rec, /* in/out: new-style physical record */
715
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
716
ulint flag) /* in: nonzero if delete marked */
720
val = rec_get_info_bits(rec, TRUE);
723
val |= REC_INFO_DELETED_FLAG;
725
val &= ~REC_INFO_DELETED_FLAG;
728
rec_set_info_bits_new(rec, val);
730
if (UNIV_LIKELY_NULL(page_zip)) {
731
page_zip_rec_set_deleted(page_zip, rec, flag);
635
735
/**********************************************************
639
739
rec_get_node_ptr_flag(
640
740
/*==================*/
641
/* out: TRUE if node pointer */
642
rec_t* rec) /* in: physical record */
741
/* out: TRUE if node pointer */
742
const rec_t* rec) /* in: physical record */
644
744
return(REC_STATUS_NODE_PTR == rec_get_status(rec));
647
747
/**********************************************************
648
The following function is used to get the order number of the record in the
649
heap of the index page. */
654
/* out: heap order number */
655
rec_t* rec, /* in: physical record */
656
ulint comp) /* in: nonzero=compact page format */
662
ret = rec_get_bit_field_2(rec,
663
comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
664
REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
665
ut_ad(ret <= REC_MAX_HEAP_NO);
670
/**********************************************************
671
The following function is used to set the heap number field in the record. */
676
rec_t* rec, /* in: physical record */
677
ulint comp, /* in: nonzero=compact page format */
678
ulint heap_no)/* in: the heap number */
680
ut_ad(heap_no <= REC_MAX_HEAP_NO);
682
rec_set_bit_field_2(rec, heap_no,
683
comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
748
The following function is used to get the order number
749
of an old-style record in the heap of the index page. */
754
/* out: heap order number */
755
const rec_t* rec) /* in: physical record */
757
return(rec_get_bit_field_2(rec, REC_OLD_HEAP_NO,
758
REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT));
761
/**********************************************************
762
The following function is used to set the heap number
763
field in an old-style record. */
768
rec_t* rec, /* in: physical record */
769
ulint heap_no)/* in: the heap number */
771
rec_set_bit_field_2(rec, heap_no, REC_OLD_HEAP_NO,
772
REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
775
/**********************************************************
776
The following function is used to get the order number
777
of a new-style record in the heap of the index page. */
782
/* out: heap order number */
783
const rec_t* rec) /* in: physical record */
785
return(rec_get_bit_field_2(rec, REC_NEW_HEAP_NO,
786
REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT));
789
/**********************************************************
790
The following function is used to set the heap number
791
field in a new-style record. */
796
rec_t* rec, /* in/out: physical record */
797
ulint heap_no)/* in: the heap number */
799
rec_set_bit_field_2(rec, heap_no, REC_NEW_HEAP_NO,
684
800
REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
729
845
rec_1_get_field_end_info(
730
846
/*=====================*/
731
/* out: offset of the start of the field, SQL null
733
rec_t* rec, /* in: record */
734
ulint n) /* in: field index */
847
/* out: offset of the start of the
848
field, SQL null flag ORed */
849
const rec_t* rec, /* in: record */
850
ulint n) /* in: field index */
736
852
ut_ad(rec_get_1byte_offs_flag(rec));
737
853
ut_ad(n < rec_get_n_fields_old(rec));
748
864
rec_2_get_field_end_info(
749
865
/*=====================*/
750
/* out: offset of the start of the field, SQL null
751
flag and extern storage flag ORed */
752
rec_t* rec, /* in: record */
753
ulint n) /* in: field index */
866
/* out: offset of the start of the
867
field, SQL null flag and extern
869
const rec_t* rec, /* in: record */
870
ulint n) /* in: field index */
755
872
ut_ad(!rec_get_1byte_offs_flag(rec));
756
873
ut_ad(n < rec_get_n_fields_old(rec));
831
941
rec_offs_validate(
832
942
/*==============*/
833
/* out: TRUE if valid */
834
rec_t* rec, /* in: record or NULL */
835
dict_index_t* index, /* in: record descriptor or NULL */
836
const ulint* offsets)/* in: array returned by rec_get_offsets() */
943
/* out: TRUE if valid */
944
const rec_t* rec, /* in: record or NULL */
945
const dict_index_t* index, /* in: record descriptor or NULL */
946
const ulint* offsets)/* in: array returned by
838
949
ulint i = rec_offs_n_fields(offsets);
839
950
ulint last = ULINT_MAX;
886
998
rec_offs_make_valid(
887
999
/*================*/
888
rec_t* rec __attribute__((unused)),
890
dict_index_t* index __attribute__((unused)),
891
/* in: record descriptor */
892
const ulint* offsets __attribute__((unused)))
893
/* in: array returned by rec_get_offsets() */
1000
const rec_t* rec, /* in: record */
1001
const dict_index_t* index, /* in: record descriptor */
1002
ulint* offsets)/* in: array returned by
1003
rec_get_offsets() */
896
1008
ut_ad(rec_get_n_fields(rec, index) >= rec_offs_n_fields(offsets));
897
1009
offsets[2] = (ulint) rec;
898
1010
offsets[3] = (ulint) index;
899
1012
#endif /* UNIV_DEBUG */
902
1014
/****************************************************************
903
The following function is used to get a pointer to the nth
1015
The following function is used to get an offset to the nth
904
1016
data field in a record. */
909
/* out: pointer to the field */
910
rec_t* rec, /* in: record */
1019
rec_get_nth_field_offs(
1020
/*===================*/
1021
/* out: offset from the origin of rec */
911
1022
const ulint* offsets,/* in: array returned by rec_get_offsets() */
912
1023
ulint n, /* in: index of the field */
913
1024
ulint* len) /* out: length of the field; UNIV_SQL_NULL
919
ut_ad(rec_offs_validate(rec, NULL, offsets));
920
1029
ut_ad(n < rec_offs_n_fields(offsets));
923
1032
if (UNIV_UNLIKELY(n == 0)) {
926
field = rec + (rec_offs_base(offsets)[n] & REC_OFFS_MASK);
1035
offs = rec_offs_base(offsets)[n] & REC_OFFS_MASK;
929
1038
length = rec_offs_base(offsets)[1 + n];
956
1065
/**********************************************************
1066
Determine if the offsets are for a record containing
1067
externally stored columns. */
1070
rec_offs_any_extern(
1071
/*================*/
1072
/* out: nonzero if externally stored */
1073
const ulint* offsets)/* in: array returned by rec_get_offsets() */
1075
ut_ad(rec_offs_validate(NULL, NULL, offsets));
1076
return(UNIV_UNLIKELY(*rec_offs_base(offsets) & REC_OFFS_EXTERNAL));
1079
/**********************************************************
957
1080
Returns nonzero if the extern bit is set in nth field of rec. */
1007
1130
/**********************************************************
1008
Returns TRUE if the extern bit is set in any of the fields
1009
of an old-style record. */
1131
Returns the number of extern bits set in a record. */
1012
rec_offs_any_extern(
1013
/*================*/
1014
/* out: TRUE if a field is stored externally */
1136
/* out: number of externally stored fields */
1015
1137
const ulint* offsets)/* in: array returned by rec_get_offsets() */
1018
for (i = rec_offs_n_fields(offsets); i--; ) {
1019
if (rec_offs_nth_extern(offsets, i)) {
1141
if (rec_offs_any_extern(offsets)) {
1144
for (i = rec_offs_n_fields(offsets); i--; ) {
1145
if (rec_offs_nth_extern(offsets, i)) {
1026
/***************************************************************
1027
Sets the value of the ith field extern storage bit. */
1030
rec_set_nth_field_extern_bit(
1031
/*=========================*/
1032
rec_t* rec, /* in: record */
1033
dict_index_t* index, /* in: record descriptor */
1034
ulint i, /* in: ith field */
1035
ibool val, /* in: value to set */
1036
mtr_t* mtr) /* in: mtr holding an X-latch to the page
1037
where rec is, or NULL; in the NULL case
1038
we do not write to log about the change */
1040
if (dict_table_is_comp(index->table)) {
1041
rec_set_nth_field_extern_bit_new(rec, index, i, val, mtr);
1043
rec_set_nth_field_extern_bit_old(rec, i, val, mtr);
1047
1154
/**********************************************************
1055
1162
rec_1_get_prev_field_end_info(
1056
1163
/*==========================*/
1057
/* out: offset of the start of the PREVIOUS field, SQL
1059
rec_t* rec, /* in: record */
1060
ulint n) /* in: field index */
1164
/* out: offset of the start of the
1165
PREVIOUS field, SQL null flag ORed */
1166
const rec_t* rec, /* in: record */
1167
ulint n) /* in: field index */
1062
1169
ut_ad(rec_get_1byte_offs_flag(rec));
1063
1170
ut_ad(n <= rec_get_n_fields_old(rec));
1074
1181
rec_2_get_prev_field_end_info(
1075
1182
/*==========================*/
1076
/* out: offset of the start of the PREVIOUS field, SQL
1078
rec_t* rec, /* in: record */
1079
ulint n) /* in: field index */
1183
/* out: offset of the start of the
1184
PREVIOUS field, SQL null flag ORed */
1185
const rec_t* rec, /* in: record */
1186
ulint n) /* in: field index */
1081
1188
ut_ad(!rec_get_1byte_offs_flag(rec));
1082
1189
ut_ad(n <= rec_get_n_fields_old(rec));
1126
1233
rec_1_get_field_start_offs(
1127
1234
/*=======================*/
1128
/* out: offset of the start of the field */
1129
rec_t* rec, /* in: record */
1130
ulint n) /* in: field index */
1235
/* out: offset of the start of the field */
1236
const rec_t* rec, /* in: record */
1237
ulint n) /* in: field index */
1132
1239
ut_ad(rec_get_1byte_offs_flag(rec));
1133
1240
ut_ad(n <= rec_get_n_fields_old(rec));
1149
1256
rec_2_get_field_start_offs(
1150
1257
/*=======================*/
1151
/* out: offset of the start of the field */
1152
rec_t* rec, /* in: record */
1153
ulint n) /* in: field index */
1258
/* out: offset of the start of the field */
1259
const rec_t* rec, /* in: record */
1260
ulint n) /* in: field index */
1155
1262
ut_ad(!rec_get_1byte_offs_flag(rec));
1156
1263
ut_ad(n <= rec_get_n_fields_old(rec));
1174
1281
rec_get_field_start_offs(
1175
1282
/*=====================*/
1176
/* out: offset of the start of the field */
1177
rec_t* rec, /* in: record */
1178
ulint n) /* in: field index */
1283
/* out: offset of the start of the field */
1284
const rec_t* rec, /* in: record */
1285
ulint n) /* in: field index */
1181
1288
ut_ad(n <= rec_get_n_fields_old(rec));
1408
1517
/*=========================*/
1409
1518
/* out: extra size */
1410
1519
ulint data_size, /* in: data size */
1411
ulint n_fields) /* in: number of fields */
1520
ulint n_fields, /* in: number of fields */
1521
ulint n_ext) /* in: number of externally stored columns */
1413
if (data_size <= REC_1BYTE_OFFS_LIMIT) {
1523
if (!n_ext && data_size <= REC_1BYTE_OFFS_LIMIT) {
1415
1525
return(REC_N_OLD_EXTRA_BYTES + n_fields);
1421
1531
/**************************************************************
1422
1532
The following function returns the size of a data tuple when converted to
1423
a new-style physical record. */
1426
rec_get_converted_size_new(
1427
/*=======================*/
1429
dict_index_t* index, /* in: record descriptor */
1430
dtuple_t* dtuple);/* in: data tuple */
1431
/**************************************************************
1432
The following function returns the size of a data tuple when converted to
1433
1533
a physical record. */
1454
1555
: dict_index_get_n_fields(index)));
1456
1557
if (dict_table_is_comp(index->table)) {
1457
return(rec_get_converted_size_new(index, dtuple));
1558
return(rec_get_converted_size_comp(index,
1559
dtuple_get_info_bits(dtuple)
1560
& REC_NEW_STATUS_MASK,
1562
dtuple->n_fields, NULL));
1460
1565
data_size = dtuple_get_data_size(dtuple);
1462
1567
extra_size = rec_get_converted_extra_size(
1463
data_size, dtuple_get_n_fields(dtuple));
1568
data_size, dtuple_get_n_fields(dtuple), n_ext);
1465
1570
return(data_size + extra_size);