InnoDB Plugin  1.0
Macros | Functions | Variables
rem0cmp.h File Reference
#include "univ.i"
#include "data0data.h"
#include "data0type.h"
#include "dict0dict.h"
#include "rem0rec.h"
#include "rem0cmp.ic"
Include dependency graph for rem0cmp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define cmp_dtuple_rec_with_match(tuple, rec, offsets, fields, bytes)

Functions

UNIV_INTERN ibool cmp_cols_are_equal (const dict_col_t *col1, const dict_col_t *col2, ibool check_charsets)
UNIV_INLINE int cmp_data_data (ulint mtype, ulint prtype, const byte *data1, ulint len1, const byte *data2, ulint len2)
UNIV_INTERN int cmp_data_data_slow (ulint mtype, ulint prtype, const byte *data1, ulint len1, const byte *data2, ulint len2)
UNIV_INTERN int cmp_data_data_slow_varchar (const byte *lhs, ulint lhs_len, const byte *rhs, ulint rhs_len)
UNIV_INTERN int cmp_data_data_slow_like_prefix (const byte *data1, ulint len1, const byte *data2, ulint len2)
UNIV_INTERN int cmp_data_data_slow_like_suffix (const byte *data1, ulint len1, const byte *data2, ulint len2)
UNIV_INTERN int cmp_data_data_slow_like_substr (const byte *data1, ulint len1, const byte *data2, ulint len2)
UNIV_INLINE int cmp_dfield_dfield (const dfield_t *dfield1, const dfield_t *dfield2)
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)
UNIV_INTERN int cmp_rec_rec_simple (const rec_t *rec1, const rec_t *rec2, const ulint *offsets1, const ulint *offsets2, const dict_index_t *index, struct TABLE *table)
UNIV_INTERN int cmp_rec_rec_with_match (const rec_t *rec1, const rec_t *rec2, const ulint *offsets1, const ulint *offsets2, dict_index_t *index, ibool nulls_unequal, ulint *matched_fields, ulint *matched_bytes)
UNIV_INLINE int cmp_rec_rec (const rec_t *rec1, const rec_t *rec2, const ulint *offsets1, const ulint *offsets2, dict_index_t *index)
UNIV_INTERN int cmp_dfield_dfield_like_prefix (dfield_t *dfield1, dfield_t *dfield2)
UNIV_INLINE int cmp_dfield_dfield_like_substr (dfield_t *dfield1, dfield_t *dfield2)
UNIV_INLINE int cmp_dfield_dfield_like_suffix (dfield_t *dfield1, dfield_t *dfield2)

Variables

UNIV_INTERN int warn_unused_result

Detailed Description

Comparison services for records

Created 7/1/1994 Heikki Tuuri

Macro Definition Documentation

#define cmp_dtuple_rec_with_match (   tuple,
  rec,
  offsets,
  fields,
  bytes 
)
Value:
tuple,rec,offsets,dtuple_get_n_fields_cmp(tuple),fields,bytes)

Function Documentation

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 in: whether to check charsets
Parameters
col1in: column 1
col2in: column 2
UNIV_INLINE int cmp_data_data ( 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 in: data field length or UNIV_SQL_NULL

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
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 in: data field length or UNIV_SQL_NULL
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)
UNIV_INLINE int cmp_dfield_dfield ( const dfield_t dfield1,
const dfield_t dfield2 
)

This function is used to compare two dfields where at least the first has its data type field set.

Returns
1, 0, -1, if dfield1 is greater, equal, less than dfield2, respectively in: data field

This function is used to compare two dfields where at least the first has its data type field set.

Returns
1, 0, -1, if dfield1 is greater, equal, less than dfield2, respectively
Parameters
dfield1in: data field; must have type field set
dfield2in: data field
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 in: array returned by rec_get_offsets()
Parameters
dtuplein: data tuple
recin: physical record
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 in: array returned by rec_get_offsets()
Parameters
dtuplein: data tuple
recin: physical record
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
UNIV_INLINE int cmp_rec_rec ( const rec_t *  rec1,
const rec_t *  rec2,
const ulint *  offsets1,
const ulint *  offsets2,
dict_index_t index 
)

This function is used to compare two physical records. Only the common first fields are compared.

Returns
1, 0 , -1 if rec1 is greater, equal, less, respectively, than rec2; only the common first fields are compared in: data dictionary index

This function is used to compare two physical records. Only the common first fields are compared.

Returns
1, 0 , -1 if rec1 is greater, equal, less, respectively, than rec2; only the common first fields are compared
Parameters
rec1in: physical record
rec2in: physical record
offsets1in: rec_get_offsets(rec1, index)
offsets2in: rec_get_offsets(rec2, index)
indexin: data dictionary index
UNIV_INTERN int cmp_rec_rec_simple ( const rec_t *  rec1,
const rec_t *  rec2,
const ulint *  offsets1,
const ulint *  offsets2,
const dict_index_t index,
struct TABLE *  table 
)

Compare two physical records that contain the same number of columns, none of which are stored externally.

Return values
1if rec1 (including non-ordering columns) is greater than rec2
-1if rec1 (including non-ordering columns) is less than rec2
0if rec1 is a duplicate of rec2
Parameters
rec1in: physical record
rec2in: physical record
offsets1in: rec_get_offsets(rec1, ...)
offsets2in: rec_get_offsets(rec2, ...)
indexin: data dictionary index
tablein: MySQL table, for reporting duplicate key value if applicable, or NULL
UNIV_INTERN int cmp_rec_rec_with_match ( const rec_t *  rec1,
const rec_t *  rec2,
const ulint *  offsets1,
const ulint *  offsets2,
dict_index_t index,
ibool  nulls_unequal,
ulint *  matched_fields,
ulint *  matched_bytes 
)

This function is used to compare two physical records. Only the common first fields are compared, and if an externally stored field is encountered, then 0 is returned.

Returns
1, 0, -1 if rec1 is greater, equal, less, respectively in/out: number of already matched bytes within the first field not completely matched; when the function returns, contains the value for the current comparison
Parameters
rec1in: physical record
rec2in: physical record
offsets1in: rec_get_offsets(rec1, index)
offsets2in: rec_get_offsets(rec2, index)
indexin: data dictionary index
matched_fieldsin/out: number of already completely matched fields; when the function returns, contains the value the for current comparison