Commit 88eee48c authored by marko's avatar marko

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.
parent ad0a8695
...@@ -94,22 +94,16 @@ dfield_data_is_binary_equal( ...@@ -94,22 +94,16 @@ dfield_data_is_binary_equal(
} }
/**************************************************************** /****************************************************************
Returns TRUE if lengths of two dtuples are equal and respective data fields Compare two data tuples, respecting the collation of character fields. */
in them are equal when compared with collation in char fields (not as binary
strings). */
ibool int
dtuple_datas_are_ordering_equal( dtuple_coll_cmp(
/*============================*/ /*============*/
/* out: TRUE if length and fieds are equal /* out: 1, 0 , -1 if tuple1 is greater, equal,
when compared with cmp_data_data: less, respectively, than tuple2 */
NOTE: in character type fields some letters
are identified with others! (collation) */
const dtuple_t* tuple1, /* in: tuple 1 */ const dtuple_t* tuple1, /* in: tuple 1 */
const dtuple_t* tuple2) /* in: tuple 2 */ const dtuple_t* tuple2) /* in: tuple 2 */
{ {
const dfield_t* field1;
const dfield_t* field2;
ulint n_fields; ulint n_fields;
ulint i; ulint i;
...@@ -123,21 +117,22 @@ dtuple_datas_are_ordering_equal( ...@@ -123,21 +117,22 @@ dtuple_datas_are_ordering_equal(
if (n_fields != dtuple_get_n_fields(tuple2)) { 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++) { 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); cmp = cmp_dfield_dfield(field1, field2);
field2 = dtuple_get_nth_field(tuple2, i);
if (0 != cmp_dfield_dfield(field1, field2)) { if (cmp) {
return(cmp);
return(FALSE);
} }
} }
return(TRUE); return(0);
} }
/************************************************************************* /*************************************************************************
......
...@@ -238,17 +238,13 @@ dtuple_get_data_size( ...@@ -238,17 +238,13 @@ dtuple_get_data_size(
/* out: sum of data lens */ /* out: sum of data lens */
const dtuple_t* tuple); /* in: typed data tuple */ const dtuple_t* tuple); /* in: typed data tuple */
/**************************************************************** /****************************************************************
Returns TRUE if lengths of two dtuples are equal and respective data fields Compare two data tuples, respecting the collation of character fields. */
in them are equal when compared with collation in char fields (not as binary
strings). */
ibool int
dtuple_datas_are_ordering_equal( dtuple_coll_cmp(
/*============================*/ /*============*/
/* out: TRUE if length and fieds are equal /* out: 1, 0 , -1 if tuple1 is greater, equal,
when compared with cmp_data_data: less, respectively, than tuple2 */
NOTE: in character type fields some letters
are identified with others! (collation) */
const dtuple_t* tuple1, /* in: tuple 1 */ const dtuple_t* tuple1, /* in: tuple 1 */
const dtuple_t* tuple2);/* in: tuple 2 */ const dtuple_t* tuple2);/* in: tuple 2 */
/**************************************************************** /****************************************************************
......
...@@ -343,7 +343,7 @@ row_vers_old_has_index_entry( ...@@ -343,7 +343,7 @@ row_vers_old_has_index_entry(
to a different binary value in a char field, but the to a different binary value in a char field, but the
collation identifies the old and new value anyway! */ 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); mem_heap_free(heap);
...@@ -386,7 +386,7 @@ row_vers_old_has_index_entry( ...@@ -386,7 +386,7 @@ row_vers_old_has_index_entry(
a char field, but the collation identifies the old a char field, but the collation identifies the old
and new value anyway! */ and new value anyway! */
if (dtuple_datas_are_ordering_equal(ientry, entry)) { if (!dtuple_coll_cmp(ientry, entry)) {
mem_heap_free(heap); mem_heap_free(heap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment