diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
commit | a175314c3e5827eb193872241446f2f8f5c9d33c (patch) | |
tree | cd3d60ca99ae00829c52a6ca79150a5b6e62528b /sql/create_options.h | |
parent | Initial commit. (diff) | |
download | mariadb-10.5-upstream.tar.xz mariadb-10.5-upstream.zip |
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sql/create_options.h')
-rw-r--r-- | sql/create_options.h | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/sql/create_options.h b/sql/create_options.h new file mode 100644 index 00000000..ce645167 --- /dev/null +++ b/sql/create_options.h @@ -0,0 +1,108 @@ +/* Copyright (C) 2010 Monty Program Ab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ + +/** + @file + + Engine defined options of tables/fields/keys in CREATE/ALTER TABLE. +*/ + +#ifndef SQL_CREATE_OPTIONS_INCLUDED +#define SQL_CREATE_OPTIONS_INCLUDED + +#include "sql_class.h" + +enum { ENGINE_OPTION_MAX_LENGTH=32767 }; + +class engine_option_value: public Sql_alloc +{ + public: + LEX_CSTRING name; + LEX_CSTRING value; + engine_option_value *next; ///< parser puts them in a FIFO linked list + bool parsed; ///< to detect unrecognized options + bool quoted_value; ///< option=VAL vs. option='VAL' + + engine_option_value(engine_option_value *src, + engine_option_value **start, engine_option_value **end) : + name(src->name), value(src->value), + next(NULL), parsed(src->parsed), quoted_value(src->quoted_value) + { + link(start, end); + } + engine_option_value(LEX_CSTRING &name_arg, LEX_CSTRING &value_arg, + bool quoted, + engine_option_value **start, engine_option_value **end) : + name(name_arg), value(value_arg), + next(NULL), parsed(false), quoted_value(quoted) + { + link(start, end); + } + engine_option_value(LEX_CSTRING &name_arg, + engine_option_value **start, engine_option_value **end) : + name(name_arg), value(null_clex_str), + next(NULL), parsed(false), quoted_value(false) + { + link(start, end); + } + engine_option_value(LEX_CSTRING &name_arg, ulonglong value_arg, + engine_option_value **start, engine_option_value **end, + MEM_ROOT *root) : + name(name_arg), next(NULL), parsed(false), quoted_value(false) + { + char *str; + if (likely((value.str= str= (char *)alloc_root(root, 22)))) + { + value.length= longlong10_to_str(value_arg, str, 10) - str; + link(start, end); + } + } + static uchar *frm_read(const uchar *buff, const uchar *buff_end, + engine_option_value **start, + engine_option_value **end, MEM_ROOT *root); + void link(engine_option_value **start, engine_option_value **end); + uint frm_length(); + uchar *frm_image(uchar *buff); +}; + +typedef struct st_key KEY; +class Create_field; + +bool resolve_sysvar_table_options(handlerton *hton); +void free_sysvar_table_options(handlerton *hton); +bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share); +bool parse_option_list(THD* thd, handlerton *hton, void *option_struct, + engine_option_value **option_list, + ha_create_table_option *rules, + bool suppress_warning, MEM_ROOT *root); +bool engine_table_options_frm_read(const uchar *buff, size_t length, + TABLE_SHARE *share); +engine_option_value *merge_engine_table_options(engine_option_value *source, + engine_option_value *changes, + MEM_ROOT *root); + +uint engine_table_options_frm_length(engine_option_value *table_option_list, + List<Create_field> &create_fields, + uint keys, KEY *key_info); +uchar *engine_table_options_frm_image(uchar *buff, + engine_option_value *table_option_list, + List<Create_field> &create_fields, + uint keys, KEY *key_info); + +bool engine_options_differ(void *old_struct, void *new_struct, + ha_create_table_option *rules); +bool is_engine_option_known(engine_option_value *opt, + ha_create_table_option *rules); +#endif |