/*************************************************************//**
Returns TRUEif two columns are equal for comparison purposes.
@returnTRUEif the columns are considered equal in comparisons */
ibool
cmp_cols_are_equal( /*===============*/ const dict_col_t* col1, /*!< in: column 1 */ const dict_col_t* col2, /*!< in: column 2 */
ibool check_charsets); /*!< in: whether to check charsets */ /** Compare two data fields. @parammtypemaintype @paramprtypeprecisetype @paramdescendingwhethertousedescendingorder @paramdata1datafield @paramlen1lengthofdata1inbytes,orUNIV_SQL_NULL @paramdata2datafield @paramlen2lengthofdata2inbytes,orUNIV_SQL_NULL @returnthecomparisonresultofdata1anddata2 @retval0ifdata1isequaltodata2 @retvalnegativeifdata1islessthandata2
@retval positive if data1 is greater than data2 */ int cmp_data(ulint mtype, ulint prtype, bool descending, const byte *data1, size_t len1, const byte *data2, size_t len2)
noexcept
MY_ATTRIBUTE((warn_unused_result));
/** Compare two data fields. @paramdfield1datafield;musthavetypefieldset @paramdfield2datafield @paramdescendingwhethertousedescendingorder @returnthecomparisonresultofdfield1anddfield2 @retval0ifdfield1isequaltodfield2 @retvalnegativeifdfield1islessthandfield2
@retval positive if dfield1 is greater than dfield2 */ inlineint cmp_dfield_dfield(const dfield_t *dfield1, const dfield_t *dfield2, bool descending= false)
{
ut_ad(dfield_check_typed(dfield1)); const dtype_t *type= dfield_get_type(dfield1); return cmp_data(type->mtype, type->prtype, descending, static_cast<const byte*>(dfield_get_data(dfield1)),
dfield_get_len(dfield1), static_cast<const byte*>(dfield_get_data(dfield2)),
dfield_get_len(dfield2));
}
#ifdef UNIV_DEBUG /** Compare a GIS data tuple to a physical record. @param[in]dtupledatatuple @param[in]recR-treerecord @param[in]modecomparemode
@retval negative if dtuple is less than rec */ int cmp_dtuple_rec_with_gis(const dtuple_t *dtuple, const rec_t *rec,
page_cur_mode_t mode)
MY_ATTRIBUTE((nonnull)); #endif
/** Compare two minimum bounding rectangles.
@return 1, 0, -1, if a is greater, equal, less than b, respectively */ inlineint cmp_geometry_field(constvoid *a, constvoid *b)
{ const byte *mbr1= static_cast<const byte*>(a); const byte *mbr2= static_cast<const byte*>(b);
/** Compare a data tuple to a physical record. @paramdtupledatatuple @paramrecB-treeindexrecord @paramindexB-treeindex @paramoffsetsrec_get_offsets(rec,index) @paramn_cmpnumberoffieldstocompare @parammatched_fieldsnumberofcompletelymatchedfields @returnthecomparisonresultofdtupleandrec @retval0ifdtupleisequaltorec @retvalnegativeifdtupleislessthanrec
@retval 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 rec_offs *offsets,
ulint n_cmp, uint16_t *matched_fields)
MY_ATTRIBUTE((nonnull)); #define cmp_dtuple_rec_with_match(tuple,rec,index,offsets,fields) \
cmp_dtuple_rec_with_match_low( \
tuple,rec,index,offsets,dtuple_get_n_fields_cmp(tuple),fields) /** Compare a data tuple to a physical record. @seecmp_dtuple_rec_with_match @paramdtupledatatuple @paramrecindexrecord @paramindexindex @paramoffsetsrec_get_offsets(rec,index) @returnthecomparisonresultofdtupleandrec @retval0ifdtupleisequaltorec @retvalnegativeifdtupleislessthanrec
@retval positive if dtuple is greater than rec */ inlineint cmp_dtuple_rec(const dtuple_t *dtuple, const rec_t *rec, const dict_index_t *index, const rec_offs *offsets)
{
uint16_t matched= 0; return cmp_dtuple_rec_with_match(dtuple, rec, index, offsets, &matched);
}
/** Check if a dtuple is a prefix of a record. @paramdtupledatatuple @paramrecindexrecord @paramindexindex @paramoffsetsrec_get_offsets(rec)
@return whether dtuple is a prefix of rec */ bool cmp_dtuple_is_prefix_of_rec(const dtuple_t *dtuple, const rec_t *rec, const dict_index_t *index, const rec_offs *offsets)
MY_ATTRIBUTE((nonnull, warn_unused_result));
/** Compare two physical records that contain the same number of columns, noneofwhicharestoredexternally. @retvalpositiveifrec1(includingnon-orderingcolumns)isgreaterthanrec2 @retvalnegativeifrec1(includingnon-orderingcolumns)islessthanrec2
@retval 0 if rec1 is a duplicate of rec2 */ int
cmp_rec_rec_simple( /*===============*/ const rec_t* rec1, /*!< in: physical record */ const rec_t* rec2, /*!< in: physical record */ const rec_offs* offsets1,/*!< in: rec_get_offsets(rec1, ...) */ const rec_offs* offsets2,/*!< in: rec_get_offsets(rec2, ...) */ const dict_index_t* index, /*!< in: data dictionary index */ struct TABLE* table) /*!< in: MySQL table, for reporting duplicatekeyvalueifapplicable,
or NULL */
MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result));
/** Compare two B-tree or R-tree records. Onlythecommonfirstfieldsarecompared,andexternallystoredfield aretreatedasequal. @param[in]rec1record(possiblynotonanindexpage) @param[in]rec2B-treeorR-treerecordinanindexpage @param[in]offsets1rec_get_offsets(rec1,index) @param[in]offsets2rec_get_offsets(rec2,index) @param[in]nulls_unequaltrueifthisisforindexcardinality statisticsestimationwith innodb_stats_method=nulls_unequal orinnodb_stats_method=nulls_ignored @param[out]matched_fieldsnumberofcompletelymatchedfields withinthefirstfieldnotcompletelymatched @retval0ifrec1isequaltorec2 @retvalnegativeifrec1islessthanrec2
@retval positive if rec1 is greater than rec2 */ int
cmp_rec_rec( const rec_t* rec1, const rec_t* rec2, const rec_offs* offsets1, const rec_offs* offsets2, const dict_index_t* index, bool nulls_unequal = false,
ulint* matched_fields = NULL)
MY_ATTRIBUTE((nonnull(1,2,3,4,5)));
#ifdef UNIV_DEBUG switch (type->prtype & DATA_MYSQL_TYPE_MASK) { case MYSQL_TYPE_BIT: case MYSQL_TYPE_STRING: case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: case MYSQL_TYPE_BLOB: case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_VARCHAR: break; default:
ut_error;
} #endif/* UNIV_DEBUG */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.