summaryrefslogtreecommitdiff
path: root/sql/sql_help.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-06-21 21:26:31 +0400
committerAlexander Barkov <bar@mariadb.org>2016-06-21 21:26:31 +0400
commit21479a6bb3cc37ffa1fb4f53a0ab71d22c7ad445 (patch)
tree1e2905aa5c6df07103c0f2e09e70f12b02796ad8 /sql/sql_help.cc
parent69f1a3215e5062eb6c06ed35ec38e1d824efbef6 (diff)
downloadmariadb-git-21479a6bb3cc37ffa1fb4f53a0ab71d22c7ad445.tar.gz
MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH
The patch fixes the problem with loading information from system tables (e.g. event and help related tables) when PAD_CHAR_TO_FULL_LENGTH is enabled, as well as includes some additional minor improvements: - refactoring in get_field() to return an error rather than success if strmake_root() failed - removing of duplicate code in similar functions: char *get_field(MEM_ROOT *mem, Field *field) bool get_field(MEM_ROOT *mem, Field *field, String *res)
Diffstat (limited to 'sql/sql_help.cc')
-rw-r--r--sql/sql_help.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index afeb9395a55..f509d8b8f99 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -647,7 +647,7 @@ SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, uint mlen,
TRUE Error and send_error already commited
*/
-bool mysqld_help(THD *thd, const char *mask)
+static bool mysqld_help_internal(THD *thd, const char *mask)
{
Protocol *protocol= thd->protocol;
SQL_SELECT *select;
@@ -823,3 +823,12 @@ error2:
DBUG_RETURN(TRUE);
}
+
+bool mysqld_help(THD *thd, const char *mask)
+{
+ ulonglong sql_mode_backup= thd->variables.sql_mode;
+ thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
+ bool rc= mysqld_help_internal(thd, mask);
+ thd->variables.sql_mode= sql_mode_backup;
+ return rc;
+}