MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rem0cmp.cc File Reference
#include "rem0cmp.h"
#include "ha_prototypes.h"
#include "handler0alter.h"
#include "srv0srv.h"
Include dependency graph for rem0cmp.cc:

Go to the source code of this file.

Functions

int innobase_mysql_cmp (int mysql_type, uint charset_number, const unsigned char *a, unsigned int a_length, const unsigned char *b, unsigned int b_length)
int innobase_mysql_cmp_prefix (int mysql_type, uint charset_number, const unsigned char *a, unsigned int a_length, const unsigned char *b, unsigned int b_length)
UNIV_INLINE ulint cmp_collate (ulint code)
UNIV_INTERN ibool cmp_cols_are_equal (const dict_col_t *col1, const dict_col_t *col2, ibool check_charsets)
UNIV_INTERN int cmp_dfield_dfield_like_prefix (dfield_t *dfield1, dfield_t *dfield2)
UNIV_INTERN int cmp_data_data_slow (ulint mtype, ulint prtype, const byte *data1, ulint len1, const byte *data2, ulint len2)
int cmp_data_data_slow_varchar (const byte *lhs, ulint lhs_len, const byte *rhs, ulint rhs_len)
int cmp_data_data_slow_like_prefix (const byte *lhs, ulint len1, const byte *rhs, ulint len2)
int cmp_data_data_slow_like_suffix (const byte *data1 UNIV_UNUSED, ulint len1 UNIV_UNUSED, const byte *data2 UNIV_UNUSED, ulint len2 UNIV_UNUSED)
int cmp_data_data_slow_like_substr (const byte *data1 UNIV_UNUSED, ulint len1 UNIV_UNUSED, const byte *data2 UNIV_UNUSED, ulint len2 UNIV_UNUSED)
UNIV_INTERN int cmp_dtuple_rec_with_match_low (const dtuple_t *dtuple, const rec_t *rec, const ulint *offsets, ulint n_cmp, ulint *matched_fields, ulint *matched_bytes)
UNIV_INTERN int cmp_dtuple_rec (const dtuple_t *dtuple, const rec_t *rec, const ulint *offsets)
UNIV_INTERN ibool cmp_dtuple_is_prefix_of_rec (const dtuple_t *dtuple, const rec_t *rec, const ulint *offsets)

Variables

static const rec_t * rec2
static const rec_t const ulint * offsets1
static const rec_t const ulint
const ulint * 
offsets2
static const rec_t const ulint
const ulint const dict_index_t
index

Detailed Description

Comparison services for records

Created 7/1/1994 Heikki Tuuri

Definition in file rem0cmp.cc.

Function Documentation

UNIV_INLINE ulint cmp_collate ( ulint  code)

Transforms the character code so that it is ordered appropriately for the language. This is only used for the latin1 char set. MySQL does the comparisons for other char sets.

Returns
collation order position
Parameters
codein: code of a character stored in database record

Definition at line 121 of file rem0cmp.cc.

Here is the caller graph for this function:

UNIV_INTERN ibool cmp_cols_are_equal ( const dict_col_t col1,
const dict_col_t col2,
ibool  check_charsets 
)

Returns TRUE if two columns are equal for comparison purposes.

Returns
TRUE if the columns are considered equal in comparisons
Parameters
col1in: column 1
col2in: column 2
check_charsetsin: whether to check charsets

Definition at line 133 of file rem0cmp.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN int cmp_data_data_slow ( ulint  mtype,
ulint  prtype,
const byte *  data1,
ulint  len1,
const byte *  data2,
ulint  len2 
)

This function is used to compare two data fields for which we know the data type.

Returns
1, 0, -1, if data1 is greater, equal, less than data2, respectively
Parameters
mtypein: main type
prtypein: precise type
data1in: data field (== a pointer to a memory buffer)
len1in: data field length or UNIV_SQL_NULL
data2in: data field (== a pointer to a memory buffer)
len2in: data field length or UNIV_SQL_NULL

Definition at line 351 of file rem0cmp.cc.

Here is the call graph for this function:

UNIV_INTERN ibool cmp_dtuple_is_prefix_of_rec ( const dtuple_t dtuple,
const rec_t *  rec,
const ulint *  offsets 
)

Checks if a dtuple is a prefix of a record. The last field in dtuple is allowed to be a prefix of the corresponding field in the record.

Returns
TRUE if prefix
Parameters
dtuplein: data tuple
recin: physical record
offsetsin: array returned by rec_get_offsets()

Definition at line 883 of file rem0cmp.cc.

Here is the call graph for this function:

