diff options
author | Rohit Kalhans <rohit.kalhans@oracle.com> | 2012-09-22 18:07:04 +0530 |
---|---|---|
committer | Rohit Kalhans <rohit.kalhans@oracle.com> | 2012-09-22 18:07:04 +0530 |
commit | 4802faad3f67e5950858c2eba04271d836c1edb1 (patch) | |
tree | e8c9feb9d583b378ecdda8db05f6871ea6cefdbd /sql/sql_truncate.cc | |
parent | 02ee112f9ab9d8451755df35a1c3edc9bb3fd75e (diff) | |
parent | 5530c5e38dbefac8e5d2c333c0f35ed9f73946a4 (diff) | |
download | mariadb-git-4802faad3f67e5950858c2eba04271d836c1edb1.tar.gz |
upmerge to bug#14548159
Diffstat (limited to 'sql/sql_truncate.cc')
-rw-r--r-- | sql/sql_truncate.cc | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 67ed608f114..2285131fade 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -24,6 +24,7 @@ #include "sql_acl.h" // DROP_ACL #include "sql_parse.h" // check_one_table_access() #include "sql_truncate.h" +#include "sql_show.h" //append_identifier() /** @@ -43,9 +44,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("`, "); + append_identifier(NULL, str, field->str, field->length); + res|= str->append(", "); } str->chop(); @@ -76,19 +76,23 @@ 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 ("); + append_identifier(NULL, &str, fk_info->foreign_db->str, + fk_info->foreign_db->length); + res|= str.append("."); + append_identifier(NULL, &str, fk_info->foreign_table->str, + fk_info->foreign_table->length); + res|= str.append(", CONSTRAINT "); + append_identifier(NULL, &str, fk_info->foreign_id->str, + fk_info->foreign_id->length); + 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|= str.append(") REFERENCES "); + append_identifier(NULL, &str, fk_info->referenced_db->str, + fk_info->referenced_db->length); + res|= str.append("."); + append_identifier(NULL, &str, fk_info->referenced_table->str, + fk_info->referenced_table->length); + res|= str.append(" ("); res|= fk_info_append_fields(&str, &fk_info->referenced_fields); res|= str.append(')'); |