summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-10-18 06:55:26 -0700
committerSergei Golubchik <sergii@pisem.net>2013-10-18 06:55:26 -0700
commit8122996a599fcb6dc600f27fddbed47a2579c6b8 (patch)
treed27476e2a6491b2b7ffa5247df617a14b6bfd4c0 /sql/item_strfunc.cc
parent1ac0b920d572ec393a2b482b6fa0686a6708abdd (diff)
downloadmariadb-git-8122996a599fcb6dc600f27fddbed47a2579c6b8.tar.gz
CURRENT_ROLE() function
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 02d64952459..66fae0bed10 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2332,16 +2332,28 @@ bool Item_func_current_user::fix_fields(THD *thd, Item **ref)
if (Item_func_sysconst::fix_fields(thd, ref))
return TRUE;
- Security_context *ctx=
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- (context->security_ctx
- ? context->security_ctx : thd->security_ctx);
-#else
- thd->security_ctx;
-#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
+ Security_context *ctx= context->security_ctx
+ ? context->security_ctx : thd->security_ctx;
return init(ctx->priv_user, ctx->priv_host);
}
+bool Item_func_current_role::fix_fields(THD *thd, Item **ref)
+{
+ if (Item_func_sysconst::fix_fields(thd, ref))
+ return 1;
+
+ Security_context *ctx= context->security_ctx
+ ? context->security_ctx : thd->security_ctx;
+
+ const char *role= ctx->priv_role[0] ? ctx->priv_role : NONE_ROLE;
+
+ if (str_value.copy(role, strlen(role), system_charset_info))
+ return 1;
+
+ str_value.mark_as_const();
+ return 0;
+}
+
void Item_func_soundex::fix_length_and_dec()
{