summaryrefslogtreecommitdiff
path: root/innobase/dict/dict0dict.c
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2004-12-10 17:12:47 +0200
committerunknown <heikki@hundin.mysql.fi>2004-12-10 17:12:47 +0200
commitc486461e4430ced16300cc86c007a8d1d980af93 (patch)
treee1d78d4226b32471918cc97633672f886e0c6970 /innobase/dict/dict0dict.c
parentd5da66e83c84aa74e1548fd3f8205b98adb02a24 (diff)
downloadmariadb-git-c486461e4430ced16300cc86c007a8d1d980af93.tar.gz
dict0dict.h, dict0dict.c, ha_innodb.cc:
Fix for the 0xA0 character problem in the InnoDB FOREIGN KEY parser: if my_isspace() treats 0xA0 as space, then let InnoDB do the same; this might break some multi-byte charset id's, though for big5, ujis, sjis this seems not to change the current behavior (I checked the tables in /share/charsets); this fix must NOT be merged to 4.1 because in 4.1 everything is in UTF-8 sql/ha_innodb.cc: Fix for the 0xA0 character problem in the InnoDB FOREIGN KEY parser: if my_isspace() treats 0xA0 as space, then let InnoDB do the same; this might break some multi-byte charset id's, though for big5, ujis, sjis this seems not to change the current behavior (I checked the tables in /share/charsets); this fix must NOT be merged to 4.1 because in 4.1 everything is in UTF-8 innobase/dict/dict0dict.c: Fix for the 0xA0 character problem in the InnoDB FOREIGN KEY parser: if my_isspace() treats 0xA0 as space, then let InnoDB do the same; this might break some multi-byte charset id's, though for big5, ujis, sjis this seems not to change the current behavior (I checked the tables in /share/charsets); this fix must NOT be merged to 4.1 because in 4.1 everything is in UTF-8 innobase/include/dict0dict.h: Fix for the 0xA0 character problem in the InnoDB FOREIGN KEY parser: if my_isspace() treats 0xA0 as space, then let InnoDB do the same; this might break some multi-byte charset id's, though for big5, ujis, sjis this seems not to change the current behavior (I checked the tables in /share/charsets); this fix must NOT be merged to 4.1 because in 4.1 everything is in UTF-8
Diffstat (limited to 'innobase/dict/dict0dict.c')
-rw-r--r--innobase/dict/dict0dict.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index aa5bab210ef..b4be9108659 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -27,6 +27,8 @@ Created 1/8/1996 Heikki Tuuri
#include "que0que.h"
#include "rem0cmp.h"
+ibool dict_char_0xA0_is_space = FALSE; /* A special fix for 4.0 */
+
dict_sys_t* dict_sys = NULL; /* the dictionary system */
rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve
@@ -172,7 +174,28 @@ and unique key errors */
FILE* dict_foreign_err_file = NULL;
mutex_t dict_foreign_err_mutex; /* mutex protecting the foreign
and unique error buffers */
-
+/************************************************************************
+Checks if a byte is considered space in the current charset of MySQL.
+TODO: find out if this works correctly in multibyte charsets. */
+static
+ibool
+dict_isspace(
+/*=========*/
+ /* out: TRUE if considered space */
+ char c) /* in: one-byte character */
+{
+ if (isspace(c)) {
+
+ return(TRUE);
+ }
+
+ if (dict_char_0xA0_is_space && (byte)c == (byte)0xA0) {
+
+ return(TRUE);
+ }
+
+ return(FALSE);
+}
/************************************************************************
Checks if the database name in two table names is the same. */
@@ -2198,7 +2221,7 @@ dict_accept(
*success = FALSE;
- while (isspace(*ptr)) {
+ while (dict_isspace(*ptr)) {
ptr++;
}
@@ -2241,7 +2264,7 @@ dict_scan_id(
*id = NULL;
- while (isspace(*ptr)) {
+ while (dict_isspace(*ptr)) {
ptr++;
}
@@ -2272,7 +2295,7 @@ dict_scan_id(
len++;
}
} else {
- while (!isspace(*ptr) && *ptr != '(' && *ptr != ')'
+ while (!dict_isspace(*ptr) && *ptr != '(' && *ptr != ')'
&& (accept_also_dot || *ptr != '.')
&& *ptr != ',' && *ptr != '\0') {
@@ -2765,11 +2788,11 @@ loop:
ut_a(success);
- if (!isspace(*ptr) && *ptr != '"' && *ptr != '`') {
+ if (!dict_isspace(*ptr) && *ptr != '"' && *ptr != '`') {
goto loop;
}
- while (isspace(*ptr)) {
+ while (dict_isspace(*ptr)) {
ptr++;
}
@@ -2795,7 +2818,7 @@ loop:
ptr = dict_accept(ptr, "FOREIGN", &success);
- if (!isspace(*ptr)) {
+ if (!dict_isspace(*ptr)) {
goto loop;
}
@@ -2883,7 +2906,7 @@ col_loop1:
}
ptr = dict_accept(ptr, "REFERENCES", &success);
- if (!success || !isspace(*ptr)) {
+ if (!success || !dict_isspace(*ptr)) {
dict_foreign_report_syntax_err(name, start_of_latest_foreign,
ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -3261,7 +3284,7 @@ loop:
ptr = dict_accept(ptr, "DROP", &success);
- if (!isspace(*ptr)) {
+ if (!dict_isspace(*ptr)) {
goto loop;
}