![]() |
MySQL 8.0.43
Source Code Documentation
|
Comparison services for records. More...
#include <my_sys.h>#include "data0data.h"#include "data0type.h"#include "dict0dict.h"#include "ha_prototypes.h"#include "rem0rec.h"#include "rem0cmp.ic"Go to the source code of this file.
Namespaces | |
| namespace | dd |
| The version of the current data dictionary table definitions. | |
Functions | |
| 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... | |
| 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... | |
| static int | cmp_dfield_dfield (const dfield_t *dfield1, const dfield_t *dfield2, bool is_asc) |
| Compare two data fields. More... | |
| static int | cmp_multi_value_dfield_dfield (const dfield_t *dfield1, const dfield_t *dfield2) |
| Compare two data fields, the first one can be of any form of multi-value field, while the second one must be one field from multi-value index. 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_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... | |
| 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... | |
| 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. 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=true) |
| Compare two B-tree records. More... | |
| static int | cmp_rec_rec (const rec_t *rec1, const rec_t *rec2, const ulint *offsets1, const ulint *offsets2, const dict_index_t *index, bool spatial_index_non_leaf, ulint *matched_fields=nullptr, bool cmp_btree_recs=true) |
| Compare two B-tree records. More... | |
| static bool | cmp_dfield_dfield_eq_prefix (const dfield_t *dfield1, const dfield_t *dfield2) |
| Compare two data fields. More... | |
Variables | |
| constexpr auto | DISABLE_MIN_REC_FLAG_CHECK = ULINT_UNDEFINED |
| Disable the min flag during row comparisons. 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. |
| 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 |
|
inlinestatic |
Compare two data fields.
| [in] | dfield1 | data field; must have type field set |
| [in] | dfield2 | data field |
| [in] | is_asc | true=ASC, false=DESC |
| 0 | if dfield1 is equal to dfield2 |
| negative | if dfield1 is less than dfield2 |
| positive | if dfield1 is greater than dfield2 |
|
inlinestatic |
Compare two data fields.
| [in] | dfield1 | data field |
| [in] | dfield2 | data field |
| true | if dfield1 is equal to dfield2, or a prefix of dfield1 |
| false | otherwise |
| 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 |
|
inlinestatic |
Compare two data fields, the first one can be of any form of multi-value field, while the second one must be one field from multi-value index.
| [in] | dfield1 | multi-value data field; |
| [in] | dfield2 | data field; must have type field set |
|
inlinestatic |
Compare two B-tree records.
Only the common first fields are compared, and externally stored field are treated as equal.
| [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 spatial index non leaf records |
| [out] | matched_fields | number of completely matched fields within the first field not completely matched |
| [in] | cmp_btree_recs | true if the both the records are b-tree records |
| 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 |
| 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 |
|
constexpr |
Disable the min flag during row comparisons.