~vlad-lesin/percona-server/mysql-5.0.33-original

« back to all changes in this revision

Viewing changes to innobase/include/rem0cmp.h

  • Committer: Vlad Lesin
  • Date: 2012-07-31 09:21:34 UTC
  • Revision ID: vladislav.lesin@percona.com-20120731092134-zfodx022b7992wsi
VirginĀ 5.0.33

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***********************************************************************
 
2
Comparison services for records
 
3
 
 
4
(c) 1994-2001 Innobase Oy
 
5
 
 
6
Created 7/1/1994 Heikki Tuuri
 
7
************************************************************************/
 
8
 
 
9
#ifndef rem0cmp_h
 
10
#define rem0cmp_h
 
11
 
 
12
#include "univ.i"
 
13
#include "data0data.h"
 
14
#include "data0type.h"
 
15
#include "dict0dict.h"
 
16
#include "rem0rec.h"
 
17
 
 
18
/*****************************************************************
 
19
Returns TRUE if two types are equal for comparison purposes. */
 
20
 
 
21
ibool
 
22
cmp_types_are_equal(
 
23
/*================*/
 
24
                                /* out: TRUE if the types are considered
 
25
                                equal in comparisons */
 
26
        dtype_t*        type1,  /* in: type 1 */
 
27
        dtype_t*        type2,  /* in: type 2 */
 
28
        ibool           check_charsets); /* in: whether to check charsets */
 
29
/*****************************************************************
 
30
This function is used to compare two data fields for which we know the
 
31
data type. */
 
32
UNIV_INLINE
 
33
int
 
34
cmp_data_data(
 
35
/*==========*/  
 
36
                                /* out: 1, 0, -1, if data1 is greater, equal, 
 
37
                                less than data2, respectively */
 
38
        dtype_t*        cur_type,/* in: data type of the fields */
 
39
        byte*           data1,  /* in: data field (== a pointer to a memory
 
40
                                buffer) */
 
41
        ulint           len1,   /* in: data field length or UNIV_SQL_NULL */
 
42
        byte*           data2,  /* in: data field (== a pointer to a memory
 
43
                                buffer) */
 
44
        ulint           len2);  /* in: data field length or UNIV_SQL_NULL */
 
45
/*****************************************************************
 
46
This function is used to compare two data fields for which we know the
 
47
data type. */
 
48
 
 
49
int
 
50
cmp_data_data_slow(
 
51
/*===============*/     
 
52
                                /* out: 1, 0, -1, if data1 is greater, equal, 
 
53
                                less than data2, respectively */
 
54
        dtype_t*        cur_type,/* in: data type of the fields */
 
55
        byte*           data1,  /* in: data field (== a pointer to a memory
 
56
                                buffer) */
 
57
        ulint           len1,   /* in: data field length or UNIV_SQL_NULL */
 
58
        byte*           data2,  /* in: data field (== a pointer to a memory
 
59
                                buffer) */
 
60
        ulint           len2);  /* in: data field length or UNIV_SQL_NULL */
 
61
/*****************************************************************
 
62
This function is used to compare two dfields where at least the first
 
63
has its data type field set. */
 
64
UNIV_INLINE
 
65
int
 
66
cmp_dfield_dfield(
 
67
/*==============*/      
 
68
                                /* out: 1, 0, -1, if dfield1 is greater, equal, 
 
69
                                less than dfield2, respectively */
 
70
        dfield_t*       dfield1,/* in: data field; must have type field set */
 
71
        dfield_t*       dfield2);/* in: data field */
 
72
/*****************************************************************
 
73
This function is used to compare a data tuple to a physical record.
 
74
Only dtuple->n_fields_cmp first fields are taken into account for
 
75
the the data tuple! If we denote by n = n_fields_cmp, then rec must
 
76
have either m >= n fields, or it must differ from dtuple in some of
 
77
the m fields rec has. If rec has an externally stored field we do not
 
78
compare it but return with value 0 if such a comparison should be
 
79
made. */
 
80
 
 
81
int
 
