InnoDB Plugin  1.0
rem0cmp.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /*******************************************************************/
26 #ifndef rem0cmp_h
27 #define rem0cmp_h
28 
29 #include "univ.i"
30 #include "data0data.h"
31 #include "data0type.h"
32 #include "dict0dict.h"
33 #include "rem0rec.h"
34 
35 /*************************************************************/
38 UNIV_INTERN
39 ibool
41 /*===============*/
42  const dict_col_t* col1,
43  const dict_col_t* col2,
44  ibool check_charsets);
46 /*************************************************************/
50 UNIV_INLINE
51 int
53 /*==========*/
54  ulint mtype,
55  ulint prtype,
56  const byte* data1,
58  ulint len1,
59  const byte* data2,
61  ulint len2);
62 /*************************************************************/
66 UNIV_INTERN
67 int
69 /*===============*/
70  ulint mtype,
71  ulint prtype,
72  const byte* data1,
74  ulint len1,
75  const byte* data2,
77  ulint len2);
79 /*****************************************************************
80 This function is used to compare two data fields for which we know the
81 data type to be VARCHAR.
82 @return 1, 0, -1, if lhs is greater, equal, less than rhs, respectively */
83 UNIV_INTERN
84 int
85 cmp_data_data_slow_varchar(
86 /*=======================*/
87  const byte* lhs, /* in: data field (== a pointer to a memory
88  buffer) */
89  ulint lhs_len,/* in: data field length or UNIV_SQL_NULL */
90  const byte* rhs, /* in: data field (== a pointer to a memory
91  buffer) */
92  ulint rhs_len);/* in: data field length or UNIV_SQL_NULL */
93 /*****************************************************************
94 This function is used to compare two varchar/char fields. The comparison
95 is for the LIKE operator.
96 @return 1, 0, -1, if lhs is greater, equal, less than rhs, respectively */
97 UNIV_INTERN
98 int
99 cmp_data_data_slow_like_prefix(
100 /*===========================*/
101  const byte* data1, /* in: data field (== a pointer to a memory
102  buffer) */
103  ulint len1, /* in: data field length or UNIV_SQL_NULL */
104  const byte* data2, /* in: data field (== a pointer to a memory
105  buffer) */
106  ulint len2); /* in: data field length or UNIV_SQL_NULL */
107 /*****************************************************************
108 This function is used to compare two varchar/char fields. The comparison
109 is for the LIKE operator.
110 @return 1, 0, -1, if data1 is greater, equal, less than data2, respectively */
111 UNIV_INTERN
112 int
113 cmp_data_data_slow_like_suffix(
114 /*===========================*/
115  const byte* data1, /* in: data field (== a pointer to a memory
116  buffer) */
117  ulint len1, /* in: data field length or UNIV_SQL_NULL */
118  const byte* data2, /* in: data field (== a pointer to a memory
119  buffer) */
120  ulint len2); /* in: data field length or UNIV_SQL_NULL */
121 /*****************************************************************
122 This function is used to compare two varchar/char fields. The comparison
123 is for the LIKE operator.
124 @return 1, 0, -1, if data1 is greater, equal, less than data2, respectively */
125 UNIV_INTERN
126 int
127 cmp_data_data_slow_like_substr(
128 /*===========================*/
129  const byte* data1, /* in: data field (== a pointer to a memory
130  buffer) */
131  ulint len1, /* in: data field length or UNIV_SQL_NULL */
132  const byte* data2, /* in: data field (== a pointer to a memory
133  buffer) */
134  ulint len2); /* in: data field length or UNIV_SQL_NULL */
135 /*************************************************************/
140 UNIV_INLINE
141 int
143 /*==============*/
144  const dfield_t* dfield1,
145  const dfield_t* dfield2);
146 /*************************************************************/
157 UNIV_INTERN
158 int
160 /*==========================*/
161  const dtuple_t* dtuple,
162  const rec_t* rec,
166  const ulint* offsets,
167  ulint n_cmp,
168  ulint* matched_fields,
172  ulint* matched_bytes)
177  __attribute__((nonnull));
178 #define cmp_dtuple_rec_with_match(tuple,rec,offsets,fields,bytes) \
179  cmp_dtuple_rec_with_match_low( \
180  tuple,rec,offsets,dtuple_get_n_fields_cmp(tuple),fields,bytes)
181 /**************************************************************/
185 UNIV_INTERN
186 int
188 /*===========*/
189  const dtuple_t* dtuple,
190  const rec_t* rec,
191  const ulint* offsets);
192 /**************************************************************/
196 UNIV_INTERN
197 ibool
199 /*========================*/
200  const dtuple_t* dtuple,
201  const rec_t* rec,
202  const ulint* offsets);
203 /*************************************************************/
209 UNIV_INTERN
210 int
212 /*===============*/
213  const rec_t* rec1,
214  const rec_t* rec2,
215  const ulint* offsets1,
216  const ulint* offsets2,
217  const dict_index_t* index,
218  struct TABLE* table)
221  __attribute__((nonnull(1,2,3,4), warn_unused_result));
222 /*************************************************************/
227 UNIV_INTERN
228 int
230 /*===================*/
231  const rec_t* rec1,
232  const rec_t* rec2,
233  const ulint* offsets1,
234  const ulint* offsets2,
235  dict_index_t* index,
236  ibool nulls_unequal,
237  /* in: TRUE if this is for index statistics
238  cardinality estimation, and innodb_stats_method
239  is "nulls_unequal" or "nulls_ignored" */
240  ulint* matched_fields,
244  ulint* matched_bytes);
248 /*************************************************************/
253 UNIV_INLINE
254 int
256 /*========*/
257  const rec_t* rec1,
258  const rec_t* rec2,
259  const ulint* offsets1,
260  const ulint* offsets2,
261  dict_index_t* index);
263 /*****************************************************************
264 This function is used to compare two dfields where at least the first
265 has its data type field set. */
266 UNIV_INTERN
267 int
268 cmp_dfield_dfield_like_prefix(
269 /*==========================*/
270  /* out: 1, 0, -1, if dfield1 is greater, equal,
271  less than dfield2, respectively */
272  dfield_t* dfield1,/* in: data field; must have type field set */
273  dfield_t* dfield2);/* in: data field */
274 /*****************************************************************
275 This function is used to compare two dfields where at least the first
276 has its data type field set. */
277 UNIV_INLINE
278 int
279 cmp_dfield_dfield_like_substr(
280 /*==========================*/
281  /* out: 1, 0, -1, if dfield1 is greater, equal,
282  less than dfield2, respectively */
283  dfield_t* dfield1,/* in: data field; must have type field set */
284  dfield_t* dfield2);/* in: data field */
285 /*****************************************************************
286 This function is used to compare two dfields where at least the first
287 has its data type field set. */
288 UNIV_INLINE
289 int
290 cmp_dfield_dfield_like_suffix(
291 /*==========================*/
292  /* out: 1, 0, -1, if dfield1 is greater, equal,
293  less than dfield2, respectively */
294  dfield_t* dfield1,/* in: data field; must have type field set */
295  dfield_t* dfield2);/* in: data field */
296 
297 #ifndef UNIV_NONINL
298 #include "rem0cmp.ic"
299 #endif
300 
301 #endif