~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***********************************************************************
 
2
Comparison services for records
 
3
 
 
4
(c) 1994-1996 Innobase Oy
 
5
 
 
6
Created 7/1/1994 Heikki Tuuri
 
7
************************************************************************/
 
8
 
 
9
/*****************************************************************
 
10
This function is used to compare two data fields for which we know the
 
11
data type. */
 
12
UNIV_INLINE
 
13
int
 
14
cmp_data_data(
 
15
/*==========*/
 
16
                                /* out: 1, 0, -1, if data1 is greater, equal,
 
17
                                less than data2, respectively */
 
18
        ulint           mtype,  /* in: main type */
 
19
        ulint           prtype, /* in: precise type */
 
20
        byte*           data1,  /* in: data field (== a pointer to a memory
 
21
                                buffer) */
 
22
        ulint           len1,   /* in: data field length or UNIV_SQL_NULL */
 
23
        byte*           data2,  /* in: data field (== a pointer to a memory
 
24
                                buffer) */
 
25
        ulint           len2)   /* in: data field length or UNIV_SQL_NULL */
 
26
{
 
27
        return(cmp_data_data_slow(mtype, prtype, data1, len1, data2, len2));
 
28
}
 
29
 
 
30
/*****************************************************************
 
31
This function is used to compare two dfields where at least the first
 
32
has its data type field set. */
 
33
UNIV_INLINE
 
34
int
 
35
cmp_dfield_dfield(
 
36
/*==============*/
 
37
                                /* out: 1, 0, -1, if dfield1 is greater, equal,
 
38
                                less than dfield2, respectively */
 
39
        dfield_t*       dfield1,/* in: data field; must have type field set */
 
40
        dfield_t*       dfield2)/* in: data field */
 
41
{
 
42
        const dtype_t*  type;
 
43
 
 
44
        ut_ad(dfield_check_typed(dfield1));
 
45
 
 
46
        type = dfield_get_type(dfield1);
 
47
 
 
48
        return(cmp_data_data(type->mtype, type->prtype,
 
49
                             dfield_get_data(dfield1),
 
50
                             dfield_get_len(dfield1),
 
51
                             dfield_get_data(dfield2),
 
52
                             dfield_get_len(dfield2)));
 
53
}
 
54
 
 
55
/*****************************************************************
 
56
This function is used to compare two physical records. Only the common
 
57
first fields are compared. */
 
58
UNIV_INLINE
 
59
int
 
60
cmp_rec_rec(
 
61
/*========*/
 
62
                                /* out: 1, 0 , -1 if rec1 is greater, equal,
 
63
                                less, respectively, than rec2; only the common
 
64
                                first fields are compared */
 
65
        rec_t*          rec1,   /* in: physical record */
 
66
        rec_t*          rec2,   /* in: physical record */
 
67
        const ulint*    offsets1,/* in: rec_get_offsets(rec1, index) */
 
68
        const ulint*    offsets2,/* in: rec_get_offsets(rec2, index) */
 
69
        dict_index_t*   index)  /* in: data dictionary index */
 
70
{
 
71
        ulint   match_f         = 0;
 
72
        ulint   match_b         = 0;
 
73
 
 
74
        return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index,
 
75
                                      &match_f, &match_b));
 
76
}