~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/rem/rem0rec.c

Tags: innodb-plugin-1.0.2
InnoDB Plugin 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
727
727
}
728
728
 
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. */
731
731
UNIV_INTERN
732
732
ulint
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
739
739
                                        it does not */
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 */
744
743
{
745
 
        ulint           extra_size;
746
 
        ulint           data_size;
747
 
        ulint           i;
 
744
        ulint   extra_size;
 
745
        ulint   data_size;
 
746
        ulint   i;
748
747
        ut_ad(index);
749
748
        ut_ad(fields);
750
749
        ut_ad(n_fields > 0);
751
 
 
752
 
        switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
753
 
        case REC_STATUS_ORDINARY:
754
 
                ut_ad(n_fields == dict_index_get_n_fields(index));
755
 
                data_size = 0;
756
 
                break;
757
 
        case REC_STATUS_NODE_PTR:
758
 
                n_fields--;
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 */
762
 
                break;
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;
767
 
                data_size = 8;
768
 
                goto func_exit;
769
 
        default:
770
 
                ut_error;
771
 
                return(ULINT_UNDEFINED);
772
 
        }
 
750
        ut_ad(n_fields <= dict_index_get_n_fields(index));
773
751
 
774
752
        extra_size = REC_N_NEW_EXTRA_BYTES
775
753
                + UT_BITS_IN_BYTES(index->n_nullable);
 
754
        data_size = 0;
776
755
 
777
756
        /* read the lengths of fields 0..n */
778
757
        for (i = 0; i < n_fields; i++) {
815
794
                data_size += len;
816
795
        }
817
796
 
818
 
func_exit:
819
797
        if (UNIV_LIKELY_NULL(extra)) {
820
798
                *extra = extra_size;
821
799
        }
823
801
        return(extra_size + data_size);
824
802
}
825
803
 
 
804
/**************************************************************
 
805
Determines the size of a data tuple in ROW_FORMAT=COMPACT. */
 
806
UNIV_INTERN
 
807
ulint
 
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
 
814
                                        it does not */
 
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 */
 
819
{
 
820
        ulint   size;
 
821
        ut_ad(index);
 
822
        ut_ad(fields);
 
823
        ut_ad(n_fields > 0);
 
824
 
 
825
        switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
 
826
        case REC_STATUS_ORDINARY:
 
827
                ut_ad(n_fields == dict_index_get_n_fields(index));
 
828
                size = 0;
 
829
                break;
 
830
        case REC_STATUS_NODE_PTR:
 
831
                n_fields--;
 
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 */
 
835
                break;
 
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;
 
841
                }
 
842
                return(REC_N_NEW_EXTRA_BYTES + 8);
 
843
        default:
 
844
                ut_error;
 
845
                return(ULINT_UNDEFINED);
 
846
        }
 
847
 
 
848
        return(size + rec_get_converted_size_comp_prefix(index, fields,
 
849
                                                         n_fields, extra));
 
850
}
 
851
 
826
852
/***************************************************************
827
853
Sets the value of the ith field SQL null bit of an old-style record. */
828
854
UNIV_INTERN
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);
1027
1054
 
1028
1055
        switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {