729
729
/**************************************************************
730
Determines the size of a data tuple in ROW_FORMAT=COMPACT. */
730
Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. */
733
rec_get_converted_size_comp(
734
/*========================*/
733
rec_get_converted_size_comp_prefix(
734
/*===============================*/
735
735
/* out: total size */
736
736
const dict_index_t* index, /* in: record descriptor;
737
737
dict_table_is_comp() is
738
738
assumed to hold, even if
740
ulint status, /* in: status bits of the record */
741
740
const dfield_t* fields, /* in: array of data fields */
742
741
ulint n_fields,/* in: number of data fields */
743
742
ulint* extra) /* out: extra size */
750
749
ut_ad(n_fields > 0);
752
switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
753
case REC_STATUS_ORDINARY:
754
ut_ad(n_fields == dict_index_get_n_fields(index));
757
case REC_STATUS_NODE_PTR:
759
ut_ad(n_fields == dict_index_get_n_unique_in_tree(index));
760
ut_ad(dfield_get_len(&fields[n_fields]) == 4);
761
data_size = 4; /* child page number */
763
case REC_STATUS_INFIMUM:
764
case REC_STATUS_SUPREMUM:
765
/* infimum or supremum record, 8 data bytes */
766
extra_size = REC_N_NEW_EXTRA_BYTES;
771
return(ULINT_UNDEFINED);
750
ut_ad(n_fields <= dict_index_get_n_fields(index));
774
752
extra_size = REC_N_NEW_EXTRA_BYTES
775
753
+ UT_BITS_IN_BYTES(index->n_nullable);
777
756
/* read the lengths of fields 0..n */
778
757
for (i = 0; i < n_fields; i++) {
823
801
return(extra_size + data_size);
804
/**************************************************************
805
Determines the size of a data tuple in ROW_FORMAT=COMPACT. */
808
rec_get_converted_size_comp(
809
/*========================*/
810
/* out: total size */
811
const dict_index_t* index, /* in: record descriptor;
812
dict_table_is_comp() is
813
assumed to hold, even if
815
ulint status, /* in: status bits of the record */
816
const dfield_t* fields, /* in: array of data fields */
817
ulint n_fields,/* in: number of data fields */
818
ulint* extra) /* out: extra size */
825
switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
826
case REC_STATUS_ORDINARY:
827
ut_ad(n_fields == dict_index_get_n_fields(index));
830
case REC_STATUS_NODE_PTR:
832
ut_ad(n_fields == dict_index_get_n_unique_in_tree(index));
833
ut_ad(dfield_get_len(&fields[n_fields]) == REC_NODE_PTR_SIZE);
834
size = REC_NODE_PTR_SIZE; /* child page number */
836
case REC_STATUS_INFIMUM:
837
case REC_STATUS_SUPREMUM:
838
/* infimum or supremum record, 8 data bytes */
839
if (UNIV_LIKELY_NULL(extra)) {
840
*extra = REC_N_NEW_EXTRA_BYTES;
842
return(REC_N_NEW_EXTRA_BYTES + 8);
845
return(ULINT_UNDEFINED);
848
return(size + rec_get_converted_size_comp_prefix(index, fields,
826
852
/***************************************************************
827
853
Sets the value of the ith field SQL null bit of an old-style record. */
1022
1048
ulint n_node_ptr_field;
1023
1049
ulint fixed_len;
1024
1050
ulint null_mask = 1;
1025
ut_ad(dict_table_is_comp(index->table));
1051
ut_ad(extra == 0 || dict_table_is_comp(index->table));
1052
ut_ad(extra == 0 || extra == REC_N_NEW_EXTRA_BYTES);
1026
1053
ut_ad(n_fields > 0);
1028
1055
switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {