summaryrefslogtreecommitdiff
path: root/sql/set_var.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2014-08-27 20:32:32 +0200
committerSergei Golubchik <serg@mariadb.org>2014-10-10 22:27:41 +0200
commit28ebc2a72485c4b2956531010bd3ee247ae91df2 (patch)
treed89e1f85319a7b7610cee10ea850470879877dc2 /sql/set_var.h
parent051c132635555371c57b4dea3d1f9f1ad037342c (diff)
downloadmariadb-git-28ebc2a72485c4b2956531010bd3ee247ae91df2.tar.gz
cleanup: sysvar, only one common check_update_type()
Diffstat (limited to 'sql/set_var.h')
-rw-r--r--sql/set_var.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/sql/set_var.h b/sql/set_var.h
index a8981937fce..6dcf478a341 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -132,7 +132,31 @@ public:
bool is_struct() { return option.var_type & GET_ASK_ADDR; }
bool is_written_to_binlog(enum_var_type type)
{ return type != OPT_GLOBAL && binlog_status == SESSION_VARIABLE_IN_BINLOG; }
- virtual bool check_update_type(Item_result type) = 0;
+ bool check_update_type(Item_result type)
+ {
+ switch (option.var_type & GET_TYPE_MASK) {
+ case GET_INT:
+ case GET_UINT:
+ case GET_LONG:
+ case GET_ULONG:
+ case GET_LL:
+ case GET_ULL:
+ return type != INT_RESULT;
+ case GET_STR:
+ case GET_STR_ALLOC:
+ return type != STRING_RESULT;
+ case GET_ENUM:
+ case GET_BOOL:
+ case GET_SET:
+ case GET_FLAGSET:
+ return type != STRING_RESULT && type != INT_RESULT;
+ case GET_DOUBLE:
+ return type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT;
+ default:
+ return true;
+ }
+ }
+
bool check_type(enum_var_type type)
{
switch (scope())