Below is the list of changes that have just been committed into a local
4.1 repository of acurtis. When acurtis does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.1973 04/07/14 11:47:00 acurtis@stripped +6 -0
Adding user-visible grammar extensions for loadable storage engines
sql/sql_yacc.yy
1.341 04/07/14 11:46:52 acurtis@stripped +174 -44
Add grammar
sql/sql_show.cc
1.176 04/07/14 11:46:52 acurtis@stripped +0 -40
mysqld_show_storage_engines is moving to handler.cc
sql/sql_lex.h
1.167 04/07/14 11:46:52 acurtis@stripped +3 -0
New commands
sql/lex.h
1.146 04/07/14 11:46:52 acurtis@stripped +1 -0
Add new token, ALIAS
sql/handler.h
1.123 04/07/14 11:46:52 acurtis@stripped +30 -1
Adding prototypes for module definition
sql/handler.cc
1.140 04/07/14 11:46:51 acurtis@stripped +118 -71
Clean up the code
mysqld_show_storage_engines from sql_show.cc
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: acurtis
# Host: pcgem.rdg.cyberkinetica.com
# Root: /usr/home/acurtis/work/wl1960.1
--- 1.139/sql/handler.cc 2004-07-13 09:29:42 +01:00
+++ 1.140/sql/handler.cc 2004-07-14 11:46:51 +01:00
@@ -1495,7 +1495,51 @@
return error;
}
-/* Utility routines for handing create info tags */
+/***************************************************************************
+** List all table types supported
+***************************************************************************/
+
+int mysqld_show_storage_engines(THD *thd)
+{
+ List<Item> field_list;
+ Protocol *protocol= thd->protocol;
+ DBUG_ENTER("mysqld_show_storage_engines");
+
+ field_list.push_back(new Item_empty_string("Engine",10));
+ field_list.push_back(new Item_empty_string("Support",10));
+ field_list.push_back(new Item_empty_string("Comment",80));
+
+ if (protocol->send_fields(&field_list,1))
+ DBUG_RETURN(1);
+
+ const char *default_type_name=
+ ha_get_storage_engine((enum db_type)thd->variables.table_type);
+
+ show_table_type_st *types;
+ for (types= sys_table_types; types->type; types++)
+ {
+ protocol->prepare_for_resend();
+ protocol->store(types->type, system_charset_info);
+ const char *option_name= show_comp_option_name[(int) *types->value];
+
+ if (*types->value == SHOW_OPTION_YES &&
+ !my_strcasecmp(system_charset_info, default_type_name, types->type))
+ option_name= "DEFAULT";
+ protocol->store(option_name, system_charset_info);
+ protocol->store(types->comment, system_charset_info);
+ if (protocol->write())
+ DBUG_RETURN(-1);
+ }
+ send_eof(thd);
+ DBUG_RETURN(0);
+}
+
+
+
+/***************************************************************************
+** Utility routines for handing create info tags
+** bad names - will refactor later
+***************************************************************************/
struct st_ha_create_information_element
{
@@ -1510,31 +1554,48 @@
{
ulonglong magic;
uint alloced, max, spaces;
+ struct st_ha_create_information_element *lastmatch;
struct st_ha_create_information_element elem[0];
};
-void ha_create_information_remove(HA_CREATE_INFO &info,
- const char *element)
+static st_ha_create_information_element *
+get_ha_information_element(HA_CREATE_INFO &info,const char *element)
{
DBUG_ENTER("ha_create_information_remove");
- DBUG_PRINT("info",("element:%s",element));
DBUG_ASSERT((info==NULL)||(info->magic == INFOMAGIC));
if ((info != NULL) && (element != NULL))
{
+ if (info->lastmatch != NULL) {
+ if ((element == info->lastmatch->element) ||
+ !my_strcasecmp(&my_charset_latin1, element, info->lastmatch->element))
+ DBUG_RETURN(info->lastmatch);
+ }
for (int i = info->max-1; i >= 0; i--)
{
- if ((info->elem[i].element != NULL) &&
- !my_strcasecmp(&my_charset_latin1, element, info->elem[i].element))
+ if ((info->lastmatch != &info->elem[i]) &&
+ (info->elem[i].element != NULL) &&
+ ((element == info->elem[i].element) ||
+ !my_strcasecmp(&my_charset_latin1, element, info->elem[i].element)))
{
- info->elem[i].element = NULL;
- if (i == info->max-1)
- info->max--;
- else
- info->spaces++;
- break;
+ info->lastmatch=&info->elem[i];
+ DBUG_RETURN(info->lastmatch);
}
}
}
+ DBUG_RETURN(NULL);
+}
+
+void ha_create_information_remove(HA_CREATE_INFO &info,
+ const char *element)
+{
+ st_ha_create_information_element *elem;
+ DBUG_ENTER("ha_create_information_remove");
+ if ((elem = get_ha_information_element(info,element)))
+ {
+ info->lastmatch=NULL;
+ elem->element = NULL;
+ info->spaces++;
+ }
DBUG_VOID_RETURN;
}
@@ -1543,21 +1604,17 @@
enum enum_ha_create_info_type type,
bool must_be_present)
{
+ st_ha_create_information_element *elem;
DBUG_ENTER("ha_create_information_ptr");
DBUG_PRINT("info",("element:%s, type=%d, present=%d",
element, type, must_be_present));
- DBUG_ASSERT((info==NULL)||(info->magic == INFOMAGIC));
- if ((info != NULL) && (element != NULL))
+ if ((elem = get_ha_information_element(info,element)))
{
- for (int i = info->max-1; i >= 0; i--)
- {
- if ((info->elem[i].element != NULL) &&
- !my_strcasecmp(&my_charset_latin1, element, info->elem[i].element))
- {
- DBUG_ASSERT(info->elem[i].type == type);
- DBUG_RETURN(&info->elem[i].data);
- }
+ if (must_be_present || !type || !elem->type || (elem->type == type)) {
+ DBUG_ASSERT(!type || !elem->type || elem->type == type);
+ DBUG_RETURN(&elem->data);
}
+ DBUG_PRINT("info",("type mismatch for %s",elem->element));
}
DBUG_ASSERT(!must_be_present);
DBUG_RETURN(NULL);
@@ -1567,67 +1624,57 @@
const char *element,
enum enum_ha_create_info_type type)
{
+ st_ha_create_information_element *elem;
DBUG_ENTER("ha_create_information_create");
DBUG_PRINT("info",("element:%s, type=%d",
element, type));
- DBUG_ASSERT((info==NULL)||(info->magic == INFOMAGIC));
- if ((info != NULL) && (element != NULL) && (info->max))
+ DBUG_ASSERT(element != NULL);
+ if ((elem = get_ha_information_element(info,element)))
+ {
+ DBUG_ASSERT(!type || !elem->type || elem->type == type);
+ DBUG_RETURN(&elem->data);
+ }
+ if (info && info->spaces)
{
for (int i = info->max-1; i >= 0; i--)
{
- if ((info->elem[i].element != NULL) &&
- !my_strcasecmp(&my_charset_latin1, element, info->elem[i].element))
- {
- if (info->elem[i].type != type) {
- printf("type mismatch for element: %s\n",element);
- }
- DBUG_ASSERT(info->elem[i].type == type);
- DBUG_RETURN(&info->elem[i].data);
- }
- }
- if (info->spaces)
- {
- for (int i = info->max-1; i >= 0; i--)
+ if (info->elem[i].element == NULL)
{
- if (info->elem[i].element == NULL)
- {
- info->spaces--;
- info->elem[i].element = element;
- info->elem[i].type = type;
- bzero((char*)&info->elem[i].data, sizeof(HA_CREATE_DATA));
- DBUG_RETURN(&info->elem[i].data);
- }
+ elem = &info->elem[i];
+ info->spaces--;
+ elem->element = element;
+ elem->type = type;
+ bzero((char*)&elem->data, sizeof(HA_CREATE_DATA));
+ DBUG_RETURN(&elem->data);
}
- info->spaces = 0;
}
+ info->spaces = 0;
}
- if (element != NULL) {
- if ((info == NULL) || (info->max == info->alloced))
- {
- uint newalloced = (info != NULL) ? info->alloced*2 : 8;
- uint datasize = sizeof(struct st_ha_create_information) +
- (newalloced * sizeof(info->elem[0]));
- HA_CREATE_INFO newptr = (HA_CREATE_INFO)sql_alloc(datasize);
- if (info != NULL) {
- uint oldsize = sizeof(struct st_ha_create_information) +
- (info->alloced * sizeof(info->elem[0]));
- DBUG_ASSERT(datasize >= oldsize);
- memcpy(newptr, info, oldsize);
- } else {
- bzero((char*)newptr, datasize);
- newptr->magic = INFOMAGIC;
- }
- info = newptr;
- info->alloced = newalloced;
+ if ((info == NULL) || (info->max == info->alloced))
+ {
+ uint newalloced = (info != NULL) ? info->alloced*2 : 8;
+ uint datasize = sizeof(struct st_ha_create_information) +
+ (newalloced * sizeof(info->elem[0]));
+ HA_CREATE_INFO newptr = (HA_CREATE_INFO)sql_alloc(datasize);
+ if (info != NULL) {
+ uint oldsize = sizeof(struct st_ha_create_information) +
+ (info->alloced * sizeof(info->elem[0]));
+ DBUG_ASSERT(datasize >= oldsize);
+ memcpy(newptr, info, oldsize);
+ } else {
+ bzero((char*)newptr, datasize);
+ newptr->magic = INFOMAGIC;
}
- DBUG_ASSERT(info->max < info->alloced);
- DBUG_PRINT("info",("new element idx=%d", info->max));
- info->elem[info->max].element = element;
- info->elem[info->max].type = type;
- bzero((char*)&info->elem[info->max].data, sizeof(HA_CREATE_DATA));
- DBUG_RETURN(&info->elem[info->max++].data);
+ info = newptr;
+ info->alloced = newalloced;
}
- DBUG_RETURN(NULL);
+ DBUG_ASSERT(info->max < info->alloced);
+ DBUG_PRINT("info",("new element idx=%d", info->max));
+ elem = &info->elem[info->max++];
+ elem->element = element;
+ elem->type = type;
+ bzero((char*)&elem->data, sizeof(HA_CREATE_DATA));
+ DBUG_RETURN(&elem->data);
}
--- 1.122/sql/handler.h 2004-07-13 09:29:42 +01:00
+++ 1.123/sql/handler.h 2004-07-14 11:46:52 +01:00
@@ -548,10 +548,39 @@
*/
};
+ /* Definitions for Loadable Storage Engines */
+
+struct storage_module {
+ int version; /* API version */
+ int minor_version; /* API minor version */
+ const char *name;
+ void *dynamic_load_handle;
+ struct storage_module *next;
+ unsigned long magic;
+
+ /* Critical functions, must be implemented */
+ int (*init)(void);
+ int (*fini)(void);
+ int (*panic)(enum ha_panic_function flag);
+ handler *(*newhandler)(TABLE *table);
+};
+
+#define STORAGE_MODULE_HEADER \
+ STORAGE_MODULE_MAJOR_VERSION, \
+ STORAGE_MODULE_MINOR_VERSION, \
+ __FILE__, NULL, NULL, \
+ STORAGE_MODULE_MAGIC
+
+
+int ha_add_storage_engine(struct storage_module *m);
+int ha_drop_storage_engine(struct storage_module *m);
+
+int ha_add_storage_engine_alias(struct storage_module *m, const char *alias);
+int ha_drop_storage_engine_alias(struct storage_module *m, const char *alias);
+
/* Some extern variables used with handlers */
-extern struct show_table_type_st sys_table_types[];
extern const char *ha_row_type[];
extern TYPELIB tx_isolation_typelib;
--- 1.145/sql/lex.h 2004-06-23 11:33:53 +01:00
+++ 1.146/sql/lex.h 2004-07-14 11:46:52 +01:00
@@ -64,6 +64,7 @@
{ "AFTER", SYM(AFTER_SYM)},
{ "AGAINST", SYM(AGAINST)},
{ "AGGREGATE", SYM(AGGREGATE_SYM)},
+ { "ALIAS", SYM(ALIAS_SYM)},
{ "ALL", SYM(ALL)},
{ "ALTER", SYM(ALTER)},
{ "ANALYZE", SYM(ANALYZE_SYM)},
--- 1.166/sql/sql_lex.h 2004-06-23 16:58:47 +01:00
+++ 1.167/sql/sql_lex.h 2004-07-14 11:46:52 +01:00
@@ -47,6 +47,9 @@
SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT,
SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX,
+ SQLCOM_DROP_STORAGE_ENGINE, SQLCOM_ALTER_STORAGE_ENGINE,
+ SQLCOM_CREATE_STORAGE_ENGINE,
+
SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
SQLCOM_SHOW_INNODB_STATUS,
--- 1.175/sql/sql_show.cc 2004-07-13 09:29:43 +01:00
+++ 1.176/sql/sql_show.cc 2004-07-14 11:46:52 +01:00
@@ -169,46 +169,6 @@
}
/***************************************************************************
-** List all table types supported
-***************************************************************************/
-
-int mysqld_show_storage_engines(THD *thd)
-{
- List<Item> field_list;
- Protocol *protocol= thd->protocol;
- DBUG_ENTER("mysqld_show_storage_engines");
-
- field_list.push_back(new Item_empty_string("Engine",10));
- field_list.push_back(new Item_empty_string("Support",10));
- field_list.push_back(new Item_empty_string("Comment",80));
-
- if (protocol->send_fields(&field_list,1))
- DBUG_RETURN(1);
-
- const char *default_type_name=
- ha_get_storage_engine((enum db_type)thd->variables.table_type);
-
- show_table_type_st *types;
- for (types= sys_table_types; types->type; types++)
- {
- protocol->prepare_for_resend();
- protocol->store(types->type, system_charset_info);
- const char *option_name= show_comp_option_name[(int) *types->value];
-
- if (*types->value == SHOW_OPTION_YES &&
- !my_strcasecmp(system_charset_info, default_type_name, types->type))
- option_name= "DEFAULT";
- protocol->store(option_name, system_charset_info);
- protocol->store(types->comment, system_charset_info);
- if (protocol->write())
- DBUG_RETURN(-1);
- }
- send_eof(thd);
- DBUG_RETURN(0);
-}
-
-
-/***************************************************************************
List all privileges supported
***************************************************************************/
--- 1.340/sql/sql_yacc.yy 2004-07-13 09:29:43 +01:00
+++ 1.341/sql/sql_yacc.yy 2004-07-14 11:46:52 +01:00
@@ -180,6 +180,7 @@
%token ACTION
%token AGGREGATE_SYM
+%token ALIAS_SYM
%token ALL
%token AND_SYM
%token AS
@@ -596,7 +597,7 @@
IDENT IDENT_QUOTED TEXT_STRING REAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text
UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
- NCHAR_STRING opt_component key_cache_name
+ NCHAR_STRING opt_component key_cache_name ident2
%type <lex_str_ptr>
opt_table_alias
@@ -676,7 +677,7 @@
%type <udf_type> udf_func_type
-%type <symbol> FUNC_ARG0 FUNC_ARG1 FUNC_ARG2 FUNC_ARG3 keyword
+%type <symbol> FUNC_ARG0 FUNC_ARG1 FUNC_ARG2 FUNC_ARG3 keyword keyword2
%type <lex_user> user grant_user
@@ -1070,7 +1071,10 @@
lex->udf.returns=(Item_result) $7;
lex->udf.dl=$9.str;
}
- ;
+ | CREATE opt_storage ENGINE_SYM opt_if_not_exists ident
+ {}
+ UDF_SONAME_SYM TEXT_STRING_sys
+ {};
create2:
'(' create2a {}
@@ -1171,22 +1175,79 @@
| create_table_option ',' create_table_options;
create_table_option:
- ENGINE_SYM opt_equal storage_engines { CI_SET(Lex->create_info,db_type,dbtype, $3); }
- | TYPE_SYM opt_equal storage_engines { CI_SET(Lex->create_info,db_type,dbtype, $3); WARN_DEPRECATED("TYPE=storage_engine","ENGINE=storage_engine"); }
- | MAX_ROWS opt_equal ulonglong_num { CI_SET(Lex->create_info,max_rows,ulonglong, $3); CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_MAX_ROWS;}
- | MIN_ROWS opt_equal ulonglong_num { CI_SET(Lex->create_info,min_rows,ulonglong, $3); CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_MIN_ROWS;}
- | AVG_ROW_LENGTH opt_equal ULONG_NUM { CI_SET(Lex->create_info,avg_row_length,ulong, $3); CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_AVG_ROW_LENGTH;}
- | PASSWORD opt_equal TEXT_STRING_sys { CI_SET(Lex->create_info,password,charptr, $3.str); }
- | COMMENT_SYM opt_equal TEXT_STRING_sys { CI_SET(Lex->create_info,comment,charptr, $3.str); }
- | AUTO_INC opt_equal ulonglong_num { CI_SET(Lex->create_info,auto_increment_value,ulonglong,$3); CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_AUTO;}
- | PACK_KEYS_SYM opt_equal ULONG_NUM { CI_VAL(Lex->create_info,table_options,ulong)|= $3 ? HA_OPTION_PACK_KEYS : HA_OPTION_NO_PACK_KEYS; CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_PACK_KEYS;}
- | PACK_KEYS_SYM opt_equal DEFAULT { CI_VAL(Lex->create_info,table_options,ulong)&= ~(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS); CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_PACK_KEYS;}
- | CHECKSUM_SYM opt_equal ULONG_NUM { CI_VAL(Lex->create_info,table_options,ulong)|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM; }
- | DELAY_KEY_WRITE_SYM opt_equal ULONG_NUM { CI_VAL(Lex->create_info,table_options,ulong)|= $3 ? HA_OPTION_DELAY_KEY_WRITE : HA_OPTION_NO_DELAY_KEY_WRITE; }
- | ROW_FORMAT_SYM opt_equal row_types { CI_SET(Lex->create_info,row_type,rowtype, $3); }
- | RAID_TYPE opt_equal raid_types { CI_SET(Lex->create_info,raid_type,uint, $3); CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_RAID;}
- | RAID_CHUNKS opt_equal ULONG_NUM { CI_SET(Lex->create_info,raid_chunks,uint, $3); CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_RAID;}
- | RAID_CHUNKSIZE opt_equal ULONG_NUM { CI_SET(Lex->create_info,raid_chunksize,ulong, $3*RAID_BLOCK_SIZE); CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_RAID;}
+ opt_storage ENGINE_SYM opt_equal storage_engines
+ { CI_SET(Lex->create_info,db_type,dbtype, $4); }
+ | TYPE_SYM opt_equal storage_engines
+ {
+ CI_SET(Lex->create_info,db_type,dbtype, $3);
+ WARN_DEPRECATED("TYPE=storage_engine","ENGINE=storage_engine");
+ }
+ | MAX_ROWS opt_equal ulonglong_num
+ {
+ CI_SET(Lex->create_info,max_rows,ulonglong, $3);
+ CI_VAL(Lex->create_info,used_fields,ulong)|=
+ HA_CREATE_USED_MAX_ROWS;
+ }
+ | MIN_ROWS opt_equal ulonglong_num
+ {
+ CI_SET(Lex->create_info,min_rows,ulonglong, $3);
+ CI_VAL(Lex->create_info,used_fields,ulong)|=
+ HA_CREATE_USED_MIN_ROWS;
+ }
+ | AVG_ROW_LENGTH opt_equal ULONG_NUM
+ {
+ CI_SET(Lex->create_info,avg_row_length,ulong, $3);
+ CI_VAL(Lex->create_info,used_fields,ulong)|=
+ HA_CREATE_USED_AVG_ROW_LENGTH;
+ }
+ | PASSWORD opt_equal TEXT_STRING_sys
+ { CI_SET(Lex->create_info,password,charptr, $3.str); }
+ | COMMENT_SYM opt_equal TEXT_STRING_sys
+ { CI_SET(Lex->create_info,comment,charptr, $3.str); }
+ | AUTO_INC opt_equal ulonglong_num
+ {
+ CI_SET(Lex->create_info,auto_increment_value,ulonglong,$3);
+ CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_AUTO;
+ }
+ | PACK_KEYS_SYM opt_equal ULONG_NUM
+ { CI_VAL(Lex->create_info,table_options,ulong)|=
+ $3 ? HA_OPTION_PACK_KEYS : HA_OPTION_NO_PACK_KEYS;
+ CI_VAL(Lex->create_info,used_fields,ulong)|=
+ HA_CREATE_USED_PACK_KEYS;
+ }
+ | PACK_KEYS_SYM opt_equal DEFAULT
+ { CI_VAL(Lex->create_info,table_options,ulong)&=
+ ~(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS);
+ CI_VAL(Lex->create_info,used_fields,ulong)|=
+ HA_CREATE_USED_PACK_KEYS;
+ }
+ | CHECKSUM_SYM opt_equal ULONG_NUM
+ {
+ CI_VAL(Lex->create_info,table_options,ulong)|=
+ $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM;
+ }
+ | DELAY_KEY_WRITE_SYM opt_equal ULONG_NUM
+ {
+ CI_VAL(Lex->create_info,table_options,ulong)|=
+ $3 ? HA_OPTION_DELAY_KEY_WRITE : HA_OPTION_NO_DELAY_KEY_WRITE;
+ }
+ | ROW_FORMAT_SYM opt_equal row_types
+ { CI_SET(Lex->create_info,row_type,rowtype, $3); }
+ | RAID_TYPE opt_equal raid_types
+ {
+ CI_SET(Lex->create_info,raid_type,uint, $3);
+ CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_RAID;
+ }
+ | RAID_CHUNKS opt_equal ULONG_NUM
+ {
+ CI_SET(Lex->create_info,raid_chunks,uint, $3);
+ CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_RAID;
+ }
+ | RAID_CHUNKSIZE opt_equal ULONG_NUM
+ {
+ CI_SET(Lex->create_info,raid_chunksize,ulong, $3*RAID_BLOCK_SIZE);
+ CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_RAID;
+ }
| UNION_SYM opt_equal '(' table_list ')'
{
/* Move the union list to the merge_list */
@@ -1204,17 +1265,52 @@
| opt_default charset opt_equal charset_name_or_default
{
CI_SET(Lex->create_info,default_table_charset,charset, $4);
- CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_DEFAULT_CHARSET;
+ CI_VAL(Lex->create_info,used_fields,ulong)|=
+ HA_CREATE_USED_DEFAULT_CHARSET;
}
| opt_default COLLATE_SYM opt_equal collation_name_or_default
{
CI_SET(Lex->create_info,default_table_charset,charset, $4);
- CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_DEFAULT_CHARSET;
+ CI_VAL(Lex->create_info,used_fields,ulong)|=
+ HA_CREATE_USED_DEFAULT_CHARSET;
+ }
+ | INSERT_METHOD opt_equal merge_insert_types
+ {
+ CI_SET(Lex->create_info,merge_insert_method,uint, $3);
+ CI_VAL(Lex->create_info,used_fields,ulong)|=
+ HA_CREATE_USED_INSERT_METHOD;
}
- | INSERT_METHOD opt_equal merge_insert_types { CI_SET(Lex->create_info,merge_insert_method,uint, $3); CI_VAL(Lex->create_info,used_fields,ulong)|= HA_CREATE_USED_INSERT_METHOD;}
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
{ CI_SET(Lex->create_info,data_file_name,charptr, $4.str); }
- | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys { CI_SET(Lex->create_info,index_file_name,charptr, $4.str); };
+ | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
+ { CI_SET(Lex->create_info,index_file_name,charptr, $4.str); }
+ | ident2 opt_equal TEXT_STRING_sys
+ { char *name;
+ if ((name = (char *)sql_alloc($1.length+2)))
+ {
+ memcpy(name+1,$1.str,$1.length);
+ name[$1.length+1]=0; name[0] = '*';
+ ha_create_information_remove(Lex->create_info,name);
+ ha_create_information_add(
+ Lex->create_info,name,
+ CREATEINFO_TYPE_charptr
+ )->ha_charptr=$3.str;
+ }
+ }
+ | ident2 opt_equal ULONG_NUM
+ { char *name;
+ if ((name = (char *)sql_alloc($1.length+2)))
+ {
+ memcpy(name+1,$1.str,$1.length);
+ name[$1.length+1]=0; name[0] = '*';
+ ha_create_information_remove(Lex->create_info,name);
+ ha_create_information_add(
+ Lex->create_info,name,
+ CREATEINFO_TYPE_ulong
+ )->ha_ulong=$3;
+ }
+ }
+ ;
storage_engines:
ident_or_text
@@ -1830,8 +1926,19 @@
LEX *lex=Lex;
lex->sql_command=SQLCOM_ALTER_DB;
lex->name=$3.str;
- };
+ }
+ | ALTER opt_storage ENGINE_SYM ident storage_alter_list
+ {};
+
+
+storage_alter_list:
+ | storage_alter_item
+ | storage_alter_list ',' storage_alter_list;
+storage_alter_item:
+ ADD ALIAS_SYM ident {}
+ | DROP ALIAS_SYM ident {}
+ ;
alter_list:
| DISCARD TABLESPACE { Lex->alter_info.tablespace_op= DISCARD_TABLESPACE; }
@@ -3885,6 +3992,13 @@
lex->sql_command = SQLCOM_DROP_FUNCTION;
lex->udf.name = $3;
}
+ | DROP opt_storage ENGINE_SYM if_exists IDENT_sys
+ {
+ LEX *lex=Lex;
+ lex->sql_command= SQLCOM_DROP_STORAGE_ENGINE;
+ lex->drop_if_exists=$4;
+ lex->name=$5.str;
+ }
| DROP USER
{
LEX *lex=Lex;
@@ -4244,8 +4358,8 @@
lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
lex->select_lex.db= $3;
}
- | ENGINE_SYM storage_engines
- { CI_SET(Lex->create_info,db_type,dbtype, $2); }
+ | opt_storage ENGINE_SYM storage_engines
+ { CI_SET(Lex->create_info,db_type,dbtype, $3); }
show_engine_param
| opt_full COLUMNS from_or_in table_ident opt_db wild
{
@@ -4940,6 +5054,16 @@
}
;
+ident2:
+ IDENT_sys { $$=$1; }
+ | keyword2
+ {
+ THD *thd= YYTHD;
+ $$.str= thd->strmake($1.str, $1.length);
+ $$.length= $1.length;
+ }
+ ;
+
ident_or_text:
ident { $$=$1;}
| TEXT_STRING_sys { $$=$1;}
@@ -4984,15 +5108,36 @@
/* Keyword that we allow for identifiers */
keyword:
+ AUTO_INC {}
+ | AVG_ROW_LENGTH {}
+ | CHARSET {}
+ | CHECKSUM_SYM {}
+ | COMMENT_SYM {}
+ | DATA_SYM {}
+ | DELAY_KEY_WRITE_SYM {}
+ | ENGINE_SYM {}
+ | INSERT_METHOD {}
+ | MAX_ROWS {}
+ | MIN_ROWS {}
+ | PACK_KEYS_SYM {}
+ | PASSWORD {}
+ | RAID_CHUNKS {}
+ | RAID_CHUNKSIZE {}
+ | RAID_TYPE {}
+ | ROW_FORMAT_SYM {}
+ | TYPE_SYM {}
+ | keyword2 {}
+ ;
+
+keyword2:
ACTION {}
| ADDDATE_SYM {}
| AFTER_SYM {}
| AGAINST {}
| AGGREGATE_SYM {}
+ | ALIAS_SYM {}
| ANY_SYM {}
| ASCII_SYM {}
- | AUTO_INC {}
- | AVG_ROW_LENGTH {}
| AVG_SYM {}
| BACKUP_SYM {}
| BEGIN_SYM {}
@@ -5005,24 +5150,19 @@
| BTREE_SYM {}
| CACHE_SYM {}
| CHANGED {}
- | CHARSET {}
- | CHECKSUM_SYM {}
| CIPHER_SYM {}
| CLIENT_SYM {}
| CLOSE_SYM {}
| COLLATION_SYM {}
- | COMMENT_SYM {}
| COMMITTED_SYM {}
| COMMIT_SYM {}
| COMPRESSED_SYM {}
| CONCURRENT {}
| CUBE_SYM {}
- | DATA_SYM {}
| DATETIME {}
| DATE_SYM {}
| DAY_SYM {}
| DEALLOCATE_SYM {}
- | DELAY_KEY_WRITE_SYM {}
| DES_KEY_FILE {}
| DIRECTORY_SYM {}
| DISCARD {}
@@ -5032,7 +5172,6 @@
| DYNAMIC_SYM {}
| END {}
| ENUM {}
- | ENGINE_SYM {}
| ENGINES_SYM {}
| ERRORS {}
| ESCAPE_SYM {}
@@ -5064,7 +5203,6 @@
| ISOLATION {}
| ISSUER_SYM {}
| INNOBASE_SYM {}
- | INSERT_METHOD {}
| RELAY_THREAD {}
| LAST_SYM {}
| LEAVES {}
@@ -5073,7 +5211,6 @@
| LOCAL_SYM {}
| LOCKS_SYM {}
| LOGS_SYM {}
- | MAX_ROWS {}
| MASTER_SYM {}
| MASTER_HOST_SYM {}
| MASTER_PORT_SYM {}
@@ -5095,7 +5232,6 @@
| MEDIUM_SYM {}
| MICROSECOND_SYM {}
| MINUTE_SYM {}
- | MIN_ROWS {}
| MODIFY_SYM {}
| MODE_SYM {}
| MONTH_SYM {}
@@ -5115,9 +5251,7 @@
| OLD_PASSWORD {}
| ONE_SHOT_SYM {}
| OPEN_SYM {}
- | PACK_KEYS_SYM {}
| PARTIAL {}
- | PASSWORD {}
| POINT_SYM {}
| POLYGON {}
| PREPARE_SYM {}
@@ -5127,10 +5261,7 @@
| QUERY_SYM {}
| QUICK {}
| RAID_0_SYM {}
- | RAID_CHUNKS {}
- | RAID_CHUNKSIZE {}
| RAID_STRIPED_SYM {}
- | RAID_TYPE {}
| RELAY_LOG_FILE_SYM {}
| RELAY_LOG_POS_SYM {}
| RELOAD {}
@@ -5143,7 +5274,6 @@
| ROLLBACK_SYM {}
| ROLLUP_SYM {}
| ROWS_SYM {}
- | ROW_FORMAT_SYM {}
| ROW_SYM {}
| RTREE_SYM {}
| SAVEPOINT_SYM {}
@@ -5176,7 +5306,6 @@
| TRUNCATE_SYM {}
| TIMESTAMP {}
| TIME_SYM {}
- | TYPE_SYM {}
| TYPES_SYM {}
| UDF_SYM {}
| UNCOMMITTED_SYM {}
@@ -5191,6 +5320,7 @@
| X509_SYM {}
| YEAR_SYM {}
;
+
/* Option functions */
| Thread |
|---|
| • bk commit into 4.1 tree (acurtis:1.1973) | Antony T Curtis | 14 Jul |