Browse Source

branches/zip: Rename dtuple_datas_are_ordering_equal() to dtuple_coll_cmp(),

and change the return type from ibool to int (-1, 0, 1).  This comparison
function will be needed in fast index creation.
pull/374/head
marko 19 years ago
parent
commit
88eee48c1e
  1. 37
      data/data0data.c
  2. 16
      include/data0data.h
  3. 4
      row/row0vers.c

37
data/data0data.c

@ -94,24 +94,18 @@ dfield_data_is_binary_equal(
}
/****************************************************************
Returns TRUE if lengths of two dtuples are equal and respective data fields
in them are equal when compared with collation in char fields (not as binary
strings). */
Compare two data tuples, respecting the collation of character fields. */
ibool
dtuple_datas_are_ordering_equal(
/*============================*/
/* out: TRUE if length and fieds are equal
when compared with cmp_data_data:
NOTE: in character type fields some letters
are identified with others! (collation) */
int
dtuple_coll_cmp(
/*============*/
/* out: 1, 0 , -1 if tuple1 is greater, equal,
less, respectively, than tuple2 */
const dtuple_t* tuple1, /* in: tuple 1 */
const dtuple_t* tuple2) /* in: tuple 2 */
{
const dfield_t* field1;
const dfield_t* field2;
ulint n_fields;
ulint i;
ulint n_fields;
ulint i;
ut_ad(tuple1 && tuple2);
ut_ad(tuple1->magic_n == DATA_TUPLE_MAGIC_N);
@ -123,21 +117,22 @@ dtuple_datas_are_ordering_equal(
if (n_fields != dtuple_get_n_fields(tuple2)) {
return(FALSE);
return(n_fields < dtuple_get_n_fields(tuple2) ? -1 : 1);
}
for (i = 0; i < n_fields; i++) {
int cmp;
const dfield_t* field1 = dtuple_get_nth_field(tuple1, i);
const dfield_t* field2 = dtuple_get_nth_field(tuple2, i);
field1 = dtuple_get_nth_field(tuple1, i);
field2 = dtuple_get_nth_field(tuple2, i);
if (0 != cmp_dfield_dfield(field1, field2)) {
cmp = cmp_dfield_dfield(field1, field2);
return(FALSE);
if (cmp) {
return(cmp);
}
}
return(TRUE);
return(0);
}
/*************************************************************************

16
include/data0data.h

@ -238,17 +238,13 @@ dtuple_get_data_size(
/* out: sum of data lens */
const dtuple_t* tuple); /* in: typed data tuple */
/****************************************************************
Returns TRUE if lengths of two dtuples are equal and respective data fields
in them are equal when compared with collation in char fields (not as binary
strings). */
Compare two data tuples, respecting the collation of character fields. */
ibool
dtuple_datas_are_ordering_equal(
/*============================*/
/* out: TRUE if length and fieds are equal
when compared with cmp_data_data:
NOTE: in character type fields some letters
are identified with others! (collation) */
int
dtuple_coll_cmp(
/*============*/
/* out: 1, 0 , -1 if tuple1 is greater, equal,
less, respectively, than tuple2 */
const dtuple_t* tuple1, /* in: tuple 1 */
const dtuple_t* tuple2);/* in: tuple 2 */
/****************************************************************

4
row/row0vers.c

@ -343,7 +343,7 @@ row_vers_old_has_index_entry(
to a different binary value in a char field, but the
collation identifies the old and new value anyway! */
if (dtuple_datas_are_ordering_equal(ientry, entry)) {
if (!dtuple_coll_cmp(ientry, entry)) {
mem_heap_free(heap);
@ -386,7 +386,7 @@ row_vers_old_has_index_entry(
a char field, but the collation identifies the old
and new value anyway! */
if (dtuple_datas_are_ordering_equal(ientry, entry)) {
if (!dtuple_coll_cmp(ientry, entry)) {
mem_heap_free(heap);

Loading…
Cancel
Save