summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorRohit Kalhans <rohit.kalhans@oracle.com>2012-09-22 17:50:51 +0530
committerRohit Kalhans <rohit.kalhans@oracle.com>2012-09-22 17:50:51 +0530
commit5530c5e38dbefac8e5d2c333c0f35ed9f73946a4 (patch)
tree4375fa1c0245bcb611e14ff982c80e6952f928e9 /sql/sql_table.cc
parentf820334bbfd0cc6effdab7e947bb095885566a70 (diff)
downloadmariadb-git-5530c5e38dbefac8e5d2c333c0f35ed9f73946a4.tar.gz
BUG#14548159: NUMEROUS CASES OF INCORRECT IDENTIFIER
QUOTING IN REPLICATION Problem: Misquoting or unquoted identifiers may lead to incorrect statements to be logged to the binary log. Fix: we use specialized functions to append quoted identifiers in the statements generated by the server.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 39eee62ee91..b8d57341e42 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1944,6 +1944,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for (table= tables; table; table= table->next_local)
{
char *db=table->db;
+ int db_len= table->db_length;
handlerton *table_type;
enum legacy_db_type frm_db_type= DB_TYPE_UNKNOWN;
@@ -1966,14 +1967,14 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
built_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS ");
}
- built_tmp_query.append("`");
if (thd->db == NULL || strcmp(db,thd->db) != 0)
{
- built_tmp_query.append(db);
- built_tmp_query.append("`.`");
+ append_identifier(thd, &built_tmp_query, db, db_len);
+ built_tmp_query.append(".");
}
- built_tmp_query.append(table->table_name);
- built_tmp_query.append("`,");
+ append_identifier(thd, &built_tmp_query, table->table_name,
+ strlen(table->table_name));
+ built_tmp_query.append(",");
}
continue;
@@ -1999,15 +2000,14 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
Don't write the database name if it is the current one (or if
thd->db is NULL).
*/
- built_query.append("`");
if (thd->db == NULL || strcmp(db,thd->db) != 0)
{
- built_query.append(db);
- built_query.append("`.`");
+ append_identifier(thd, &built_query, db, db_len);
+ built_query.append(".");
}
-
- built_query.append(table->table_name);
- built_query.append("`,");
+ append_identifier(thd, &built_query, table->table_name,
+ strlen(table->table_name));
+ built_query.append(",");
}
if (!drop_temporary)