summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorEugene Kosov <eugene.kosov@mariadb.com>2020-06-18 17:26:01 +0300
committerEugene Kosov <claprix@yandex.ru>2021-12-03 16:12:27 +0600
commit0dfe5a31573cca56b9c642762a3231d1c3b5c08e (patch)
tree1cab5b9b2f1464ead36a88cbb0e7b31fba273c26 /sql/sql_acl.cc
parent1e54a9716d2d41a059cd6f91a2f7bf6d46e48090 (diff)
downloadmariadb-git-bb-10.7-MDEV-22441-scoped-variable.tar.gz
MDEV-22441 implement a generic way to change a value of a variable in a scopebb-10.7-MDEV-22441-scoped-variable
Example: { auto _= make_scope_value(var, tmp_value); } make_scope_value(): a function which returns RAII object which temporary changes a value of a variable detail::Scope_value: actual implementation of such RAII class. It shouldn't be used directly! That's why it's inside a namespace detail.
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 2d7f62cd725..376dad2373e 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -54,6 +54,7 @@
#include "sql_array.h"
#include "sql_hset.h"
#include "password.h"
+#include "scope.h"
#include "sql_plugin_compat.h"
@@ -2465,10 +2466,11 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
READ_RECORD read_record_info;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
char tmp_name[SAFE_NAME_LEN+1];
- Sql_mode_save old_mode_save(thd);
DBUG_ENTER("acl_load");
- thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
+ auto _= make_scope_value(thd->variables.sql_mode,
+ thd->variables.sql_mode &
+ ~MODE_PAD_CHAR_TO_FULL_LENGTH);
grant_version++; /* Privileges updated */