82
cmp_dtuple_rec_with_match(
 
83
/*======================*/      
 
84
                                /* out: 1, 0, -1, if dtuple is greater, equal, 
 
85
                                less than rec, respectively, when only the 
 
86
                                common first fields are compared, or
 
87
                                until the first externally stored field in
 
88
                                rec */
 
89
        dtuple_t*       dtuple, /* in: data tuple */
 
90
        rec_t*          rec,    /* in: physical record which differs from
 
91
                                dtuple in some of the common fields, or which
 
92
                                has an equal number or more fields than
 
93
                                dtuple */
 
94
        const ulint*    offsets,/* in: array returned by rec_get_offsets() */
 
95
        ulint*          matched_fields, /* in/out: number of already completely 
 
96
                                matched fields; when function returns,
 
97
                                contains the value for current comparison */
 
98
        ulint*          matched_bytes); /* in/out: number of already matched 
 
99
                                bytes within the first field not completely
 
100
                                matched; when function returns, contains the
 
101
                                value for current comparison */
 
102
/******************************************************************
 
103
Compares a data tuple to a physical record. */
 
104
 
 
105
int
 
106
cmp_dtuple_rec(
 
107
/*===========*/
 
108
                                /* out: 1, 0, -1, if dtuple is greater, equal, 
 
109
                                less than rec, respectively; see the comments
 
110
                                for cmp_dtuple_rec_with_match */
 
111
        dtuple_t*       dtuple, /* in: data tuple */
 
112
        rec_t*          rec,    /* in: physical record */
 
113
        const ulint*    offsets);/* in: array returned by rec_get_offsets() */
 
114
/******************************************************************
 
115
Checks if a dtuple is a prefix of a record. The last field in dtuple
 
116
is allowed to be a prefix of the corresponding field in the record. */
 
117
 
 
118
ibool
 
119
cmp_dtuple_is_prefix_of_rec(
 
120
/*========================*/
 
121
                                /* out: TRUE if prefix */
 
122
        dtuple_t*       dtuple, /* in: data tuple */
 
123
        rec_t*          rec,    /* in: physical record */
 
124
        const ulint*    offsets);/* in: array returned by rec_get_offsets() */
 
125
/*****************************************************************
 
126
This function is used to compare two physical records. Only the common
 
127
first fields are compared, and if an externally stored field is
 
128
encountered, then 0 is returned. */
 
129
 
 
130
int
 
131
cmp_rec_rec_with_match(
 
132
/*===================*/ 
 
133
                                /* out: 1, 0 , -1 if rec1 is greater, equal,
 
134
                                less, respectively, than rec2; only the common
 
135
                                first fields are compared */
 
136
        rec_t*          rec1,   /* in: physical record */
 
137
        rec_t*          rec2,   /* in: physical record */
 
138
        const ulint*    offsets1,/* in: rec_get_offsets(rec1, index) */
 
139
        const ulint*    offsets2,/* in: rec_get_offsets(rec2, index) */
 
140
        dict_index_t*   index,  /* in: data dictionary index */
 
141
        ulint*          matched_fields, /* in/out: number of already completely 
 
142
                                matched fields; when the function returns,
 
143
                                contains the value the for current
 
144
                                comparison */
 
145
        ulint*          matched_bytes);/* in/out: number of already matched 
 
146
                                bytes within the first field not completely
 
147
                                matched; when the function returns, contains
 
148
                                the value for the current comparison */
 
149
/*****************************************************************
 
150
This function is used to compare two physical records. Only the common
 
151
first fields are compared. */
 
152
UNIV_INLINE
 
153
int
 
154
cmp_rec_rec(
 
155
/*========*/    
 
156
                                /* out: 1, 0 , -1 if rec1 is greater, equal,
 
157
                                less, respectively, than rec2; only the common
 
158
                                first fields are compared */
 
159
        rec_t*          rec1,   /* in: physical record */
 
160
        rec_t*          rec2,   /* in: physical record */
 
161
        const ulint*    offsets1,/* in: rec_get_offsets(rec1, index) */
 
162
        const ulint*    offsets2,/* in: rec_get_offsets(rec2, index) */
 
163
        dict_index_t*   index); /* in: data dictionary index */
 
164
 
 
165
 
 
166
#ifndef UNIV_NONINL
 
167
#include "rem0cmp.ic"
 
168
#endif
 
169
 
 
170
#endif