1
/*****************************************************************************
3
Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved.
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.
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.
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
17
*****************************************************************************/
19
/*******************************************************************//**
20
@file include/rem0cmp.ic
21
Comparison services for records
23
Created 7/1/1994 Heikki Tuuri
24
************************************************************************/
26
/*************************************************************//**
27
This function is used to compare two data fields for which we know the
29
@return 1, 0, -1, if data1 is greater, equal, less than data2, respectively */
34
ulint mtype, /*!< in: main type */
35
ulint prtype, /*!< in: precise type */
36
const byte* data1, /*!< in: data field (== a pointer to a memory
38
ulint len1, /*!< in: data field length or UNIV_SQL_NULL */
39
const byte* data2, /*!< in: data field (== a pointer to a memory
41
ulint len2) /*!< in: data field length or UNIV_SQL_NULL */
43
return(cmp_data_data_slow(mtype, prtype, data1, len1, data2, len2));
46
/*************************************************************//**
47
This function is used to compare two dfields where at least the first
48
has its data type field set.
49
@return 1, 0, -1, if dfield1 is greater, equal, less than dfield2,
55
const dfield_t* dfield1,/*!< in: data field; must have type field set */
56
const dfield_t* dfield2)/*!< in: data field */
60
ut_ad(dfield_check_typed(dfield1));
62
type = dfield_get_type(dfield1);
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)));
71
/*************************************************************//**
72
This function is used to compare two physical records. Only the common
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 */
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 */
89
return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index,