Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-16 11:44:31+05:00, ramil@stripped +3 -0
Fix for bug #30654: mysqlcheck fails during upgrade of tables whose
names include backticks or blank
Problem: mysqlcheck doesn't escape backtick characters in the table names.
Fix: escape them.
client/mysqlcheck.c@stripped, 2007-10-16 11:44:30+05:00, ramil@stripped +14 -7
Fix for bug #30654: mysqlcheck fails during upgrade of tables whose
names include backticks or blank
- escape backtick characters in the table names.
mysql-test/r/mysqlcheck.result@stripped, 2007-10-16 11:44:30+05:00, ramil@stripped +6 -1
Fix for bug #30654: mysqlcheck fails during upgrade of tables whose
names include backticks or blank
- test result.
mysql-test/t/mysqlcheck.test@stripped, 2007-10-16 11:44:30+05:00, ramil@stripped +10 -1
Fix for bug #30654: mysqlcheck fails during upgrade of tables whose
names include backticks or blank
- test case.
diff -Nrup a/client/mysqlcheck.c b/client/mysqlcheck.c
--- a/client/mysqlcheck.c 2007-09-13 19:19:43 +05:00
+++ b/client/mysqlcheck.c 2007-10-16 11:44:30 +05:00
@@ -441,16 +441,23 @@ static int process_selected_tables(char
static char *fix_table_name(char *dest, char *src)
{
- char *db_sep;
-
*dest++= '`';
- if ((db_sep= strchr(src, '.')))
+ for (; *src; src++)
{
- dest= strmake(dest, src, (uint) (db_sep - src));
- dest= strmov(dest, "`.`");
- src= db_sep + 1;
+ switch (*src) {
+ case '.': /* add backticks around '.' */
+ *dest++= '`';
+ *dest++= '.';
+ *dest++= '`';
+ break;
+ case '`': /* escape backtick character */
+ *dest++= '`';
+ /* fall through */
+ default:
+ *dest++= *src;
+ }
}
- dest= strxmov(dest, src, "`", NullS);
+ *dest++= '`';
return dest;
}
diff -Nrup a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
--- a/mysql-test/r/mysqlcheck.result 2006-12-15 02:51:29 +04:00
+++ b/mysql-test/r/mysqlcheck.result 2007-10-16 11:44:30 +05:00
@@ -1,4 +1,4 @@
-DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
drop view if exists v1;
drop database if exists client_test_db;
mysql.columns_priv OK
@@ -41,4 +41,9 @@ test.t1
test.t1 OK
drop view v1;
drop table t1;
+create table `t``1`(a int);
+create table `t 1`(a int);
+test.t 1 OK
+test.t`1 OK
+drop table `t``1`, `t 1`;
End of 5.0 tests
diff -Nrup a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
--- a/mysql-test/t/mysqlcheck.test 2006-12-15 02:51:29 +04:00
+++ b/mysql-test/t/mysqlcheck.test 2007-10-16 11:44:30 +05:00
@@ -2,7 +2,7 @@
#
--disable_warnings
-DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
drop view if exists v1;
drop database if exists client_test_db;
--enable_warnings
@@ -30,5 +30,14 @@ create view v1 as select * from t1;
--exec $MYSQL_CHECK --all-in-1 --analyze --optimize --databases test
drop view v1;
drop table t1;
+
+#
+# Bug #30654: mysqlcheck fails during upgrade of tables whose names include backticks
+#
+create table `t``1`(a int);
+create table `t 1`(a int);
+--replace_result 'Table is already up to date' OK
+--exec $MYSQL_CHECK --databases test
+drop table `t``1`, `t 1`;
--echo End of 5.0 tests
| Thread |
|---|
| • bk commit into 5.0 tree (ramil:1.2536) BUG#30654 | ramil | 16 Oct |