~drizzle-trunk/drizzle/development

641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
1
/*****************************************************************************
2
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
3
Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved.
641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
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
1802.10.2 by Monty Taylor
Update all of the copyright headers to include the correct address.
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
16
17
*****************************************************************************/
18
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
19
/*******************************************************************//**
20
@file include/rem0cmp.h
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
21
Comparison services for records
22
23
Created 7/1/1994 Heikki Tuuri
24
************************************************************************/
25
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
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
35
/*************************************************************//**
36
Returns TRUE if two columns are equal for comparison purposes.
37
@return	TRUE if the columns are considered equal in comparisons */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
38
UNIV_INTERN
39
ibool
40
cmp_cols_are_equal(
41
/*===============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
42
	const dict_col_t*	col1,	/*!< in: column 1 */
43
	const dict_col_t*	col2,	/*!< in: column 2 */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
44
	ibool			check_charsets);
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
45
					/*!< in: whether to check charsets */
46
/*************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
47
This function is used to compare two data fields for which we know the
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
48
data type.
49
@return	1, 0, -1, if data1 is greater, equal, less than data2, respectively */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
50
UNIV_INLINE
51
int
52
cmp_data_data(
53
/*==========*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
54
	ulint		mtype,	/*!< in: main type */
55
	ulint		prtype,	/*!< in: precise type */
56
	const byte*	data1,	/*!< in: data field (== a pointer to a memory
57
				buffer) */
58
	ulint		len1,	/*!< in: data field length or UNIV_SQL_NULL */
59
	const byte*	data2,	/*!< in: data field (== a pointer to a memory
60
				buffer) */
61
	ulint		len2);	/*!< in: data field length or UNIV_SQL_NULL */
62
/*************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
63
This function is used to compare two data fields for which we know the
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
64
data type.
65
@return	1, 0, -1, if data1 is greater, equal, less than data2, respectively */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
66
UNIV_INTERN
67
int
68
cmp_data_data_slow(
69
/*===============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
70
	ulint		mtype,	/*!< in: main type */
71
	ulint		prtype,	/*!< in: precise type */
72
	const byte*	data1,	/*!< in: data field (== a pointer to a memory
73
				buffer) */
74
	ulint		len1,	/*!< in: data field length or UNIV_SQL_NULL */
75
	const byte*	data2,	/*!< in: data field (== a pointer to a memory
76
				buffer) */
77
	ulint		len2);	/*!< in: data field length or UNIV_SQL_NULL */
78
/*************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
79
This function is used to compare two dfields where at least the first
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
80
has its data type field set.
81
@return 1, 0, -1, if dfield1 is greater, equal, less than dfield2,
82
respectively */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
83
UNIV_INLINE
84
int
85
cmp_dfield_dfield(
86
/*==============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
87
	const dfield_t*	dfield1,/*!< in: data field; must have type field set */
88
	const dfield_t*	dfield2);/*!< in: data field */
89
/*************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
90
This function is used to compare a data tuple to a physical record.
91
Only dtuple->n_fields_cmp first fields are taken into account for
92
the the data tuple! If we denote by n = n_fields_cmp, then rec must
93
have either m >= n fields, or it must differ from dtuple in some of
94
the m fields rec has. If rec has an externally stored field we do not
95
compare it but return with value 0 if such a comparison should be
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
96
made.
97
@return 1, 0, -1, if dtuple is greater, equal, less than rec,
98
respectively, when only the common first fields are compared, or until
99
the first externally stored field in rec */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
100
UNIV_INTERN
101
int
102
cmp_dtuple_rec_with_match(
103
/*======================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
104
	const dtuple_t*	dtuple,	/*!< in: data tuple */
105
	const rec_t*	rec,	/*!< in: physical record which differs from
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
106
				dtuple in some of the common fields, or which
107
				has an equal number or more fields than
108
				dtuple */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
109
	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
110
	ulint*		matched_fields, /*!< in/out: number of already completely
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
111
				matched fields; when function returns,
112
				contains the value for current comparison */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
113
	ulint*		matched_bytes); /*!< in/out: number of already matched
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
114
				bytes within the first field not completely
115
				matched; when function returns, contains the
116
				value for current comparison */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
