~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Lee
  • Date: 2008-10-30 22:02:01 UTC
  • mto: (572.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 573.
  • Revision ID: lbieber@lbieber-desktop-20081030220201-elb6qprbzpn7c5a4
add my name to the AUTHORS file

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.ic
21
 
Comparison services for records
22
 
 
23
 
Created 7/1/1994 Heikki Tuuri
24
 
************************************************************************/
25
 
 
26
 
/*************************************************************//**
27
 
This function is used to compare two data fields for which we know the
28
 
data type.
29
 
@return 1, 0, -1, if data1 is greater, equal, less than data2, respectively */
30
 
UNIV_INLINE
31
 
int
32
 
cmp_data_data(
33
 
/*==========*/
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 */
42
 
{
43
 
        return(cmp_data_data_slow(mtype, prtype, data1, len1, data2, len2));
44
 
}
45
 
 
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,
50
 
respectively */
51
 
UNIV_INLINE
52
 
int
53
 
cmp_dfield_dfield(
54
 
/*==============*/
55
 
        const dfield_t* dfield1,/*!< in: data field; must have type field set */
56
 
        const dfield_t* dfield2)/*!< in: data field */
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
 
 
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 */
76
 
UNIV_INLINE
77
 
int
78
 
cmp_rec_rec(
79
 
/*========*/
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 */
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
 
}