diff options
author | unknown <marko@hundin.mysql.fi> | 2004-10-04 16:24:37 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2004-10-04 16:24:37 +0300 |
commit | a31b8f24e447a517dc90a8da51f4c4d743b0c00f (patch) | |
tree | 3fa2831fe4d592451994e2ed802ca0edb3aba095 /innobase/dict | |
parent | fcf273821a156693449c4d3e9e6e0ca19e36ef9f (diff) | |
download | mariadb-git-a31b8f24e447a517dc90a8da51f4c4d743b0c00f.tar.gz |
InnoDB: make ALTER TABLE to work on table names containing '#' (Bug #5856)
innobase/dict/dict0dict.c:
dict_strip_comments(): do not look for comments within quotes (Bug #5856)
innobase/row/row0mysql.c:
row_drop_table_for_mysql(): Remove a memory leak
Diffstat (limited to 'innobase/dict')
-rw-r--r-- | innobase/dict/dict0dict.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 61bf3fae137..4340934ab3d 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -2500,7 +2500,9 @@ dict_strip_comments( char* str; char* sptr; char* ptr; - + /* unclosed quote character (0 if none) */ + char quote = 0; + str = mem_alloc(strlen(sql_string) + 1); sptr = sql_string; @@ -2515,8 +2517,18 @@ scan_more: return(str); } - - if (*sptr == '#' + + if (*sptr == quote) { + /* Closing quote character: do not look for + starting quote or comments. */ + quote = 0; + } else if (quote) { + /* Within quotes: do not look for + starting quotes or comments. */ + } else if (*sptr == '"' || *sptr == '`') { + /* Starting quote: remember the quote character. */ + quote = *sptr; + } else if (*sptr == '#' || (0 == memcmp("-- ", sptr, 3))) { for (;;) { /* In Unix a newline is 0x0A while in Windows @@ -2531,9 +2543,7 @@ scan_more: sptr++; } - } - - if (*sptr == '/' && *(sptr + 1) == '*') { + } else if (!quote && *sptr == '/' && *(sptr + 1) == '*') { for (;;) { if (*sptr == '*' && *(sptr + 1) == '/') { |