summaryrefslogtreecommitdiff
path: root/sql/set_var.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2014-08-27 16:05:54 +0200
committerSergei Golubchik <serg@mariadb.org>2014-10-10 22:27:40 +0200
commit051c132635555371c57b4dea3d1f9f1ad037342c (patch)
tree500c02582f926e84ff94a70672dec2f9a49fcf01 /sql/set_var.h
parentdb2399b0c189d96131bf0ac4997daeda4050d2ff (diff)
downloadmariadb-git-051c132635555371c57b4dea3d1f9f1ad037342c.tar.gz
cleanup: sysvar, SHOW_VALUE_IN_HELP->GETOPT_ONLY_HELP
replace flag SHOW_VALUE_IN_HELP (that's not really an independendent flag, as it should only be used for NO_CMD_LINE sysvars) with a special getopt.id type.
Diffstat (limited to 'sql/set_var.h')
-rw-r--r--sql/set_var.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/sql/set_var.h b/sql/set_var.h
index bb92e555aa7..a8981937fce 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -61,7 +61,9 @@ public:
sys_var *next;
LEX_CSTRING name;
enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023,
- READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096, SHOW_VALUE_IN_HELP=8192 };
+ READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096 };
+ enum { NO_GETOPT=-1, GETOPT_ONLY_HELP=-2 };
+
/**
Enumeration type to indicate for a system variable whether
it will be written to the binlog or not.
@@ -143,9 +145,23 @@ public:
}
bool register_option(DYNAMIC_ARRAY *array, int parse_flags)
{
- return ((((option.id != -1) && ((flags & PARSE_EARLY) == parse_flags)) ||
- (flags & parse_flags)) &&
- insert_dynamic(array, (uchar*)&option));
+ DBUG_ASSERT(parse_flags == GETOPT_ONLY_HELP ||
+ parse_flags == PARSE_EARLY || parse_flags == 0);
+ if (option.id == NO_GETOPT)
+ return 0;
+ if (parse_flags == GETOPT_ONLY_HELP)
+ {
+ if (option.id != GETOPT_ONLY_HELP)
+ return 0;
+ }
+ else
+ {
+ if (option.id == GETOPT_ONLY_HELP)
+ return 0;
+ if ((flags & PARSE_EARLY) != parse_flags)
+ return 0;
+ }
+ return insert_dynamic(array, (uchar*)&option);
}
void do_deprecated_warning(THD *thd);