Commit 46a07dbc authored by unknown's avatar unknown

rem0cmp.c, data0type.c, data0type.ic, data0type.h, ha_innodb.cc:

  Remove the now redundant flag DATA_NONLATIN1; better comments


sql/ha_innodb.cc:
  Remove the now redundant flag DATA_NONLATIN1; better comments
innobase/include/data0type.h:
  Remove the now redundant flag DATA_NONLATIN1; better comments
innobase/include/data0type.ic:
  Remove the now redundant flag DATA_NONLATIN1; better comments
innobase/data/data0type.c:
  Remove the now redundant flag DATA_NONLATIN1; better comments
innobase/rem/rem0cmp.c:
  Remove the now redundant flag DATA_NONLATIN1; better comments
parent 6226e45b
......@@ -18,8 +18,9 @@ column definitions, or records in the insert buffer, we use this
charset-collation code for them. */
ulint data_mysql_default_charset_coll = 99999999;
ulint data_mysql_latin1_swedish_charset_coll = 99999999;
dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0};
dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0};
dtype_t* dtype_binary = &dtype_binary_val;
/*************************************************************************
......
......@@ -12,6 +12,7 @@ Created 1/16/1996 Heikki Tuuri
#include "univ.i"
extern ulint data_mysql_default_charset_coll;
extern ulint data_mysql_latin1_swedish_charset_coll;
/* SQL data type struct */
typedef struct dtype_struct dtype_t;
......@@ -30,8 +31,8 @@ extern dtype_t* dtype_binary;
#define DATA_BINARY 4 /* binary string */
#define DATA_BLOB 5 /* binary large object, or a TEXT type;
if prtype & DATA_BINARY_TYPE == 0, then this is
actually a TEXT column; see also below about
the flag DATA_NONLATIN1 */
actually a TEXT column (or a BLOB created
with < 4.0.14) */
#define DATA_INT 6 /* integer: can be any size 1 - 8 bytes */
#define DATA_SYS_CHILD 7 /* address of the child page in node pointer */
#define DATA_SYS 8 /* system column */
......@@ -59,7 +60,7 @@ Tables created by a MySQL user have the following convention:
code (not applicable for system columns).
- In the second least significant byte we OR flags DATA_NOT_NULL,
DATA_UNSIGNED, DATA_BINARY_TYPE, DATA_NONLATIN1.
DATA_UNSIGNED, DATA_BINARY_TYPE.
- In the third least significant byte of the precise type of string types we
store the MySQL charset-collation code. In DATA_BLOB columns created with
......@@ -73,6 +74,23 @@ installation. If the stored charset code is 0 in the system table SYS_COLUMNS
of InnoDB, that means that the default charset of this MySQL installation
should be used.
When loading a table definition from the system tables to the InnoDB data
dictionary cache in main memory, InnoDB versions >= 4.1.2 and >= 5.0.1 check
if the stored charset-collation is 0, and if that is the case and the type is
a non-binary string, replace that 0 by the default charset-collation code of
this MySQL installation. In short, in old tables, the charset-collation code
in the system tables on disk can be 0, but in in-memory data structures
(dtype_t), the charset-collation code is always != 0 for non-binary string
types.
In new tables, in binary string types, the charset-collation code is the
MySQL code for the 'binary charset', that is, != 0.
For binary string types and for DATA_CHAR, DATA_VARCHAR, and for those
DATA_BLOB which are binary or have the charset-collation latin1_swedish_ci,
InnoDB performs all comparisons internally, without resorting to the MySQL
comparison functions. This is to save CPU time.
InnoDB's own internal system tables have different precise types for their
columns, and for them the precise type is usually not used at all.
*/
......@@ -112,14 +130,10 @@ be less than 256 */
string, this is ORed to the precise type:
this only holds for tables created with
>= MySQL-4.0.14 */
#define DATA_NONLATIN1 2048 /* If the data type is DATA_BLOB with
the prtype & DATA_BINARY_TYPE == 0, that is,
TEXT, then in versions 4.0.14 - 4.0.xx this
flag is set to 1, if the charset is not
latin1. In version 4.1.1 this was set
to 1 for all TEXT columns. In versions >= 4.1.2
this is set to 1 if the charset-collation of a
TEXT column is not latin1_swedish_ci. */
/* #define DATA_NONLATIN1 2048 This is a relic from < 4.1.2 and < 5.0.1.
In earlier versions this was set for some
BLOB columns.
*/
/*-------------------------------------------*/
/* This many bytes we need to store the type information affecting the
......@@ -210,7 +224,7 @@ ulint
dtype_form_prtype(
/*==============*/
ulint old_prtype, /* in: the MySQL type code and the flags
DATA_NONLATIN1 etc. */
DATA_BINARY_TYPE etc. */
ulint charset_coll); /* in: MySQL charset-collation code */
/*************************************************************************
Gets the type length. */
......
......@@ -143,7 +143,7 @@ dtype_get_charset_coll(
/*===================*/
ulint prtype) /* in: precise data type */
{
return((prtype >> 16) & 0xFF);
return((prtype >> 16) & 0xFFUL);
}
/*************************************************************************
......@@ -153,7 +153,7 @@ ulint
dtype_form_prtype(
/*==============*/
ulint old_prtype, /* in: the MySQL type code and the flags
DATA_NONLATIN1 etc. */
DATA_BINARY_TYPE etc. */
ulint charset_coll) /* in: MySQL charset-collation code */
{
ut_a(old_prtype < 256 * 256);
......@@ -237,9 +237,10 @@ dtype_new_store_for_order_and_null_size(
buf[0] = buf[0] | 128;
}
if (type->prtype & DATA_NONLATIN1) {
buf[0] = buf[0] | 64;
}
/* In versions < 4.1.2 we had: if (type->prtype & DATA_NONLATIN1) {
buf[0] = buf[0] | 64;
}
*/
buf[1] = (byte)(type->prtype & 0xFFUL);
......@@ -271,10 +272,6 @@ dtype_read_for_order_and_null_size(
type->prtype = type->prtype | DATA_BINARY_TYPE;
}
if (buf[0] & 64) {
type->prtype = type->prtype | DATA_NONLATIN1;
}
type->len = mach_read_from_2(buf + 2);
type->prtype = dtype_form_prtype(type->prtype,
......@@ -303,10 +300,6 @@ dtype_new_read_for_order_and_null_size(
type->prtype = type->prtype | DATA_BINARY_TYPE;
}
if (buf[0] & 64) {
type->prtype = type->prtype | DATA_NONLATIN1;
}
type->len = mach_read_from_2(buf + 2);
mach_read_from_2(buf + 4);
......
......@@ -331,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));
}
......@@ -532,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,
......@@ -854,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,
......
......@@ -755,11 +755,6 @@ innobase_init(void)
srv_set_thread_priorities = TRUE;
srv_query_thread_priority = QUERY_PRIOR;
}
/* Store the default charset-collation number of this MySQL
installation */
data_mysql_default_charset_coll = (ulint)default_charset_info->number;
/* Set InnoDB initialization parameters according to the values
read from MySQL .cnf file */
......@@ -875,6 +870,14 @@ innobase_init(void)
srv_print_verbose_log = mysql_embedded ? 0 : 1;
/* Store the default charset-collation number of this MySQL
installation */
data_mysql_default_charset_coll = (ulint)default_charset_info->number;
data_mysql_latin1_swedish_charset_coll =
(ulint)my_charset_latin1.number;
/* Store the latin1_swedish_ci character ordering table to InnoDB. For
non-latin1_swedish_ci charsets we use the MySQL comparison functions,
and consequently we do not need to know the ordering internally in
......@@ -3260,7 +3263,6 @@ create_table_def(
ulint nulls_allowed;
ulint unsigned_type;
ulint binary_type;
ulint nonlatin1_type;
ulint charset_no;
ulint i;
......@@ -3290,17 +3292,8 @@ create_table_def(
unsigned_type = 0;
}
if (col_type == DATA_BLOB
&& strcmp(field->charset()->name,
"latin1_swedish_ci") != 0) {
nonlatin1_type = DATA_NONLATIN1;
} else {
nonlatin1_type = 0;
}
if (field->binary()) {
binary_type = DATA_BINARY_TYPE;
nonlatin1_type = 0;
} else {
binary_type = 0;
}
......@@ -3319,7 +3312,7 @@ create_table_def(
col_type, dtype_form_prtype(
(ulint)field->type()
| nulls_allowed | unsigned_type
| nonlatin1_type | binary_type,
| binary_type,
+ charset_no),
field->pack_length(), 0);
}
......
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