summaryrefslogtreecommitdiff
path: root/sql/sql_truncate.cc
diff options
context:
space:
mode:
authorSeppo Jaakola <seppo.jaakola@codership.com>2012-09-17 12:31:38 +0300
committerSeppo Jaakola <seppo.jaakola@codership.com>2012-09-17 12:31:38 +0300
commit7b791250a1d2f293da83533fc332fd1d80f665a1 (patch)
tree85f8b21478422a123a8b128ffd471b98a53150c4 /sql/sql_truncate.cc
parentf4862acfc389864f99100f66abe905c1f5be9e80 (diff)
parent6f94b5c76d51e655d36198d177972caa18089e31 (diff)
downloadmariadb-git-7b791250a1d2f293da83533fc332fd1d80f665a1.tar.gz
References lp:1051808 - merged with lp:maria/5.5
bzr merge lp:maria/5.5 ... Text conflict in CMakeLists.txt Text conflict in sql/mysqld.cc Text conflict in sql/sql_class.h Text conflict in sql/sql_truncate.cc 4 conflicts encountered.
Diffstat (limited to 'sql/sql_truncate.cc')
-rw-r--r--sql/sql_truncate.cc41
1 files changed, 23 insertions, 18 deletions
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index d8c14f0dec8..12ebe7e636a 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -27,6 +27,7 @@
#ifdef WITH_WSREP
#include "wsrep_mysqld.h"
#endif /* WITH_WSREP */
+#include "sql_show.h"
/**
@@ -38,7 +39,8 @@
@return TRUE on failure, FALSE otherwise.
*/
-static bool fk_info_append_fields(String *str, List<LEX_STRING> *fields)
+static bool fk_info_append_fields(THD *thd, String *str,
+ List<LEX_STRING> *fields)
{
bool res= FALSE;
LEX_STRING *field;
@@ -46,9 +48,8 @@ static bool fk_info_append_fields(String *str, List<LEX_STRING> *fields)
while ((field= it++))
{
- res|= str->append("`");
- res|= str->append(field);
- res|= str->append("`, ");
+ res|= append_identifier(thd, str, field->str, field->length);
+ res|= str->append(", ");
}
str->chop();
@@ -79,20 +80,24 @@ static const char *fk_info_str(THD *thd, FOREIGN_KEY_INFO *fk_info)
`db`.`tbl`, CONSTRAINT `id` FOREIGN KEY (`fk`) REFERENCES `db`.`tbl` (`fk`)
*/
- res|= str.append('`');
- res|= str.append(fk_info->foreign_db);
- res|= str.append("`.`");
- res|= str.append(fk_info->foreign_table);
- res|= str.append("`, CONSTRAINT `");
- res|= str.append(fk_info->foreign_id);
- res|= str.append("` FOREIGN KEY (");
- res|= fk_info_append_fields(&str, &fk_info->foreign_fields);
- res|= str.append(") REFERENCES `");
- res|= str.append(fk_info->referenced_db);
- res|= str.append("`.`");
- res|= str.append(fk_info->referenced_table);
- res|= str.append("` (");
- res|= fk_info_append_fields(&str, &fk_info->referenced_fields);
+ res|= append_identifier(thd, &str, fk_info->foreign_db->str,
+ fk_info->foreign_db->length);
+ res|= str.append(".");
+ res|= append_identifier(thd, &str, fk_info->foreign_table->str,
+ fk_info->foreign_table->length);
+ res|= str.append(", CONSTRAINT ");
+ res|= append_identifier(thd, &str, fk_info->foreign_id->str,
+ fk_info->foreign_id->length);
+ res|= str.append(" FOREIGN KEY (");
+ res|= fk_info_append_fields(thd, &str, &fk_info->foreign_fields);
+ res|= str.append(") REFERENCES ");
+ res|= append_identifier(thd, &str, fk_info->referenced_db->str,
+ fk_info->referenced_db->length);
+ res|= str.append(".");
+ res|= append_identifier(thd, &str, fk_info->referenced_table->str,
+ fk_info->referenced_table->length);
+ res|= str.append(" (");
+ res|= fk_info_append_fields(thd, &str, &fk_info->referenced_fields);
res|= str.append(')');
return res ? NULL : thd->strmake(str.ptr(), str.length());