641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
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
|
|
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.ic
|
|
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 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
26 |
/*************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
27 |
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 |
28 |
data type.
|
29 |
@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. |
30 |
UNIV_INLINE
|
31 |
int
|
|
32 |
cmp_data_data( |
|
33 |
/*==========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
34 |
ulint mtype, /*!< in: main type */ |
35 |
ulint prtype, /*!< in: precise type */ |
|
36 |
const byte* data1, /*!< in: data field (== a pointer to a memory |
|
37 |
buffer) */
|
|
38 |
ulint len1, /*!< in: data field length or UNIV_SQL_NULL */ |
|
39 |
const byte* data2, /*!< in: data field (== a pointer to a memory |
|
40 |
buffer) */
|
|
41 |
ulint len2) /*!< in: data field length or UNIV_SQL_NULL */ |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
42 |
{
|
43 |
return(cmp_data_data_slow(mtype, prtype, data1, len1, data2, len2)); |
|
44 |
}
|
|
45 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
46 |
/*************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
47 |
This function is used to compare two dfields where at least the first
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
48 |
has its data type field set.
|
49 |
@return 1, 0, -1, if dfield1 is greater, equal, less than dfield2,
|
|
50 |
respectively */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
51 |
UNIV_INLINE
|
52 |
int
|
|
53 |
cmp_dfield_dfield( |
|
54 |
/*==============*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
55 |
const dfield_t* dfield1,/*!< in: data field; must have type field set */ |
56 |
const dfield_t* dfield2)/*!< in: data field */ |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
57 |
{
|
58 |
const dtype_t* type; |
|
59 |
||
60 |
ut_ad(dfield_check_typed(dfield1)); |
|
61 |
||
62 |
type = dfield_get_type(dfield1); |
|
63 |
||
64 |
return(cmp_data_data(type->mtype, type->prtype, |
|
65 |
(const byte*) dfield_get_data(dfield1), |
|
66 |
dfield_get_len(dfield1), |
|
67 |
(const byte*) dfield_get_data(dfield2), |
|
68 |
dfield_get_len(dfield2))); |
|
69 |
}
|
|
70 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
71 |
/*************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
72 |
This function is used to compare two physical records. Only the common
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
73 |
first fields are compared.
|
74 |
@return 1, 0 , -1 if rec1 is greater, equal, less, respectively, than
|
|
75 |
rec2; only the common first fields are compared */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
76 |
UNIV_INLINE
|
77 |
int
|
|
78 |
cmp_rec_rec( |
|
79 |
/*========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
80 |
const rec_t* rec1, /*!< in: physical record */ |
81 |
const rec_t* rec2, /*!< in: physical record */ |
|
82 |
const ulint* offsets1,/*!< in: rec_get_offsets(rec1, index) */ |
|
83 |
const ulint* offsets2,/*!< in: rec_get_offsets(rec2, index) */ |
|
84 |
dict_index_t* index) /*!< in: data dictionary index */ |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
85 |
{
|
86 |
ulint match_f = 0; |
|
87 |
ulint match_b = 0; |
|
88 |
||
89 |
return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index, |
|
90 |
&match_f, &match_b)); |
|
91 |
}
|