Commit d9fbdff6 authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi

Merge

parents 536702f4 ea6b5e11
...@@ -27,6 +27,8 @@ Created 1/8/1996 Heikki Tuuri ...@@ -27,6 +27,8 @@ Created 1/8/1996 Heikki Tuuri
#include "que0que.h" #include "que0que.h"
#include "rem0cmp.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 */ dict_sys_t* dict_sys = NULL; /* the dictionary system */
rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve
...@@ -196,7 +198,28 @@ and unique key errors */ ...@@ -196,7 +198,28 @@ and unique key errors */
FILE* dict_foreign_err_file = NULL; FILE* dict_foreign_err_file = NULL;
mutex_t dict_foreign_err_mutex; /* mutex protecting the foreign mutex_t dict_foreign_err_mutex; /* mutex protecting the foreign
and unique error buffers */ 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. */ Checks if the database name in two table names is the same. */
...@@ -2324,7 +2347,7 @@ dict_accept( ...@@ -2324,7 +2347,7 @@ dict_accept(
*success = FALSE; *success = FALSE;
while (isspace(*ptr)) { while (dict_isspace(*ptr)) {
ptr++; ptr++;
} }
...@@ -2369,7 +2392,7 @@ dict_scan_id( ...@@ -2369,7 +2392,7 @@ dict_scan_id(
*id = NULL; *id = NULL;
while (isspace(*ptr)) { while (dict_isspace(*ptr)) {
ptr++; ptr++;
} }
...@@ -2400,7 +2423,7 @@ dict_scan_id( ...@@ -2400,7 +2423,7 @@ dict_scan_id(
len++; len++;
} }
} else { } else {
while (!isspace(*ptr) && *ptr != '(' && *ptr != ')' while (!dict_isspace(*ptr) && *ptr != '(' && *ptr != ')'
&& (accept_also_dot || *ptr != '.') && (accept_also_dot || *ptr != '.')
&& *ptr != ',' && *ptr != '\0') { && *ptr != ',' && *ptr != '\0') {
...@@ -2904,11 +2927,11 @@ loop: ...@@ -2904,11 +2927,11 @@ loop:
ut_a(success); ut_a(success);
if (!isspace(*ptr) && *ptr != '"' && *ptr != '`') { if (!dict_isspace(*ptr) && *ptr != '"' && *ptr != '`') {
goto loop; goto loop;
} }
while (isspace(*ptr)) { while (dict_isspace(*ptr)) {
ptr++; ptr++;
} }
...@@ -2934,7 +2957,7 @@ loop: ...@@ -2934,7 +2957,7 @@ loop:
ptr = dict_accept(ptr, "FOREIGN", &success); ptr = dict_accept(ptr, "FOREIGN", &success);
if (!isspace(*ptr)) { if (!dict_isspace(*ptr)) {
goto loop; goto loop;
} }
...@@ -3022,7 +3045,7 @@ col_loop1: ...@@ -3022,7 +3045,7 @@ col_loop1:
} }
ptr = dict_accept(ptr, "REFERENCES", &success); 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, dict_foreign_report_syntax_err(name, start_of_latest_foreign,
ptr); ptr);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
...@@ -3403,7 +3426,7 @@ loop: ...@@ -3403,7 +3426,7 @@ loop:
ptr = dict_accept(ptr, "DROP", &success); ptr = dict_accept(ptr, "DROP", &success);
if (!isspace(*ptr)) { if (!dict_isspace(*ptr)) {
goto loop; goto loop;
} }
......
...@@ -26,6 +26,8 @@ Created 1/8/1996 Heikki Tuuri ...@@ -26,6 +26,8 @@ Created 1/8/1996 Heikki Tuuri
#include "ut0byte.h" #include "ut0byte.h"
#include "trx0types.h" #include "trx0types.h"
extern ibool dict_char_0xA0_is_space;
/************************************************************************ /************************************************************************
Get the database name length in a table name. */ Get the database name length in a table name. */
......
...@@ -2036,6 +2036,7 @@ bool flush_error_log() ...@@ -2036,6 +2036,7 @@ bool flush_error_log()
char err_renamed[FN_REFLEN], *end; char err_renamed[FN_REFLEN], *end;
end= strmake(err_renamed,log_error_file,FN_REFLEN-4); end= strmake(err_renamed,log_error_file,FN_REFLEN-4);
strmov(end, "-old"); strmov(end, "-old");
VOID(pthread_mutex_lock(&LOCK_error_log));
#ifdef __WIN__ #ifdef __WIN__
char err_temp[FN_REFLEN+4]; char err_temp[FN_REFLEN+4];
/* /*
...@@ -2043,7 +2044,7 @@ bool flush_error_log() ...@@ -2043,7 +2044,7 @@ bool flush_error_log()
the current error file. the current error file.
*/ */
strmov(strmov(err_temp, err_renamed),"-tmp"); strmov(strmov(err_temp, err_renamed),"-tmp");
(void) my_delete(err_temp, MYF(0)); (void) my_delete(err_temp, MYF(0));
if (freopen(err_temp,"a+",stdout)) if (freopen(err_temp,"a+",stdout))
{ {
freopen(err_temp,"a+",stderr); freopen(err_temp,"a+",stderr);
...@@ -2056,20 +2057,21 @@ bool flush_error_log() ...@@ -2056,20 +2057,21 @@ bool flush_error_log()
if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0) if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
{ {
while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0) while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0)
my_fwrite(stderr, (byte*) buf, (uint) strlen(buf),MYF(0)); my_fwrite(stderr, (byte*) buf, bytes, MYF(0));
my_close(fd, MYF(0)); my_close(fd, MYF(0));
} }
(void) my_delete(err_temp, MYF(0)); (void) my_delete(err_temp, MYF(0));
} }
else else
result= 1; result= 1;
#else #else
my_rename(log_error_file,err_renamed,MYF(0)); my_rename(log_error_file,err_renamed,MYF(0));
if (freopen(log_error_file,"a+",stdout)) if (freopen(log_error_file,"a+",stdout))
freopen(log_error_file,"a+",stderr); freopen(log_error_file,"a+",stderr);
else else
result= 1; result= 1;
#endif #endif
VOID(pthread_mutex_unlock(&LOCK_error_log));
} }
return result; return result;
} }
......
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