~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/rem0cmp.h

  • Committer: patrick crews
  • Date: 2010-09-29 15:15:19 UTC
  • mfrom: (1099.4.188 drizzle)
  • Revision ID: gleebix@gmail.com-20100929151519-6mrmzd1ciw2p9nws
Tags: 2010.09.1802
Update translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1994, 2009, Innobase Oy. 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., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/*******************************************************************//**
20
 
@file include/rem0cmp.h
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
 
 
35
 
/*************************************************************//**
36
 
Returns TRUE if two columns are equal for comparison purposes.
37
 
@return TRUE if the columns are considered equal in comparisons */
38
 
UNIV_INTERN
39
 
ibool
40
 
cmp_cols_are_equal(
41
 
/*===============*/
42
 
        const dict_col_t*       col1,   /*!< in: column 1 */
43
 
        const dict_col_t*       col2,   /*!< in: column 2 */
44
 
        ibool                   check_charsets);
45
 
                                        /*!< in: whether to check charsets */
46
 
/*************************************************************//**
47
 
This function is used to compare two data fields for which we know the
48
 
data type.
49
 
@return 1, 0, -1, if data1 is greater, equal, less than data2, respectively */
50
 
UNIV_INLINE
51
 
int
52
 
cmp_data_data(
53
 
/*==========*/
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
 
/*************************************************************//**
63
 
This function is used to compare two data fields for which we know the
64
 
data type.
65
 
@return 1, 0, -1, if data1 is greater, equal, less than data2, respectively */
66
 
UNIV_INTERN
67
 
int
68
 
cmp_data_data_slow(
69
 
/*===============*/
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
 
/*************************************************************//**
79
 
This function is used to compare two dfields where at least the first
80
 
has its data type field set.
81
 
@return 1, 0, -1, if dfield1 is greater, equal, less than dfield2,
82
 
respectively */
83
 
UNIV_INLINE
84
 
int
85
 
cmp_dfield_dfield(
86
 
/*==============*/
87
 
        const dfield_t* dfield1,/*!< in: data field; must have type field set */
88
 
        const dfield_t* dfield2);/*!< in: data field */
89
 
/*************************************************************//**
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
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 */
100
 
UNIV_INTERN
101
 
int
102
 
cmp_dtuple_rec_with_match(
103
 
/*======================*/
104
 
        const dtuple_t* dtuple, /*!< in: data tuple */
105
 
        const rec_t*    rec,    /*!< in: physical record which differs from
106
 
                                dtuple in some of the common fields, or which
107
 
                                has an equal number or more fields than
108
 
                                dtuple */
109
 
        const ulint*    offsets,/*!< in: array returned by rec_get_offsets() */
110
 
        ulint*          matched_fields, /*!< in/out: number of already completely
111
 
                                matched fields; when function returns,
112
 
                                contains the value for current comparison */
113
 
        ulint*          matched_bytes); /*!< in/out: number of already matched
114
 
                                bytes within the first field not completely
115
 
                                matched; when function returns, contains the
116
 
                                value for current comparison */
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 */
121
 
UNIV_INTERN
122
 
int
123
 
cmp_dtuple_rec(
124
 
/*===========*/
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
 
/**************************************************************//**
129
 
Checks if a dtuple is a prefix of a record. The last field in dtuple
130
 
is allowed to be a prefix of the corresponding field in the record.
131
 
@return TRUE if prefix */
132
 
UNIV_INTERN
133
 
ibool
134
 
cmp_dtuple_is_prefix_of_rec(
135
 
/*========================*/
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
 
/*************************************************************//**
140
 
Compare two physical records that contain the same number of columns,
141
 
none of which are stored externally.
142
 
@return 1, 0, -1 if rec1 is greater, equal, less, respectively, than rec2 */
143
 
UNIV_INTERN
144
 
int
145
 
cmp_rec_rec_simple(
146
 
/*===============*/
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, ...) */
151
 
        const dict_index_t*     index,  /*!< in: data dictionary index */
152
 
        ibool*                  null_eq);/*!< out: set to TRUE if
153
 
                                        found matching null values */
154
 
/*************************************************************//**
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
157
 
encountered, then 0 is returned.
158
 
@return 1, 0, -1 if rec1 is greater, equal, less, respectively */
159
 
UNIV_INTERN
160
 
int
161
 
cmp_rec_rec_with_match(
162
 
/*===================*/
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
169
 
                                matched fields; when the function returns,
170
 
                                contains the value the for current
171
 
                                comparison */
172
 
        ulint*          matched_bytes);/*!< in/out: number of already matched
173
 
                                bytes within the first field not completely
174
 
                                matched; when the function returns, contains
175
 
                                the value for the current comparison */
176
 
/*************************************************************//**
177
 
This function is used to compare two physical records. Only the common
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 */
181
 
UNIV_INLINE
182
 
int
183
 
cmp_rec_rec(
184
 
/*========*/
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 */
190
 
 
191
 
 
192
 
#ifndef UNIV_NONINL
193
 
#include "rem0cmp.ic"
194
 
#endif
195
 
 
196
 
#endif