![]() |
MySQL 8.0.43
Source Code Documentation
|
Comparison services for records. More...
#include <gstream.h>#include <page0cur.h>#include <spatial.h>#include <sys/types.h>#include <algorithm>#include "ha_prototypes.h"#include "handler0alter.h"#include "rem0cmp.h"#include "srv0srv.h"Namespaces | |
| namespace | dd |
| The version of the current data dictionary table definitions. | |
Functions | |
| static int | innobase_mysql_cmp (ulint prtype, const byte *a, size_t a_length, const byte *b, size_t b_length) |
| Compare two data fields. More... | |
| bool | cmp_cols_are_equal (const dict_col_t *col1, const dict_col_t *col2, bool check_charsets) |
| Returns true if two columns are equal for comparison purposes. More... | |
| static UNIV_COLD int | cmp_decimal (const byte *a, unsigned int a_length, const byte *b, unsigned int b_length, bool is_asc) |
| Compare two DATA_DECIMAL (MYSQL_TYPE_DECIMAL) fields. More... | |
| static int | cmp_geometry_field (ulint prtype, const byte *a, unsigned int a_length, const byte *b, unsigned int b_length) |
| Innobase uses this function to compare two geometry data fields. More... | |
| static int | cmp_gis_field (page_cur_mode_t mode, const byte *a, unsigned int a_length, const byte *b, unsigned int b_length, const dd::Spatial_reference_system *srs) |
| Innobase uses this function to compare two gis data fields. More... | |
| static int | cmp_whole_field (ulint mtype, ulint prtype, bool is_asc, const byte *a, unsigned int a_length, const byte *b, unsigned int b_length) |
| Compare two data fields. More... | |
| int | cmp_data (ulint mtype, ulint prtype, bool is_asc, const byte *data1, ulint len1, const byte *data2, ulint len2) |
| Compare two data fields. More... | |
| int | cmp_dtuple_rec_with_gis (const dtuple_t *dtuple, const rec_t *rec, const ulint *offsets, page_cur_mode_t mode, const dd::Spatial_reference_system *srs) |
| Compare a GIS data tuple to a physical record. More... | |
| int | cmp_dtuple_rec_with_gis_internal (const dtuple_t *dtuple, const rec_t *rec, const ulint *offsets, const dd::Spatial_reference_system *srs) |
| Compare a GIS data tuple to a physical record in rtree non-leaf node. More... | |
| int | cmp_data_data (ulint mtype, ulint prtype, bool is_asc, const byte *data1, ulint len1, const byte *data2, ulint len2) |
| Compare two data fields. More... | |
| int | cmp_dtuple_rec_with_match_low (const dtuple_t *dtuple, const rec_t *rec, const dict_index_t *index, const ulint *offsets, ulint n_cmp, ulint *matched_fields) |
| Compare a data tuple to a physical record. More... | |
| static ulint | cmp_get_pad_char (const dtype_t *type) |
| Get the pad character code point for a type. More... | |
| int | cmp_dtuple_rec_with_match_bytes (const dtuple_t *dtuple, const rec_t *rec, const dict_index_t *index, const ulint *offsets, ulint *matched_fields, ulint *matched_bytes) |
| Compare a data tuple to a physical record. More... | |
| int | cmp_dtuple_rec (const dtuple_t *dtuple, const rec_t *rec, const dict_index_t *index, const ulint *offsets) |
| Compare a data tuple to a physical record. More... | |
| bool | cmp_dtuple_is_prefix_of_rec (const dtuple_t *dtuple, const rec_t *rec, const dict_index_t *index, const ulint *offsets) |
| Check if a dtuple is a prefix of a record. More... | |
| static int | cmp_rec_rec_simple_field (const rec_t *rec1, const rec_t *rec2, const ulint *offsets1, const ulint *offsets2, const dict_index_t *index, ulint n) |
| Compare two physical record fields. More... | |
| int | cmp_rec_rec_simple (const rec_t *rec1, const rec_t *rec2, const ulint *offsets1, const ulint *offsets2, const dict_index_t *index, TABLE *table) |
| Compare two physical records that contain the same number of columns, none of which are stored externally. More... | |
| int | cmp_rec_rec_with_match (const rec_t *rec1, const rec_t *rec2, const ulint *offsets1, const ulint *offsets2, const dict_index_t *index, bool spatial_index_non_leaf, bool nulls_unequal, ulint *matched_fields, bool cmp_btree_recs) |
| Compare two B-tree records. More... | |
Comparison services for records.
Created 7/1/1994 Heikki Tuuri
| bool cmp_cols_are_equal | ( | const dict_col_t * | col1, |
| const dict_col_t * | col2, | ||
| bool | check_charsets | ||
| ) |
Returns true if two columns are equal for comparison purposes.
| [in] | col1 | Column to compare. |
| [in] | col2 | Column to compare. |
| [in] | check_charsets | if true then check the character sets. |
|
inline |
Compare two data fields.
| [in] | mtype | main type |
| [in] | prtype | precise type |
| [in] | is_asc | true=ascending, false=descending order |
| [in] | data1 | data field |
| [in] | len1 | length of data1 in bytes, or UNIV_SQL_NULL |
| [in] | data2 | data field |
| [in] | len2 | length of data2 in bytes, or UNIV_SQL_NULL |
| 0 | if data1 is equal to data2 |
| negative | if data1 is less than data2 |
| positive | if data1 is greater than data2 |
| int cmp_data_data | ( | ulint | mtype, |
| ulint | prtype, | ||
| bool | is_asc, | ||
| const byte * | data1, | ||
| ulint | len1, | ||
| const byte * | data2, | ||
| ulint | len2 | ||
| ) |
Compare two data fields.
| [in] | mtype | main type |
| [in] | prtype | precise type |
| [in] | is_asc | true=ascending, false=descending order |
| [in] | data1 | data field |
| [in] | len1 | length of data1 in bytes, or UNIV_SQL_NULL |
| [in] | data2 | data field |
| [in] | len2 | length of data2 in bytes, or UNIV_SQL_NULL |
| 0 | if data1 is equal to data2 |
| negative | if data1 is less than data2 |
| positive | if data1 is greater than data2 |
|
static |
Compare two DATA_DECIMAL (MYSQL_TYPE_DECIMAL) fields.
TODO: Remove this function. Everything should use MYSQL_TYPE_NEWDECIMAL.
| [in] | a | data field |
| [in] | a_length | length of a, in bytes (not UNIV_SQL_NULL) |
| [in] | b | data field |
| [in] | b_length | length of b, in bytes (not UNIV_SQL_NULL) |
| [in] | is_asc | true=ascending, false=descending order |
| bool cmp_dtuple_is_prefix_of_rec | ( | const dtuple_t * | dtuple, |
| const rec_t * | rec, | ||
| const dict_index_t * | index, | ||
| const ulint * | offsets | ||
| ) |
Check if a dtuple is a prefix of a record.
| [in] | dtuple | data tuple |
| [in] | rec | B-tree record |
| [in] | index | B-tree index |
| [in] | offsets | rec_get_offsets(rec) |
| int cmp_dtuple_rec | ( | const dtuple_t * | dtuple, |
| const rec_t * | rec, | ||
| const dict_index_t * | index, | ||
| const ulint * | offsets | ||
| ) |
Compare a data tuple to a physical record.
| [in] | dtuple | data tuple |
| [in] | rec | record |
| [in] | index | index |
| [in] | offsets | rec_get_offsets(rec) |
| 0 | if dtuple is equal to rec |
| negative | if dtuple is less than rec |
| positive | if dtuple is greater than rec |
| int cmp_dtuple_rec_with_gis | ( | const dtuple_t * | dtuple, |
| const rec_t * | rec, | ||
| const ulint * | offsets, | ||
| page_cur_mode_t | mode, | ||
| const dd::Spatial_reference_system * | srs | ||
| ) |
Compare a GIS data tuple to a physical record.
| [in] | dtuple | data tuple |
| [in] | rec | B-tree record |
| [in] | offsets | rec_get_offsets(rec) |
| [in] | mode | compare mode |
| [in] | srs | Spatial reference system of R-tree |
| negative | if dtuple is less than rec |
| int cmp_dtuple_rec_with_gis_internal | ( | const dtuple_t * | dtuple, |
| const rec_t * | rec, | ||
| const ulint * | offsets, | ||
| const dd::Spatial_reference_system * | srs | ||
| ) |
Compare a GIS data tuple to a physical record in rtree non-leaf node.
We need to check the page number field, since we don't store pk field in rtree non-leaf node.
| [in] | dtuple | data tuple |
| [in] | rec | R-tree record |
| [in] | offsets | rec_get_offsets(rec) |
| [in] | srs | Spatial referenxe system |
| negative | if dtuple is less than rec |
| int cmp_dtuple_rec_with_match_bytes | ( | const dtuple_t * | dtuple, |
| const rec_t * | rec, | ||
| const dict_index_t * | index, | ||
| const ulint * | offsets, | ||
| ulint * | matched_fields, | ||
| ulint * | matched_bytes | ||
| ) |
Compare a data tuple to a physical record.
| [in] | dtuple | data tuple |
| [in] | rec | B-tree or R-tree index record |
| [in] | index | index tree |
| [in] | offsets | rec_get_offsets(rec) |
| [in,out] | matched_fields | number of completely matched fields |
| [in,out] | matched_bytes | number of matched bytes in the first field that is not matched |
| 0 | if dtuple is equal to rec |
| negative | if dtuple is less than rec |
| positive | if dtuple is greater than rec |
| int cmp_dtuple_rec_with_match_low | ( | const dtuple_t * | dtuple, |
| const rec_t * | rec, | ||
| const dict_index_t * | index, | ||
| const ulint * | offsets, | ||
| ulint | n_cmp, | ||
| ulint * | matched_fields | ||
| ) |
Compare a data tuple to a physical record.
| [in] | dtuple | data tuple |
| [in] | rec | record |
| [in] | index | index |
| [in] | offsets | rec_get_offsets(rec) |
| [in] | n_cmp | number of fields to compare |
| [in,out] | matched_fields | number of completely matched fields |
| 0 | if dtuple is equal to rec |
| negative | if dtuple is less than rec |
| positive | if dtuple is greater than rec |
|
static |
Innobase uses this function to compare two geometry data fields.
| prtype | in: precise type |
| a | in: data field |
| a_length | in: data field length, not UNIV_SQL_NULL |
| b | in: data field |
| b_length | in: data field length, not UNIV_SQL_NULL |
Get the pad character code point for a type.
| [in] | type | SQL data type |
| ULINT_UNDEFINED | if no padding is specified |
|
static |
Innobase uses this function to compare two gis data fields.
| mode | in: compare mode |
| a | in: data field |
| a_length | in: data field length, not UNIV_SQL_NULL |
| b | in: data field |
| b_length | in: data field length, not UNIV_SQL_NULL |
| srs | in: SRS of R-tree |
| 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.
| [in] | rec1 | Physical record 1 to compare |
| [in] | rec2 | Physical record 2 to compare |
| [in] | offsets1 | rec_get_offsets(rec1, ...) |
| [in] | offsets2 | rec_get_offsets(rec2, ...) |
| [in] | index | Data dictionary index |
| [in] | table | MySQL table, for reporting duplicate key value if applicable, or nullptr |
| positive | if rec1 (including non-ordering columns) is greater than rec2 |
| negative | if rec1 (including non-ordering columns) is less than rec2 |
| 0 | if rec1 is a duplicate of rec2 |
|
static |
Compare two physical record fields.
| [in] | rec1 | Physical record. |
| [in] | rec2 | Physical record. |
| [in] | offsets1 | rec_get_offsets(rec1, ...). |
| [in] | offsets2 | rec_get_offsets(rec2, ...). |
| [in] | index | Data dictionary index. |
| [in] | n | Field to compare. |
| positive | if rec1 field is greater than rec2 |
| negative | if rec1 field is less than rec2 |
| 0 | if rec1 field equals to rec2 |
| int cmp_rec_rec_with_match | ( | const rec_t * | rec1, |
| const rec_t * | rec2, | ||
| const ulint * | offsets1, | ||
| const ulint * | offsets2, | ||
| const dict_index_t * | index, | ||
| bool | spatial_index_non_leaf, | ||
| bool | nulls_unequal, | ||
| ulint * | matched_fields, | ||
| bool | cmp_btree_recs = true |
||
| ) |
Compare two B-tree records.
| [in] | rec1 | B-tree record |
| [in] | rec2 | B-tree record |
| [in] | offsets1 | rec_get_offsets(rec1, index) |
| [in] | offsets2 | rec_get_offsets(rec2, index) |
| [in] | index | B-tree index |
| [in] | spatial_index_non_leaf | true if record is in spatial non leaf page |
| [in] | nulls_unequal | true if this is for index cardinality statistics estimation, and innodb_stats_method=nulls_unequal or innodb_stats_method=nulls_ignored |
| [out] | matched_fields | number of completely matched fields within the first field not completely matched |
| [in] | cmp_btree_recs | true if we're comparing two b-tree records |
| 0 | if rec1 is equal to rec2 |
| negative | if rec1 is less than rec2 |
| positive | if rec2 is greater than rec2 |
|
static |
Compare two data fields.
| [in] | mtype | main type |
| [in] | prtype | precise type |
| [in] | is_asc | true=ascending, false=descending order |
| [in] | a | data field |
| [in] | a_length | length of a, in bytes (not UNIV_SQL_NULL) |
| [in] | b | data field |
| [in] | b_length | length of b, in bytes (not UNIV_SQL_NULL) |
|
inlinestatic |
Compare two data fields.
| [in] | prtype | precise type |
| [in] | a | data field |
| [in] | a_length | length of a, in bytes (not UNIV_SQL_NULL) |
| [in] | b | data field |
| [in] | b_length | length of b, in bytes (not UNIV_SQL_NULL) |