summaryrefslogtreecommitdiff
path: root/innobase/rem/rem0cmp.c
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2004-02-19 20:07:02 +0200
committerunknown <heikki@hundin.mysql.fi>2004-02-19 20:07:02 +0200
commitbe8979436aead2e488ba9f50f4c0de03384ebf37 (patch)
tree75425c7281891c9cd564869a24f909c5cf1f8a18 /innobase/rem/rem0cmp.c
parentc6ea718bba2f8dc4c4a94ae258ba29365b4be448 (diff)
downloadmariadb-git-be8979436aead2e488ba9f50f4c0de03384ebf37.tar.gz
Many files:
Multiple charset support for InnoDB; note that if you create tables and the default charset-collation is not latin1_swedish_ci, then you cannot use those tables if you downgrade to 4.0 again sql/ha_innodb.cc: Multiple charset support for InnoDB; note that if you create tables and the default charset-collation is not latin1_swedish_ci, then you cannot use those tables if you downgrade to 4.0 again innobase/data/data0type.c: Multiple charset support for InnoDB; note that if you create tables and the default charset-collation is not latin1_swedish_ci, then you cannot use those tables if you downgrade to 4.0 again innobase/dict/dict0crea.c: Multiple charset support for InnoDB; note that if you create tables and the default charset-collation is not latin1_swedish_ci, then you cannot use those tables if you downgrade to 4.0 again innobase/dict/dict0load.c: Multiple charset support for InnoDB; note that if you create tables and the default charset-collation is not latin1_swedish_ci, then you cannot use those tables if you downgrade to 4.0 again innobase/include/data0type.h: Multiple charset support for InnoDB; note that if you create tables and the default charset-collation is not latin1_swedish_ci, then you cannot use those tables if you downgrade to 4.0 again innobase/include/data0type.ic: Multiple charset support for InnoDB; note that if you create tables and the default charset-collation is not latin1_swedish_ci, then you cannot use those tables if you downgrade to 4.0 again innobase/rem/rem0cmp.c: Multiple charset support for InnoDB; note that if you create tables and the default charset-collation is not latin1_swedish_ci, then you cannot use those tables if you downgrade to 4.0 again
Diffstat (limited to 'innobase/rem/rem0cmp.c')
-rw-r--r--innobase/rem/rem0cmp.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/innobase/rem/rem0cmp.c b/innobase/rem/rem0cmp.c
index abfba3a31c9..b6f32c83b35 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! */
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,6 +277,7 @@ 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,