2010-04-08 14:10:05 +02:00
|
|
|
/* 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
|
Update FSF address
This commit is based on the work of Michal Schorm, rebased on the
earliest MariaDB version.
Th command line used to generate this diff was:
find ./ -type f \
-exec sed -i -e 's/Foundation, Inc., 59 Temple Place, Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
-exec sed -i -e 's/Foundation, Inc. 59 Temple Place.* Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
-exec sed -i -e 's/MA.*.....-1307.*USA/MA 02110-1335 USA/g' {} \; \
-exec sed -i -e 's/Foundation, Inc., 59 Temple/Foundation, Inc., 51 Franklin/g' {} \; \
-exec sed -i -e 's/Place, Suite 330, Boston, MA.*02111-1307.*USA/Street, Fifth Floor, Boston, MA 02110-1335 USA/g' {} \; \
-exec sed -i -e 's/MA.*.....-1307/MA 02110-1335/g' {} \;
2019-05-10 19:49:46 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
|
2010-04-08 14:10:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
@file
|
|
|
|
|
|
|
|
Engine defined options of tables/fields/keys in CREATE/ALTER TABLE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SQL_CREATE_OPTIONS_INCLUDED
|
|
|
|
#define SQL_CREATE_OPTIONS_INCLUDED
|
|
|
|
|
2011-04-25 17:22:25 +02:00
|
|
|
#include "sql_class.h"
|
2016-05-01 19:33:25 +02:00
|
|
|
|
|
|
|
enum { ENGINE_OPTION_MAX_LENGTH=32767 };
|
2010-04-08 14:10:05 +02:00
|
|
|
|
|
|
|
class engine_option_value: public Sql_alloc
|
|
|
|
{
|
|
|
|
public:
|
2017-04-23 18:39:57 +02:00
|
|
|
LEX_CSTRING name;
|
|
|
|
LEX_CSTRING value;
|
2010-04-08 14:10:05 +02:00
|
|
|
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'
|
|
|
|
|
2013-07-26 21:02:48 +02:00
|
|
|
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);
|
|
|
|
}
|
2017-04-23 18:39:57 +02:00
|
|
|
engine_option_value(LEX_CSTRING &name_arg, LEX_CSTRING &value_arg,
|
|
|
|
bool quoted,
|
2010-04-08 14:10:05 +02:00
|
|
|
engine_option_value **start, engine_option_value **end) :
|
|
|
|
name(name_arg), value(value_arg),
|
|
|
|
next(NULL), parsed(false), quoted_value(quoted)
|
|
|
|
{
|
|
|
|
link(start, end);
|
|
|
|
}
|
2017-04-23 18:39:57 +02:00
|
|
|
engine_option_value(LEX_CSTRING &name_arg,
|
2010-04-08 14:10:05 +02:00
|
|
|
engine_option_value **start, engine_option_value **end) :
|
2017-04-23 18:39:57 +02:00
|
|
|
name(name_arg), value(null_clex_str),
|
2010-04-08 14:10:05 +02:00
|
|
|
next(NULL), parsed(false), quoted_value(false)
|
|
|
|
{
|
|
|
|
link(start, end);
|
|
|
|
}
|
2017-04-23 18:39:57 +02:00
|
|
|
engine_option_value(LEX_CSTRING &name_arg, ulonglong value_arg,
|
2010-04-08 14:10:05 +02:00
|
|
|
engine_option_value **start, engine_option_value **end,
|
|
|
|
MEM_ROOT *root) :
|
|
|
|
name(name_arg), next(NULL), parsed(false), quoted_value(false)
|
|
|
|
{
|
2017-04-23 18:39:57 +02:00
|
|
|
char *str;
|
2018-04-04 11:16:12 +02:00
|
|
|
if (likely((value.str= str= (char *)alloc_root(root, 22))))
|
2010-04-08 14:10:05 +02:00
|
|
|
{
|
2017-04-23 18:39:57 +02:00
|
|
|
value.length= longlong10_to_str(value_arg, str, 10) - str;
|
2010-04-08 14:10:05 +02:00
|
|
|
link(start, end);
|
|
|
|
}
|
|
|
|
}
|
2016-05-04 16:05:30 +02:00
|
|
|
static uchar *frm_read(const uchar *buff, const uchar *buff_end,
|
|
|
|
engine_option_value **start,
|
2010-04-08 14:10:05 +02:00
|
|
|
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;
|
|
|
|
|
2013-04-09 23:27:24 +02:00
|
|
|
bool resolve_sysvar_table_options(handlerton *hton);
|
|
|
|
void free_sysvar_table_options(handlerton *hton);
|
2013-04-09 23:27:14 +02:00
|
|
|
bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share);
|
2013-04-09 23:27:24 +02:00
|
|
|
bool parse_option_list(THD* thd, handlerton *hton, void *option_struct,
|
|
|
|
engine_option_value **option_list,
|
2013-04-09 23:27:14 +02:00
|
|
|
ha_create_table_option *rules,
|
|
|
|
bool suppress_warning, MEM_ROOT *root);
|
2018-02-06 13:55:58 +01:00
|
|
|
bool engine_table_options_frm_read(const uchar *buff, size_t length,
|
2010-04-08 14:10:05 +02:00
|
|
|
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);
|
2013-09-25 19:42:22 +02:00
|
|
|
|
|
|
|
bool engine_options_differ(void *old_struct, void *new_struct,
|
|
|
|
ha_create_table_option *rules);
|
2014-07-08 19:39:27 +02:00
|
|
|
bool is_engine_option_known(engine_option_value *opt,
|
|
|
|
ha_create_table_option *rules);
|
2010-04-08 14:10:05 +02:00
|
|
|
#endif
|