UNIV_INTERN int cmp_dtuple_rec ( const dtuple_t dtuple,
const rec_t *  rec,
const ulint *  offsets 
)

Compares a data tuple to a physical record.

See Also
cmp_dtuple_rec_with_match
Returns
1, 0, -1, if dtuple is greater, equal, less than rec, respectively
Parameters
dtuplein: data tuple
recin: physical record
offsetsin: array returned by rec_get_offsets()

Definition at line 863 of file rem0cmp.cc.

Here is the caller graph for this function:

UNIV_INTERN int cmp_dtuple_rec_with_match_low ( const dtuple_t dtuple,
const rec_t *  rec,
const ulint *  offsets,
ulint  n_cmp,
ulint *  matched_fields,
ulint *  matched_bytes 
)

This function is used to compare a data tuple to a physical record. Only dtuple->n_fields_cmp first fields are taken into account for the data tuple! If we denote by n = n_fields_cmp, then rec must have either m >= n fields, or it must differ from dtuple in some of the m fields rec has. If rec has an externally stored field we do not compare it but return with value 0 if such a comparison should be made.

Returns
1, 0, -1, if dtuple is greater, equal, less than rec, respectively, when only the common first fields are compared, or until the first externally stored field in rec
Parameters
dtuplein: data tuple
recin: physical record which differs from dtuple in some of the common fields, or which has an equal number or more fields than dtuple
offsetsin: array returned by rec_get_offsets()
n_cmpin: number of fields to compare
matched_fieldsin/out: number of already completely matched fields; when function returns, contains the value for current comparison
matched_bytesin/out: number of already matched bytes within the first field not completely matched; when function returns, contains the value for current comparison

Definition at line 627 of file rem0cmp.cc.

Here is the call graph for this function:

int innobase_mysql_cmp ( int  mysql_type,
uint  charset_number,
const unsigned char *  a,
unsigned int  a_length,
const unsigned char *  b,
unsigned int  b_length 
)

This function is used to compare two data fields for which the data type is such that we must use MySQL code to compare them. The prototype here must be a copy of the one in ha_innobase.cc!

Returns
1, 0, -1, if a is greater, equal, less than b, respectively in: data field length, not UNIV_SQL_NULL

InnoDB uses this function to compare two data fields for which the data type is such that we must use MySQL code to compare them. NOTE that the prototype of this function is in rem0cmp.cc in InnoDB source code! If you change this function, remember to update the prototype there!

Returns
1, 0, -1, if a is greater, equal, less than b, respectively

InnoDB uses this function to compare two data fields for which the data type is such that we must use MySQL code to compare them.

Returns
1, 0, -1, if a is greater, equal, less than b, respectively
Parameters
mysql_typein: MySQL type
charset_numberin: number of the charset
ain: data field
a_lengthin: data field length, not UNIV_SQL_NULL
bin: data field
b_lengthin: data field length, not UNIV_SQL_NULL

Definition at line 5104 of file ha_innodb.cc.

int innobase_mysql_cmp_prefix ( int  mysql_type,
uint  charset_number,
const unsigned char *  a,
unsigned int  a_length,
const unsigned char *  b,
unsigned int  b_length 
)

This function is used to compare two data fields for which the data type is such that we must use MySQL code to compare them. The prototype here must be a copy of the one in ha_innobase.cc!

Returns
1, 0, -1, if a is greater, equal, less than b, respectively in: data field length, not UNIV_SQL_NULL

InnoDB uses this function to compare two data fields for which the data type is such that we must use MySQL code to compare them. NOTE that the prototype of this function is in rem0cmp.c in InnoDB source code! If you change this function, remember to update the prototype there!

Returns
1, 0, -1, if a is greater, equal, less than b, respectively
Parameters
mysql_typein: MySQL type
charset_numberin: number of the charset
ain: data field
a_lengthin: data field length, not UNIV_SQL_NULL
bin: data field
b_lengthin: data field length, not UNIV_SQL_NULL

Definition at line 5238 of file ha_innodb.cc.

Here is the call graph for this function:

Variable Documentation

const rec_t const ulint const ulint const dict_index_t* index

in: data dictionary index

Definition at line 927 of file rem0cmp.cc.

const rec_t const ulint* offsets1

in: rec_get_offsets(rec1, ...)

Definition at line 927 of file rem0cmp.cc.

const rec_t const ulint const ulint* offsets2

in: rec_get_offsets(rec2, ...)

Definition at line 927 of file rem0cmp.cc.

const rec_t* rec2

< in: physical record in: physical record

Definition at line 927 of file rem0cmp.cc.