117
/**************************************************************//**
118
Compares a data tuple to a physical record.
119
@see cmp_dtuple_rec_with_match
120
@return 1, 0, -1, if dtuple is greater, equal, less than rec, respectively */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
121
UNIV_INTERN
122
int
123
cmp_dtuple_rec(
124
/*===========*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
125
	const dtuple_t*	dtuple,	/*!< in: data tuple */
126
	const rec_t*	rec,	/*!< in: physical record */
127
	const ulint*	offsets);/*!< in: array returned by rec_get_offsets() */
128
/**************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
129
Checks if a dtuple is a prefix of a record. The last field in dtuple
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
130
is allowed to be a prefix of the corresponding field in the record.
131
@return	TRUE if prefix */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
132
UNIV_INTERN
133
ibool
134
cmp_dtuple_is_prefix_of_rec(
135
/*========================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
136
	const dtuple_t*	dtuple,	/*!< in: data tuple */
137
	const rec_t*	rec,	/*!< in: physical record */
138
	const ulint*	offsets);/*!< in: array returned by rec_get_offsets() */
139
/*************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
140
Compare two physical records that contain the same number of columns,
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
141
none of which are stored externally.
142
@return	1, 0, -1 if rec1 is greater, equal, less, respectively, than rec2 */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
143
UNIV_INTERN
144
int
145
cmp_rec_rec_simple(
146
/*===============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
147
	const rec_t*		rec1,	/*!< in: physical record */
148
	const rec_t*		rec2,	/*!< in: physical record */
149
	const ulint*		offsets1,/*!< in: rec_get_offsets(rec1, ...) */
150
	const ulint*		offsets2,/*!< in: rec_get_offsets(rec2, ...) */
1819.7.107 by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100511161828-9reevde6i3sjlwuc from MySQL InnoDB
151
	const dict_index_t*	index,	/*!< in: data dictionary index */
152
	ibool*			null_eq);/*!< out: set to TRUE if
153
					found matching null values */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
154
/*************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
155
This function is used to compare two physical records. Only the common
156
first fields are compared, and if an externally stored field is
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
157
encountered, then 0 is returned.
158
@return 1, 0, -1 if rec1 is greater, equal, less, respectively */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
159
UNIV_INTERN
160
int
161
cmp_rec_rec_with_match(
162
/*===================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
163
	const rec_t*	rec1,	/*!< in: physical record */
164
	const rec_t*	rec2,	/*!< in: physical record */
165
	const ulint*	offsets1,/*!< in: rec_get_offsets(rec1, index) */
166
	const ulint*	offsets2,/*!< in: rec_get_offsets(rec2, index) */
167
	dict_index_t*	index,	/*!< in: data dictionary index */
168
	ulint*		matched_fields, /*!< in/out: number of already completely
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
169
				matched fields; when the function returns,
170
				contains the value the for current
171
				comparison */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
172
	ulint*		matched_bytes);/*!< in/out: number of already matched
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
173
				bytes within the first field not completely
174
				matched; when the function returns, contains
175
				the value for the current comparison */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
176
/*************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
177
This function is used to compare two physical records. Only the common
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
178
first fields are compared.
179
@return 1, 0 , -1 if rec1 is greater, equal, less, respectively, than
180
rec2; only the common first fields are compared */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
181
UNIV_INLINE
182
int
183
cmp_rec_rec(
184
/*========*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
185
	const rec_t*	rec1,	/*!< in: physical record */
186
	const rec_t*	rec2,	/*!< in: physical record */
187
	const ulint*	offsets1,/*!< in: rec_get_offsets(rec1, index) */
188
	const ulint*	offsets2,/*!< in: rec_get_offsets(rec2, index) */
189
	dict_index_t*	index);	/*!< in: data dictionary index */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
190
191
192
#ifndef UNIV_NONINL
193
#include "rem0cmp.ic"
194
#endif
195
196
#endif