summaryrefslogtreecommitdiff
path: root/innobase/rem
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/rem')
-rw-r--r--innobase/rem/rem0cmp.c58
-rw-r--r--innobase/rem/rem0rec.c19
2 files changed, 47 insertions, 30 deletions
diff --git a/innobase/rem/rem0cmp.c b/innobase/rem/rem0cmp.c
index dea2621faf3..254ebeec8c9 100644
--- a/innobase/rem/rem0cmp.c
+++ b/innobase/rem/rem0cmp.c
@@ -61,10 +61,11 @@ must be a copy of the the one in ha_innobase.cc! */
extern
int
innobase_mysql_cmp(
-/*===============*/
+/*===============*/
/* out: 1, 0, -1, if a is greater,
equal, less than b, respectively */
- int mysql_type, /* in: MySQL type */
+ int mysql_type, /* in: MySQL type */
+ uint charset_number, /* in: number of the charset */
unsigned char* a, /* in: data field */
unsigned int a_length, /* in: data field length,
not UNIV_SQL_NULL */
@@ -97,16 +98,28 @@ cmp_types_are_equal(
dtype_t* type1, /* in: type 1 */
dtype_t* type2) /* in: type 2 */
{
- if ((type1->mtype == DATA_VARCHAR && type2->mtype == DATA_CHAR)
- || (type1->mtype == DATA_CHAR && type2->mtype == DATA_VARCHAR)
- || (type1->mtype == DATA_FIXBINARY && type2->mtype == DATA_BINARY)
- || (type1->mtype == DATA_BINARY && type2->mtype == DATA_FIXBINARY)
- || (type1->mtype == DATA_MYSQL && type2->mtype == DATA_VARMYSQL)
- || (type1->mtype == DATA_VARMYSQL && type2->mtype == DATA_MYSQL)) {
-
- return(TRUE);
+ if (dtype_is_non_binary_string_type(type1->mtype, type1->prtype)
+ && dtype_is_non_binary_string_type(type2->mtype, type2->prtype)) {
+
+ /* Both are non-binary string types: they can be compared if
+ and only if the charset-collation is the same */
+
+ if (dtype_get_charset_coll(type1->prtype)
+ == dtype_get_charset_coll(type2->prtype)) {
+ return(TRUE);
+ }
+
+ return(FALSE);
}
+ if (dtype_is_binary_string_type(type1->mtype, type1->prtype)
+ && dtype_is_binary_string_type(type2->mtype, type2->prtype)) {
+
+ /* Both are binary string types: they can be compared */
+
+ return(TRUE);
+ }
+
if (type1->mtype != type2->mtype) {
return(FALSE);
@@ -128,11 +141,6 @@ cmp_types_are_equal(
return(FALSE);
}
- if (type1->mtype == DATA_BLOB && (type1->prtype & DATA_BINARY_TYPE)
- != (type2->prtype & DATA_BINARY_TYPE)) {
- return(FALSE);
- }
-
return(TRUE);
}
@@ -269,10 +277,12 @@ cmp_whole_field(
return(innobase_mysql_cmp(
(int)(type->prtype & DATA_MYSQL_TYPE_MASK),
+ (uint)dtype_get_charset_coll(type->prtype),
a, a_length, b, b_length));
default:
fprintf(stderr,
- "InnoDB: unknown type number %lu\n", data_type);
+ "InnoDB: unknown type number %lu\n",
+ (ulong) data_type);
ut_error;
}
@@ -321,7 +331,9 @@ cmp_data_data_slow(
if (cur_type->mtype >= DATA_FLOAT
|| (cur_type->mtype == DATA_BLOB
- && (cur_type->prtype & DATA_NONLATIN1))) {
+ && 0 == (cur_type->prtype & DATA_BINARY_TYPE)
+ && dtype_get_charset_coll(cur_type->prtype) !=
+ data_mysql_latin1_swedish_charset_coll)) {
return(cmp_whole_field(cur_type, data1, len1, data2, len2));
}
@@ -522,8 +534,10 @@ cmp_dtuple_rec_with_match(
}
if (cur_type->mtype >= DATA_FLOAT
- || (cur_type->mtype == DATA_BLOB
- && (cur_type->prtype & DATA_NONLATIN1))) {
+ || (cur_type->mtype == DATA_BLOB
+ && 0 == (cur_type->prtype & DATA_BINARY_TYPE)
+ && dtype_get_charset_coll(cur_type->prtype) !=
+ data_mysql_latin1_swedish_charset_coll)) {
ret = cmp_whole_field(cur_type,
dfield_get_data(dtuple_field), dtuple_f_len,
@@ -844,8 +858,10 @@ cmp_rec_rec_with_match(
}
if (cur_type->mtype >= DATA_FLOAT
- || (cur_type->mtype == DATA_BLOB
- && (cur_type->prtype & DATA_NONLATIN1))) {
+ || (cur_type->mtype == DATA_BLOB
+ && 0 == (cur_type->prtype & DATA_BINARY_TYPE)
+ && dtype_get_charset_coll(cur_type->prtype) !=
+ data_mysql_latin1_swedish_charset_coll)) {
ret = cmp_whole_field(cur_type,
rec1_b_ptr, rec1_f_len,
diff --git a/innobase/rem/rem0rec.c b/innobase/rem/rem0rec.c
index b9fa840d66d..1db89241dff 100644
--- a/innobase/rem/rem0rec.c
+++ b/innobase/rem/rem0rec.c
@@ -107,7 +107,7 @@ rec_get_nth_field(
if (n > 1024) {
fprintf(stderr, "Error: trying to access field %lu in rec\n",
- n);
+ (ulong) n);
ut_error;
}
@@ -474,7 +474,7 @@ rec_validate(
if ((n_fields == 0) || (n_fields > REC_MAX_N_FIELDS)) {
fprintf(stderr, "InnoDB: Error: record has %lu fields\n",
- n_fields);
+ (ulong) n_fields);
return(FALSE);
}
@@ -483,8 +483,8 @@ rec_validate(
if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) {
fprintf(stderr,
- "InnoDB: Error: record field %lu len %lu\n", i,
- len);
+ "InnoDB: Error: record field %lu len %lu\n", (ulong) i,
+ (ulong) len);
return(FALSE);
}
@@ -502,7 +502,8 @@ rec_validate(
if (len_sum != (ulint)(rec_get_end(rec) - rec)) {
fprintf(stderr,
"InnoDB: Error: record len should be %lu, len %lu\n",
- len_sum, (ulint)(rec_get_end(rec) - rec));
+ (ulong) len_sum,
+ (ulong) (rec_get_end(rec) - rec));
return(FALSE);
}
@@ -531,14 +532,14 @@ rec_print(
fprintf(file, "PHYSICAL RECORD: n_fields %lu;"
" 1-byte offs %s; info bits %lu\n",
- n, rec_get_1byte_offs_flag(rec) ? "TRUE" : "FALSE",
- rec_get_info_bits(rec));
+ (ulong) n, rec_get_1byte_offs_flag(rec) ? "TRUE" : "FALSE",
+ (ulong) rec_get_info_bits(rec));
for (i = 0; i < n; i++) {
data = rec_get_nth_field(rec, i, &len);
- fprintf(file, " %lu:", i);
+ fprintf(file, " %lu:", (ulong) i);
if (len != UNIV_SQL_NULL) {
if (len <= 30) {
@@ -551,7 +552,7 @@ rec_print(
}
} else {
fprintf(file, " SQL NULL, size %lu ",
- rec_get_nth_field_size(rec, i));
+ (ulong) rec_get_nth_field_size(rec, i));
}
putc(';', file);