summaryrefslogtreecommitdiff
path: root/storage/innobase/ut
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2015-12-14 14:34:32 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2015-12-14 22:10:37 +0200
commit99404c3437b35b5ee51578c2ea74209ccb9ba890 (patch)
tree7dc58eefe89b0d799589d2ca3d95a452e6e69916 /storage/innobase/ut
parent0db50be89349761d5677441f2d60ab52c23947f0 (diff)
downloadmariadb-git-99404c3437b35b5ee51578c2ea74209ccb9ba890.tar.gz
MDEV-9276: MySQL Bug #78754: FK definitions missing from SHOW CREATE TABLE in "innodb_read_only" mode
Diffstat (limited to 'storage/innobase/ut')
-rw-r--r--storage/innobase/ut/ut0ut.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index 68446cc85ef..2ffe18710e2 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -42,6 +42,7 @@ Created 5/11/1994 Heikki Tuuri
# include "trx0trx.h"
# include "ha_prototypes.h"
# include "mysql_com.h" /* NAME_LEN */
+# include <string>
#endif /* UNIV_HOTBACKUP */
/** A constant to prevent the compiler from optimizing ut_delay() away. */
@@ -562,6 +563,35 @@ ut_print_namel(
}
/**********************************************************************//**
+Outputs a fixed-length string, quoted as an SQL identifier.
+If the string contains a slash '/', the string will be
+output as two identifiers separated by a period (.),
+as in SQL database_name.identifier. */
+UNIV_INTERN
+std::string
+ut_get_name(
+/*=========*/
+ const trx_t* trx, /*!< in: transaction (NULL=no quotes) */
+ ibool table_id,/*!< in: TRUE=print a table name,
+ FALSE=print other identifier */
+ const char* name) /*!< in: name to print */
+{
+ /* 2 * NAME_LEN for database and table name,
+ and some slack for the #mysql50# prefix and quotes */
+ char buf[3 * NAME_LEN];
+ const char* bufend;
+ ulint namelen = strlen(name);
+
+ bufend = innobase_convert_name(buf, sizeof buf,
+ name, namelen,
+ trx ? trx->mysql_thd : NULL,
+ table_id);
+ buf[bufend-buf]='\0';
+ std::string str(buf);
+ return str;
+}
+
+/**********************************************************************//**
Formats a table or index name, quoted as an SQL identifier. If the name
contains a slash '/', the result will contain two identifiers separated by
a period (.), as in SQL database_name.identifier.