summaryrefslogtreecommitdiff
path: root/innobase/dict
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-12-31 00:50:30 +0200
committerunknown <monty@mysql.com>2004-12-31 00:50:30 +0200
commit12a215b0833d9aa688ba16fe56eb3411a83e7d4f (patch)
treed4dfebc9b9c93790a9be3f9e6807f3923a6b3d3e /innobase/dict
parentcdf70f2ede108267ce492abada82ca753f269e25 (diff)
parent2e8d13c73ec986dde580c9c840f421af4279611a (diff)
downloadmariadb-git-12a215b0833d9aa688ba16fe56eb3411a83e7d4f.tar.gz
Merge with global tree
BitKeeper/etc/logging_ok: auto-union client/mysqltest.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/include/dict0dict.h: Auto merged libmysql/errmsg.c: Auto merged myisam/mi_open.c: Auto merged myisam/mi_write.c: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/merge.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/t/derived.test: Auto merged mysql-test/t/merge.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/system_mysql_db_fix.test: Auto merged scripts/mysql_install_db.sh: Auto merged sql/ha_innodb.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sp.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged sql/tztime.h: Auto merged
Diffstat (limited to 'innobase/dict')
-rw-r--r--innobase/dict/dict0dict.c28
-rw-r--r--innobase/dict/dict0load.c17
2 files changed, 43 insertions, 2 deletions
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index f8906a77abd..d5e0a46fd39 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -2391,6 +2391,8 @@ dict_scan_id(
ulint len = 0;
const char* s;
char* d;
+ ulint id_len;
+ byte* b;
*id = NULL;
@@ -2452,6 +2454,28 @@ dict_scan_id(
*id = s;
}
+ if (heap && !quote) {
+ /* EMS MySQL Manager sometimes adds characters 0xA0 (in
+ latin1, a 'non-breakable space') to the end of a table name.
+ But isspace(0xA0) is not true, which confuses our foreign key
+ parser. After the UTF-8 conversion in ha_innodb.cc, bytes 0xC2
+ and 0xA0 are at the end of the string.
+
+ TODO: we should lex the string using thd->charset_info, and
+ my_isspace(). Only after that, convert id names to UTF-8. */
+
+ b = (byte*)(*id);
+ id_len = strlen(b);
+
+ if (id_len >= 3 && b[id_len - 1] == 0xA0
+ && b[id_len - 2] == 0xC2) {
+
+ /* Strip the 2 last bytes */
+
+ b[id_len - 2] = '\0';
+ }
+ }
+
return(ptr);
}
@@ -2506,7 +2530,7 @@ dict_scan_col(
}
/*************************************************************************
-Scans the referenced table name from an SQL string. */
+Scans a table name from an SQL string. */
static
const char*
dict_scan_table_name(
@@ -2517,7 +2541,7 @@ dict_scan_table_name(
const char* name, /* in: foreign key table name */
ibool* success,/* out: TRUE if ok name found */
mem_heap_t* heap, /* in: heap where to allocate the id */
- const char** ref_name)/* out,own: the referenced table name;
+ const char** ref_name)/* out,own: the table name;
NULL if no name was scannable */
{
const char* database_name = NULL;
diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c
index c80f8346abf..12ceba38815 100644
--- a/innobase/dict/dict0load.c
+++ b/innobase/dict/dict0load.c
@@ -8,6 +8,7 @@ Created 4/24/1996 Heikki Tuuri
*******************************************************/
#include "dict0load.h"
+#include "mysql_version.h"
#ifdef UNIV_NONINL
#include "dict0load.ic"
@@ -766,6 +767,22 @@ dict_load_table(
return(NULL);
}
+#if MYSQL_VERSION_ID < 50003
+ /* Starting from MySQL 5.0.3, the high-order bit of MIX_LEN is the
+ "compact format" flag. */
+ field = rec_get_nth_field(rec, 7, &len);
+ if (mach_read_from_1(field) & 0x80) {
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
+ mem_heap_free(heap);
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: table %s is in the new compact format\n"
+ "InnoDB: of MySQL 5.0.3 or later\n", name);
+ return(NULL);
+ }
+#endif /* MYSQL_VERSION_ID < 50300 */
+
ut_a(0 == ut_strcmp("SPACE",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 9))->name));