summaryrefslogtreecommitdiff
path: root/sql/sql_insert.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
commit5f003eca000167edc3601168029a7d86468e52a8 (patch)
tree4375fa1c0245bcb611e14ff982c80e6952f928e9 /sql/sql_insert.cc
parent600aa420d6bb17a2af779de11926ae1d3c122fd8 (diff)
downloadmariadb-git-5f003eca000167edc3601168029a7d86468e52a8.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_insert.cc')
-rw-r--r--sql/sql_insert.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 4cd456829ba..7e94e7e7df3 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -3426,16 +3426,16 @@ int select_create::write_to_binlog(bool is_trans, int errcode)
if (thd->lex->create_select_in_comment)
query.append(STRING_WITH_LEN("/*! "));
if (thd->lex->ignore)
- query.append(STRING_WITH_LEN("INSERT IGNORE INTO `"));
+ query.append(STRING_WITH_LEN("INSERT IGNORE INTO "));
else if (thd->lex->duplicates == DUP_REPLACE)
- query.append(STRING_WITH_LEN("REPLACE INTO `"));
+ query.append(STRING_WITH_LEN("REPLACE INTO "));
else
- query.append(STRING_WITH_LEN("INSERT INTO `"));
+ query.append(STRING_WITH_LEN("INSERT INTO "));
- query.append(create_table->db, db_len);
- query.append(STRING_WITH_LEN("`.`"));
- query.append(create_info->alias, table_len);
- query.append(STRING_WITH_LEN("` "));
+ append_identifier(thd, &query, create_table->db, db_len);
+ query.append(STRING_WITH_LEN("."));
+ append_identifier(thd, &query, create_info->alias, table_len );
+ query.append(STRING_WITH_LEN(" "));
/*
The insert items.
@@ -3447,9 +3447,8 @@ int select_create::write_to_binlog(bool is_trans, int errcode)
if (f != field)
query.append(STRING_WITH_LEN(","));
- query.append(STRING_WITH_LEN("`"));
- query.append((*f)->field_name, strlen((*f)->field_name));
- query.append(STRING_WITH_LEN("`"));
+ append_identifier(thd, &query, (*f)->field_name,
+ strlen((*f)->field_name));
}
query.append(STRING_WITH_LEN(") "));