diff options
Diffstat (limited to 'storage/xtradb/include/rem0cmp.h')
-rw-r--r-- | storage/xtradb/include/rem0cmp.h | 121 |
1 files changed, 111 insertions, 10 deletions
diff --git a/storage/xtradb/include/rem0cmp.h b/storage/xtradb/include/rem0cmp.h index c5ef0d5438a..cb3c85ac2c8 100644 --- a/storage/xtradb/include/rem0cmp.h +++ b/storage/xtradb/include/rem0cmp.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA *****************************************************************************/ @@ -75,6 +75,63 @@ cmp_data_data_slow( const byte* data2, /*!< in: data field (== a pointer to a memory buffer) */ ulint len2); /*!< in: data field length or UNIV_SQL_NULL */ + +/***************************************************************** +This function is used to compare two data fields for which we know the +data type to be VARCHAR. +@return 1, 0, -1, if lhs is greater, equal, less than rhs, respectively */ +UNIV_INTERN +int +cmp_data_data_slow_varchar( +/*=======================*/ + const byte* lhs, /* in: data field (== a pointer to a memory + buffer) */ + ulint lhs_len,/* in: data field length or UNIV_SQL_NULL */ + const byte* rhs, /* in: data field (== a pointer to a memory + buffer) */ + ulint rhs_len);/* in: data field length or UNIV_SQL_NULL */ +/***************************************************************** +This function is used to compare two varchar/char fields. The comparison +is for the LIKE operator. +@return 1, 0, -1, if lhs is greater, equal, less than rhs, respectively */ +UNIV_INTERN +int +cmp_data_data_slow_like_prefix( +/*===========================*/ + const byte* data1, /* in: data field (== a pointer to a memory + buffer) */ + ulint len1, /* in: data field length or UNIV_SQL_NULL */ + const byte* data2, /* in: data field (== a pointer to a memory + buffer) */ + ulint len2); /* in: data field length or UNIV_SQL_NULL */ +/***************************************************************** +This function is used to compare two varchar/char fields. The comparison +is for the LIKE operator. +@return 1, 0, -1, if data1 is greater, equal, less than data2, respectively */ +UNIV_INTERN +int +cmp_data_data_slow_like_suffix( +/*===========================*/ + const byte* data1, /* in: data field (== a pointer to a memory + buffer) */ + ulint len1, /* in: data field length or UNIV_SQL_NULL */ + const byte* data2, /* in: data field (== a pointer to a memory + buffer) */ + ulint len2); /* in: data field length or UNIV_SQL_NULL */ +/***************************************************************** +This function is used to compare two varchar/char fields. The comparison +is for the LIKE operator. +@return 1, 0, -1, if data1 is greater, equal, less than data2, respectively */ +UNIV_INTERN +int +cmp_data_data_slow_like_substr( +/*===========================*/ + const byte* data1, /* in: data field (== a pointer to a memory + buffer) */ + ulint len1, /* in: data field length or UNIV_SQL_NULL */ + const byte* data2, /* in: data field (== a pointer to a memory + buffer) */ + ulint len2); /* in: data field length or UNIV_SQL_NULL */ /*************************************************************//** This function is used to compare two dfields where at least the first has its data type field set. @@ -99,21 +156,28 @@ respectively, when only the common first fields are compared, or until the first externally stored field in rec */ UNIV_INTERN int -cmp_dtuple_rec_with_match( -/*======================*/ +cmp_dtuple_rec_with_match_low( +/*==========================*/ const dtuple_t* dtuple, /*!< in: data tuple */ const rec_t* rec, /*!< in: physical record which differs from dtuple in some of the common fields, or which has an equal number or more fields than dtuple */ const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ - ulint* matched_fields, /*!< in/out: number of already completely + ulint n_cmp, /*!< in: number of fields to compare */ + ulint* matched_fields, + /*!< in/out: number of already completely matched fields; when function returns, contains the value for current comparison */ - ulint* matched_bytes); /*!< in/out: number of already matched + ulint* matched_bytes) + /*!< in/out: number of already matched bytes within the first field not completely matched; when function returns, contains the value for current comparison */ + __attribute__((nonnull)); +#define cmp_dtuple_rec_with_match(tuple,rec,offsets,fields,bytes) \ + cmp_dtuple_rec_with_match_low( \ + tuple,rec,offsets,dtuple_get_n_fields_cmp(tuple),fields,bytes) /**************************************************************//** Compares a data tuple to a physical record. @see cmp_dtuple_rec_with_match @@ -139,7 +203,9 @@ cmp_dtuple_is_prefix_of_rec( /*************************************************************//** Compare two physical records that contain the same number of columns, none of which are stored externally. -@return 1, 0, -1 if rec1 is greater, equal, less, respectively, than rec2 */ +@retval 1 if rec1 (including non-ordering columns) is greater than rec2 +@retval -1 if rec1 (including non-ordering columns) is less than rec2 +@retval 0 if rec1 is a duplicate of rec2 */ UNIV_INTERN int cmp_rec_rec_simple( @@ -149,8 +215,10 @@ cmp_rec_rec_simple( const ulint* offsets1,/*!< in: rec_get_offsets(rec1, ...) */ const ulint* offsets2,/*!< in: rec_get_offsets(rec2, ...) */ const dict_index_t* index, /*!< in: data dictionary index */ - ibool* null_eq);/*!< out: set to TRUE if - found matching null values */ + struct TABLE* table) /*!< in: MySQL table, for reporting + duplicate key value if applicable, + or NULL */ + __attribute__((nonnull(1,2,3,4), warn_unused_result)); /*************************************************************//** This function is used to compare two physical records. Only the common first fields are compared, and if an externally stored field is @@ -192,6 +260,39 @@ cmp_rec_rec( const ulint* offsets2,/*!< in: rec_get_offsets(rec2, index) */ dict_index_t* index); /*!< in: data dictionary index */ +/***************************************************************** +This function is used to compare two dfields where at least the first +has its data type field set. */ +UNIV_INTERN +int +cmp_dfield_dfield_like_prefix( +/*==========================*/ + /* out: 1, 0, -1, if dfield1 is greater, equal, + less than dfield2, respectively */ + dfield_t* dfield1,/* in: data field; must have type field set */ + dfield_t* dfield2);/* in: data field */ +/***************************************************************** +This function is used to compare two dfields where at least the first +has its data type field set. */ +UNIV_INLINE +int +cmp_dfield_dfield_like_substr( +/*==========================*/ + /* out: 1, 0, -1, if dfield1 is greater, equal, + less than dfield2, respectively */ + dfield_t* dfield1,/* in: data field; must have type field set */ + dfield_t* dfield2);/* in: data field */ +/***************************************************************** +This function is used to compare two dfields where at least the first +has its data type field set. */ +UNIV_INLINE +int +cmp_dfield_dfield_like_suffix( +/*==========================*/ + /* out: 1, 0, -1, if dfield1 is greater, equal, + less than dfield2, respectively */ + dfield_t* dfield1,/* in: data field; must have type field set */ + dfield_t* dfield2);/* in: data field */ #ifndef UNIV_NONINL #include "rem0cmp.ic" |