diff options
author | unknown <sergefp@mysql.com> | 2004-05-24 21:13:38 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-05-24 21:13:38 +0400 |
commit | c54f3ba680f6a1fe74e937dfe7b14da04220cba3 (patch) | |
tree | 5d63ab734c1fdc0e1db222f30ea63c47fae38c8c /sql | |
parent | fbfdcf22f49eacc4a90fb6169dbbecb36d8e8b68 (diff) | |
parent | 88da3ae5f9e69a3bf6ced379908d01da5b3bfbb0 (diff) | |
download | mariadb-git-c54f3ba680f6a1fe74e937dfe7b14da04220cba3.tar.gz |
Merge
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/sql_lex.h:
SCCS merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/Makefile.am | 4 | ||||
-rw-r--r-- | sql/discover.cc | 1 | ||||
-rw-r--r-- | sql/handler.cc | 4 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 1 | ||||
-rw-r--r-- | sql/mysql_priv.h | 13 | ||||
-rw-r--r-- | sql/mysqld.cc | 65 | ||||
-rw-r--r-- | sql/mysqld_suffix.h | 38 | ||||
-rw-r--r-- | sql/opt_range.cc | 5 | ||||
-rw-r--r-- | sql/set_var.cc | 18 | ||||
-rw-r--r-- | sql/slave.cc | 6 | ||||
-rw-r--r-- | sql/sql_acl.cc | 12 | ||||
-rw-r--r-- | sql/sql_cache.cc | 19 | ||||
-rw-r--r-- | sql/sql_class.h | 2 | ||||
-rw-r--r-- | sql/sql_db.cc | 10 | ||||
-rw-r--r-- | sql/sql_handler.cc | 16 | ||||
-rw-r--r-- | sql/sql_lex.cc | 2 | ||||
-rw-r--r-- | sql/sql_lex.h | 24 | ||||
-rw-r--r-- | sql/sql_parse.cc | 37 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 47 | ||||
-rw-r--r-- | sql/sql_union.cc | 17 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 106 |
22 files changed, 260 insertions, 189 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am index 1044673f8ec..469b82f95fa 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -49,7 +49,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ mysql_priv.h item_geofunc.h sql_bitmap.h \ procedure.h sql_class.h sql_lex.h sql_list.h \ sql_manager.h sql_map.h sql_string.h unireg.h \ - field.h handler.h \ + field.h handler.h mysqld_suffix.h \ ha_isammrg.h ha_isam.h ha_myisammrg.h\ ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \ ha_ndbcluster.h opt_range.h protocol.h \ @@ -86,7 +86,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ slave.cc sql_repl.cc sql_union.cc sql_derived.cc \ client.c sql_client.cc mini_client_errors.c pack.c\ - stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\ + stacktrace.c repl_failsafe.h repl_failsafe.cc \ gstream.cc spatial.cc sql_help.cc protocol_cursor.cc \ examples/ha_example.cc gen_lex_hash_SOURCES = gen_lex_hash.cc diff --git a/sql/discover.cc b/sql/discover.cc index e260f44a8db..696be193148 100644 --- a/sql/discover.cc +++ b/sql/discover.cc @@ -159,7 +159,6 @@ int create_table_from_handler(const char *db, error = writefrm(path, frmblob, frmlen); } - err: if (frmblob) my_free((char*) frmblob,MYF(0)); DBUG_RETURN(error); diff --git a/sql/handler.cc b/sql/handler.cc index 9acd55db0b1..bc86241bd00 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -743,7 +743,7 @@ int ha_delete_table(enum db_type table_type, const char *path) { /* Ensure that table handler get path in lower case */ strmov(tmp_path, path); - my_casedn_str(system_charset_info, tmp_path); + my_casedn_str(files_charset_info, tmp_path); path= tmp_path; } int error=file->delete_table(path); @@ -1247,7 +1247,7 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info, { /* Ensure that handler gets name in lower case */ strmov(name_buff, name); - my_casedn_str(system_charset_info, name_buff); + my_casedn_str(files_charset_info, name_buff); name= name_buff; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index c05091cae1f..676d8c1386a 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2587,6 +2587,7 @@ String *Item_func_quote::val_str(String *str) *to= '\''; str->length(new_length); str->set_charset(collation.collation); + null_value= 0; return str; null: diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 13afda816c3..978b8e41930 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -519,13 +519,10 @@ int mysql_alter_table(THD *thd, char *new_db, char *new_name, HA_CREATE_INFO *create_info, TABLE_LIST *table_list, List<create_field> &fields, - List<Key> &keys,List<Alter_drop> &drop_list, - List<Alter_column> &alter_list, - uint order_num, ORDER *order, uint alter_flags, + List<Key> &keys, + uint order_num, ORDER *order, enum enum_duplicates handle_duplicates, - enum enum_enable_or_disable keys_onoff=LEAVE_AS_IS, - enum tablespace_op_type tablespace_op=NO_TABLESPACE_OP, - bool simple_alter=0); + ALTER_INFO *alter_info); int mysql_create_like_table(THD *thd, TABLE_LIST *table, HA_CREATE_INFO *create_info, Table_ident *src_table); @@ -536,7 +533,7 @@ bool mysql_rename_table(enum db_type base, const char * new_name); int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys); int mysql_drop_index(THD *thd, TABLE_LIST *table_list, - List<Alter_drop> &drop_list); + ALTER_INFO *alter_info); int mysql_prepare_update(THD *thd, TABLE_LIST *table_list, TABLE_LIST *update_table_list, Item **conds, uint order_num, ORDER *order); @@ -859,7 +856,7 @@ extern uint protocol_version, mysqld_port, dropping_tables; extern uint delay_key_write_options, lower_case_table_names; extern bool opt_endinfo, using_udf_functions, locked_in_memory; extern bool opt_using_transactions, mysql_embedded; -extern bool using_update_log, opt_large_files; +extern bool using_update_log, opt_large_files, server_id_supplied; extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log; extern bool opt_disable_networking, opt_skip_show_db; extern bool volatile abort_loop, shutdown_in_progress, grant_option; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index aa266861dd7..4170d807160 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -22,6 +22,7 @@ #include "sql_repl.h" #include "repl_failsafe.h" #include "stacktrace.h" +#include "mysqld_suffix.h" #ifdef HAVE_BERKELEY_DB #include "ha_berkeley.h" #endif @@ -191,22 +192,6 @@ inline void reset_floating_point_exceptions() extern "C" int gethostname(char *name, int namelen); #endif -/* Set prefix for windows binary */ -#ifdef __WIN__ -#undef MYSQL_SERVER_SUFFIX -#ifdef __NT__ -#if defined(HAVE_BERKELEY_DB) -#define MYSQL_SERVER_SUFFIX "-max-nt" -#else -#define MYSQL_SERVER_SUFFIX "-nt" -#endif /* ...DB */ -#elif defined(HAVE_BERKELEY_DB) -#define MYSQL_SERVER_SUFFIX "-max" -#else -#define MYSQL_SERVER_SUFFIX "" -#endif /* __NT__ */ -#endif /* __WIN__ */ - /* Constants */ @@ -335,7 +320,7 @@ const char *opt_date_time_formats[3]; char *language_ptr, *default_collation_name, *default_character_set_name; char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home; -char server_version[SERVER_VERSION_LENGTH]=MYSQL_SERVER_VERSION; +char server_version[SERVER_VERSION_LENGTH]; char *mysqld_unix_port, *opt_mysql_tmpdir; char *my_bind_addr_str; const char **errmesg; /* Error messages */ @@ -489,6 +474,7 @@ static void start_signal_handler(void); extern "C" pthread_handler_decl(signal_hand, arg); static void mysql_init_variables(void); static void get_options(int argc,char **argv); +static void set_server_version(void); static int init_thread_environment(); static char *get_relative_path(const char *path); static void fix_paths(void); @@ -2108,18 +2094,11 @@ static int init_common_variables(const char *conf_file_name, int argc, strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); strmov(fn_ext(pidfile_name),".pid"); // Add proper extension -#ifndef DBUG_OFF - if (!*(MYSQL_SERVER_SUFFIX)) - strmov(strend(server_version),"-debug"); - else -#endif - strmov(strend(server_version),MYSQL_SERVER_SUFFIX); - load_defaults(conf_file_name, groups, &argc, &argv); defaults_argv=argv; get_options(argc,argv); - if (opt_log || opt_update_log || opt_slow_log || opt_bin_log) - strcat(server_version,"-log"); + set_server_version(); + DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname, server_version, SYSTEM_TYPE,MACHINE_TYPE)); @@ -2603,14 +2582,14 @@ You should consider changing lower_case_table_names to 1 or 2", switch (server_id) { case 1: sql_print_error("\ -Warning: You have enabled the binary log, but you haven't set server-id:\n\ -Updates will be logged to the binary log, but connections to slaves will\n\ -not be accepted."); +Warning: You have enabled the binary log, but you haven't set server-id to \ +a non-zero value: we force server id to 1; updates will be logged to the \ +binary log, but connections from slaves will not be accepted."); break; case 2: sql_print_error("\ -Warning: You should set server-id to a non-0 value if master_host is set.\n\ -The server will not act as a slave."); +Warning: You should set server-id to a non-0 value if master_host is set; \ +we force server id to 2, but this MySQL server will not act as a slave."); break; } #endif @@ -4953,6 +4932,7 @@ struct show_var_st status_vars[]= { static void print_version(void) { + set_server_version(); printf("%s Ver %s for %s on %s (%s)\n",my_progname, server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT); } @@ -5834,6 +5814,29 @@ static void get_options(int argc,char **argv) } +/* + Create version name for running mysqld version + We automaticly add suffixes -debug, -embedded and -log to the version + name to make the version more descriptive. + (MYSQL_SERVER_SUFFIX is set by the compilation environment) +*/ + +static void set_server_version(void) +{ + char *end= strxmov(server_version, MYSQL_SERVER_VERSION, + MYSQL_SERVER_SUFFIX, NullS); +#ifdef EMBEDDED_LIBRARY + end= strmov(end, "-embedded"); +#endif +#ifndef DBUG_OFF + if (!strstr(MYSQL_SERVER_SUFFIX, "-debug")) + end= strmov(end, "-debug"); +#endif + if (opt_log || opt_update_log || opt_slow_log || opt_bin_log) + strmov(end, "-log"); // This may slow down system +} + + static char *get_relative_path(const char *path) { if (test_if_hard_path(path) && diff --git a/sql/mysqld_suffix.h b/sql/mysqld_suffix.h new file mode 100644 index 00000000000..502cdeed75f --- /dev/null +++ b/sql/mysqld_suffix.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2000-2004 MySQL 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Set MYSQL_SERVER_SUFFIX + The following code is quite ugly as there is no portable way to set a + string to the value of a macro +*/ + +#if defined(MYSQL_SERVER_SUFFIX_NT) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-nt" +#elif defined(MYSQL_SERVER_SUFFIX_MAX) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-max" +#elif defined(MYSQL_SERVER_SUFFIX_NT_MAX) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-nt-max" +#elif defined(MYSQL_SERVER_SUFFIX_PRO) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-pro" +#elif defined(MYSQL_SERVER_SUFFIX_PRO_NT) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-pro-nt" +#endif diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 3cc64c35223..ddedf4ca3f0 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2313,7 +2313,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree, min_range.length= min_key_length; min_range.flag= (tmp_min_flag & NEAR_MIN ? HA_READ_AFTER_KEY : HA_READ_KEY_EXACT); - max_range.key= param->max_key; + max_range.key= (byte*) param->max_key; max_range.length= max_key_length; max_range.flag= (tmp_max_flag & NEAR_MAX ? HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY); @@ -2826,7 +2826,8 @@ int QUICK_SELECT_DESC::cmp_prev(QUICK_RANGE *range_arg) if (range_arg->flag & NO_MIN_RANGE) return 0; /* key can't be to small */ - cmp= key_cmp(key_part_info, range_arg->min_key, range_arg->min_length); + cmp= key_cmp(key_part_info, (byte*) range_arg->min_key, + range_arg->min_length); if (cmp > 0 || cmp == 0 && !(range_arg->flag & NEAR_MIN)) return 0; return 1; // outside of range diff --git a/sql/set_var.cc b/sql/set_var.cc index 1205eb17357..403304cc7c4 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -107,6 +107,7 @@ static void fix_max_connections(THD *thd, enum_var_type type); static int check_max_delayed_threads(THD *thd, set_var *var); static void fix_thd_mem_root(THD *thd, enum_var_type type); static void fix_trans_mem_root(THD *thd, enum_var_type type); +static void fix_server_id(THD *thd, enum_var_type type); static KEY_CACHE *create_key_cache(const char *name, uint length); void fix_sql_mode_var(THD *thd, enum_var_type type); static byte *get_error_count(THD *thd); @@ -307,7 +308,7 @@ sys_query_cache_wlock_invalidate("query_cache_wlock_invalidate", &SV::query_cache_wlock_invalidate); #endif /* HAVE_QUERY_CACHE */ sys_var_bool_ptr sys_secure_auth("secure_auth", &opt_secure_auth); -sys_var_long_ptr sys_server_id("server_id",&server_id); +sys_var_long_ptr sys_server_id("server_id", &server_id, fix_server_id); sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol", &opt_slave_compressed_protocol); #ifdef HAVE_REPLICATION @@ -444,8 +445,6 @@ sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE); sys_var_const_str sys_license("license", LICENSE); - - /* List of all variables for initialisation and storage in hash This is sorted in alphabetical order to make it easy to add new variables @@ -703,7 +702,7 @@ struct show_var_st init_vars[]= { {sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS}, {sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS}, {sys_low_priority_updates.name, (char*) &sys_low_priority_updates, SHOW_SYS}, - {"lower_case_file_system", (char*) &lower_case_file_system, SHOW_BOOL}, + {"lower_case_file_system", (char*) &lower_case_file_system, SHOW_MY_BOOL}, {"lower_case_table_names", (char*) &lower_case_table_names, SHOW_INT}, {sys_max_allowed_packet.name,(char*) &sys_max_allowed_packet, SHOW_SYS}, {sys_max_binlog_cache_size.name,(char*) &sys_max_binlog_cache_size, SHOW_SYS}, @@ -1134,6 +1133,13 @@ static void fix_trans_mem_root(THD *thd, enum_var_type type) thd->variables.trans_prealloc_size); } + +static void fix_server_id(THD *thd, enum_var_type type) +{ + server_id_supplied = 1; +} + + bool sys_var_long_ptr::update(THD *thd, set_var *var) { ulonglong tmp= var->save_result.ulonglong_value; @@ -1293,11 +1299,11 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) { ulonglong tmp= var->save_result.ulonglong_value; - if ((ulonglong) tmp > max_system_variables.*offset) + if (tmp > max_system_variables.*offset) tmp= max_system_variables.*offset; if (option_limits) - tmp= (ulong) getopt_ull_limit_value(tmp, option_limits); + tmp= getopt_ull_limit_value(tmp, option_limits); if (var->type == OPT_GLOBAL) { /* Lock is needed to make things safe on 32 bit systems */ diff --git a/sql/slave.cc b/sql/slave.cc index 4ce8d5939bc..a66e78f04bc 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -167,13 +167,11 @@ int init_slave() goto err; } - /* - make sure slave thread gets started if server_id is set, - valid master.info is present, and master_host has not been specified - */ if (server_id && !master_host && active_mi->host[0]) master_host= active_mi->host; + /* If server id is not set, start_slave_thread() will say it */ + if (master_host && !opt_skip_slave_start) { if (start_slave_threads(1 /* need mutex */, diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index fbd47d4954d..25ff4c5676b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -953,7 +953,7 @@ ulong acl_get(const char *host, const char *ip, end=strmov((tmp_db=strmov(strmov(key, ip ? ip : "")+1,user)+1),db); if (lower_case_table_names) { - my_casedn_str(&my_charset_latin1, tmp_db); + my_casedn_str(files_charset_info, tmp_db); db=tmp_db; } key_length=(uint) (end-key); @@ -1733,8 +1733,8 @@ GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u, tname= strdup_root(&memex,t); if (lower_case_table_names) { - my_casedn_str(&my_charset_latin1, db); - my_casedn_str(&my_charset_latin1, tname); + my_casedn_str(files_charset_info, db); + my_casedn_str(files_charset_info, tname); } key_length =(uint) strlen(d)+(uint) strlen(u)+(uint) strlen(t)+3; hash_key = (char*) alloc_root(&memex,key_length); @@ -1768,8 +1768,8 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs) } if (lower_case_table_names) { - my_casedn_str(&my_charset_latin1, db); - my_casedn_str(&my_charset_latin1, tname); + my_casedn_str(files_charset_info, db); + my_casedn_str(files_charset_info, tname); } key_length = ((uint) strlen(db) + (uint) strlen(user) + (uint) strlen(tname) + 3); @@ -2416,7 +2416,7 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, if (lower_case_table_names && db) { strmov(tmp_db,db); - my_casedn_str(&my_charset_latin1, tmp_db); + my_casedn_str(files_charset_info, tmp_db); db=tmp_db; } diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index d7d4219c7fd..b9fe61ac48a 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1512,13 +1512,28 @@ ulong Query_cache::init_cache() VOID(hash_init(&queries, &my_charset_bin, def_query_hash_size, 0, 0, query_cache_query_get_key, 0, 0)); #ifndef FN_NO_CASE_SENCE + /* + If lower_case_table_names!=0 then db and table names are already + converted to lower case and we can use binary collation for their + comparison (no matter if file system case sensitive or not). + If we have case-sensitive file system (like on most Unixes) and + lower_case_table_names == 0 then we should distinguish my_table + and MY_TABLE cases and so again can use binary collation. + */ VOID(hash_init(&tables, &my_charset_bin, def_table_hash_size, 0, 0, query_cache_table_get_key, 0, 0)); #else - // windows, OS/2 or other case insensitive file names work around + /* + On windows, OS/2, MacOS X with HFS+ or any other case insensitive + file system if lower_case_table_names!=0 we have same situation as + in previous case, but if lower_case_table_names==0 then we should + not distinguish cases (to be compatible in behavior with underlaying + file system) and so should use case insensitive collation for + comparison. + */ VOID(hash_init(&tables, lower_case_table_names ? &my_charset_bin : - system_charset_info, + files_charset_info, def_table_hash_size, 0, 0,query_cache_table_get_key, 0, 0)); #endif diff --git a/sql/sql_class.h b/sql/sql_class.h index e44c06fda6e..96043efb3a3 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -28,7 +28,7 @@ class Load_log_event; class Slave_log_event; enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE }; -enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY }; +enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME }; enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_IGNORE, DUP_UPDATE }; enum enum_log_type { LOG_CLOSED, LOG_TO_BE_OPENED, LOG_NORMAL, LOG_NEW, LOG_BIN}; enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON, diff --git a/sql/sql_db.cc b/sql/sql_db.cc index bddaebdc0f2..48c355b6cd9 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -18,6 +18,7 @@ /* create and drop of databases */ #include "mysql_priv.h" +#include <mysys_err.h> #include "sql_acl.h" #include <my_dir.h> #include <m_ctype.h> @@ -185,7 +186,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, strxmov(path, mysql_data_home, "/", db, NullS); unpack_dirname(path,path); // Convert if not unix - if (my_stat(path,&stat_info,MYF(MY_WME))) + if (my_stat(path,&stat_info,MYF(0))) { if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS)) { @@ -197,6 +198,11 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, } else { + if (my_errno != ENOENT) + { + my_error(EE_STAT, MYF(0),path,my_errno); + goto exit; + } strend(path)[-1]=0; // Remove last '/' from path if (my_mkdir(path,0777,MYF(0)) < 0) { @@ -366,7 +372,7 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) { /* Convert database to lower case */ strmov(tmp_db, db); - my_casedn_str(system_charset_info, tmp_db); + my_casedn_str(files_charset_info, tmp_db); db= tmp_db; } diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 1579ac3b5c8..fcc56cbf9c9 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -103,7 +103,7 @@ int mysql_ha_closeall(THD *thd, TABLE_LIST *tables) } static enum enum_ha_read_modes rkey_to_rnext[]= - { RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV }; + { RNEXT_SAME, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV }; int mysql_ha_read(THD *thd, TABLE_LIST *tables, @@ -146,7 +146,12 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, char buff[MAX_FIELD_WIDTH]; String buffer(buff, sizeof(buff), system_charset_info); uint num_rows; - it++; + byte *key; + uint key_len; + LINT_INIT(key); + LINT_INIT(key_len); + + it++; // Skip first NULL field insert_fields(thd,tables,tables->db,tables->alias,&it); @@ -194,13 +199,16 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, DBUG_ASSERT(keyname != 0); err=table->file->index_prev(table->record[0]); break; + case RNEXT_SAME: + /* Continue scan on "(keypart1,keypart2,...)=(c1, c2, ...) */ + DBUG_ASSERT(keyname != 0); + err= table->file->index_next_same(table->record[0], key, key_len); + break; case RKEY: { DBUG_ASSERT(keyname != 0); KEY *keyinfo=table->key_info+keyno; KEY_PART_INFO *key_part=keyinfo->key_part; - uint key_len; - byte *key; if (key_expr->elements > keyinfo->key_parts) { my_printf_error(ER_TOO_MANY_KEY_PARTS,ER(ER_TOO_MANY_KEY_PARTS), diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 0d3ab196aa5..f98a6b43846 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -22,8 +22,6 @@ #include <m_ctype.h> #include <hash.h> -LEX_STRING tmp_table_alias= {(char*) "tmp-table",8}; - /* Macros to look like lex */ #define yyGet() *(lex->ptr++) diff --git a/sql/sql_lex.h b/sql/sql_lex.h index b64cc7a074b..b2211fe1b0e 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -533,6 +533,20 @@ typedef class st_select_lex SELECT_LEX; #define ALTER_ORDER 64 #define ALTER_OPTIONS 128 +typedef struct st_alter_info +{ + List<Alter_drop> drop_list; + List<Alter_column> alter_list; + uint flags; + enum enum_enable_or_disable keys_onoff; + enum tablespace_op_type tablespace_op; + bool is_simple; + + st_alter_info(){clear();} + void clear(){keys_onoff= LEAVE_AS_IS;tablespace_op= NO_TABLESPACE_OP;} + void reset(){drop_list.empty();alter_list.empty();clear();} +} ALTER_INFO; + /* The state of the lex parsing. This is saved in the THD struct */ typedef struct st_lex @@ -565,8 +579,6 @@ typedef struct st_lex List<key_part_spec> col_list; List<key_part_spec> ref_list; - List<Alter_drop> drop_list; - List<Alter_column> alter_list; List<String> interval_list; List<LEX_USER> users_list; List<LEX_COLUMN> columns; @@ -594,19 +606,17 @@ typedef struct st_lex enum enum_tx_isolation tx_isolation; enum enum_ha_read_modes ha_read_mode; enum ha_rkey_function ha_rkey_mode; - enum enum_enable_or_disable alter_keys_onoff; enum enum_var_type option_type; - enum tablespace_op_type tablespace_op; uint uint_geom_type; uint grant, grant_tot_col, which_columns; uint fk_delete_opt, fk_update_opt, fk_match_option; uint slave_thd_opt; - uint alter_flags; uint8 describe; bool drop_if_exists, drop_temporary, local_file; - bool in_comment, ignore_space, verbose, simple_alter, no_write_to_binlog; + bool in_comment, ignore_space, verbose, no_write_to_binlog; bool derived_tables; bool safe_to_cache_query; + ALTER_INFO alter_info; /* Prepared statements SQL syntax:*/ LEX_STRING prepared_stmt_name; /* Statement name (in all queries) */ /* @@ -654,6 +664,4 @@ void lex_end(LEX *lex); extern pthread_key(LEX*,THR_LEX); -extern LEX_STRING tmp_table_alias; - #define current_lex (current_thd->lex) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1d5012a97a0..7dcc45457e3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2486,14 +2486,10 @@ unsent_create_error: res= mysql_alter_table(thd, select_lex->db, lex->name, &lex->create_info, tables, lex->create_list, - lex->key_list, lex->drop_list, lex->alter_list, + lex->key_list, select_lex->order_list.elements, (ORDER *) select_lex->order_list.first, - lex->alter_flags, - lex->duplicates, - lex->alter_keys_onoff, - lex->tablespace_op, - lex->simple_alter); + lex->duplicates, &lex->alter_info); } break; } @@ -2632,17 +2628,15 @@ unsent_create_error: lex->create_list.empty(); lex->key_list.empty(); lex->col_list.empty(); - lex->drop_list.empty(); - lex->alter_list.empty(); + lex->alter_info.reset(); bzero((char*) &create_info,sizeof(create_info)); create_info.db_type=DB_TYPE_DEFAULT; create_info.row_type=ROW_TYPE_DEFAULT; create_info.default_table_charset=default_charset_info; res= mysql_alter_table(thd, NullS, NullS, &create_info, tables, lex->create_list, - lex->key_list, lex->drop_list, lex->alter_list, - 0, (ORDER *) 0, 0, - DUP_ERROR); + lex->key_list, 0, (ORDER *) 0, + DUP_ERROR, &lex->alter_info); } else res = mysql_optimize_table(thd, tables, &lex->check_opt); @@ -2872,7 +2866,7 @@ unsent_create_error: if (end_active_trans(thd)) res= -1; else - res = mysql_drop_index(thd, tables, lex->drop_list); + res = mysql_drop_index(thd, tables, &lex->alter_info); break; case SQLCOM_SHOW_DATABASES: #if defined(DONT_ALLOW_SHOW_COMMANDS) @@ -5021,8 +5015,9 @@ Item * all_any_subquery_creator(Item *left_expr, int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys) { List<create_field> fields; - List<Alter_drop> drop; - List<Alter_column> alter; + ALTER_INFO alter_info; + alter_info.flags= ALTER_ADD_INDEX; + alter_info.is_simple= 0; HA_CREATE_INFO create_info; DBUG_ENTER("mysql_create_index"); bzero((char*) &create_info,sizeof(create_info)); @@ -5030,25 +5025,27 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys) create_info.default_table_charset= thd->variables.collation_database; DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, &create_info, table_list, - fields, keys, drop, alter, 0, (ORDER*)0, - ALTER_ADD_INDEX, DUP_ERROR)); + fields, keys, 0, (ORDER*)0, + DUP_ERROR, &alter_info)); } -int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop) +int mysql_drop_index(THD *thd, TABLE_LIST *table_list, ALTER_INFO *alter_info) { List<create_field> fields; List<Key> keys; - List<Alter_column> alter; HA_CREATE_INFO create_info; DBUG_ENTER("mysql_drop_index"); bzero((char*) &create_info,sizeof(create_info)); create_info.db_type=DB_TYPE_DEFAULT; create_info.default_table_charset= thd->variables.collation_database; + alter_info->clear(); + alter_info->flags= ALTER_DROP_INDEX; + alter_info->is_simple= 0; DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, &create_info, table_list, - fields, keys, drop, alter, 0, (ORDER*)0, - ALTER_DROP_INDEX, DUP_ERROR)); + fields, keys, 0, (ORDER*)0, + DUP_ERROR, alter_info)); } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 80634c68ac7..4fb85d9bab7 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -422,7 +422,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path, { if (lower_case_table_names) { - if (wild_case_compare(system_charset_info,file->name,wild)) + if (wild_case_compare(files_charset_info, file->name, wild)) continue; } else if (wild_compare(file->name,wild,0)) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e017bc7e6b5..9fe61e06d83 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1395,11 +1395,11 @@ mysql_rename_table(enum db_type base, { /* Table handler expects to get all file names as lower case */ strmov(tmp_from, old_name); - my_casedn_str(system_charset_info, tmp_from); + my_casedn_str(files_charset_info, tmp_from); old_name= tmp_from; strmov(tmp_to, new_name); - my_casedn_str(system_charset_info, tmp_to); + my_casedn_str(files_charset_info, tmp_to); new_name= tmp_to; } my_snprintf(from, sizeof(from), "%s/%s/%s", @@ -2467,14 +2467,10 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list, int mysql_alter_table(THD *thd,char *new_db, char *new_name, HA_CREATE_INFO *create_info, TABLE_LIST *table_list, - List<create_field> &fields, - List<Key> &keys,List<Alter_drop> &drop_list, - List<Alter_column> &alter_list, - uint order_num, ORDER *order, uint alter_flags, + List<create_field> &fields, List<Key> &keys, + uint order_num, ORDER *order, enum enum_duplicates handle_duplicates, - enum enum_enable_or_disable keys_onoff, - enum tablespace_op_type tablespace_op, - bool simple_alter) + ALTER_INFO *alter_info) { TABLE *table,*new_table; int error; @@ -2499,9 +2495,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, mysql_ha_closeall(thd, table_list); /* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */ - if (tablespace_op != NO_TABLESPACE_OP) + if (alter_info->tablespace_op != NO_TABLESPACE_OP) DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list, - tablespace_op)); + alter_info->tablespace_op)); if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ))) DBUG_RETURN(-1); @@ -2514,10 +2510,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, { if (lower_case_table_names != 2) { - my_casedn_str(system_charset_info, new_name_buff); + my_casedn_str(files_charset_info, new_name_buff); new_alias= new_name; // Create lower case table name } - my_casedn_str(system_charset_info, new_name); + my_casedn_str(files_charset_info, new_name); } if (new_db == db && !my_strcasecmp(table_alias_charset, new_name_buff, table_name)) @@ -2570,7 +2566,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, create_info->row_type=table->row_type; thd->proc_info="setup"; - if (simple_alter && !table->tmp_table) + if (alter_info->is_simple && !table->tmp_table) { error=0; if (new_name != table_name || new_db != db) @@ -2596,7 +2592,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, if (!error) { - switch (keys_onoff) { + switch (alter_info->keys_onoff) { case LEAVE_AS_IS: break; case ENABLE: @@ -2656,9 +2652,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, create_info->default_table_charset= table->table_charset; restore_record(table,default_values); // Empty record for DEFAULT - List_iterator<Alter_drop> drop_it(drop_list); + List_iterator<Alter_drop> drop_it(alter_info->drop_list); List_iterator<create_field> def_it(fields); - List_iterator<Alter_column> alter_it(alter_list); + List_iterator<Alter_column> alter_it(alter_info->alter_list); List<create_field> create_list; // Add new fields here List<Key> key_list; // Add new keys here create_field *def; @@ -2762,9 +2758,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, find_it.after(def); // Put element after this } } - if (alter_list.elements) + if (alter_info->alter_list.elements) { - my_error(ER_BAD_FIELD_ERROR,MYF(0),alter_list.head()->name,table_name); + my_error(ER_BAD_FIELD_ERROR,MYF(0),alter_info->alter_list.head()->name, + table_name); DBUG_RETURN(-1); } if (!create_list.elements) @@ -2864,14 +2861,16 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } } - if (drop_list.elements) + if (alter_info->drop_list.elements) { - my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0),drop_list.head()->name); + my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0), + alter_info->drop_list.head()->name); goto err; } - if (alter_list.elements) + if (alter_info->alter_list.elements) { - my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0),alter_list.head()->name); + my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0), + alter_info->alter_list.head()->name); goto err; } @@ -2880,7 +2879,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, current_pid, thd->thread_id); /* Safety fix for innodb */ if (lower_case_table_names) - my_casedn_str(system_charset_info, tmp_name); + my_casedn_str(files_charset_info, tmp_name); create_info->db_type=new_db_type; if (!create_info->comment) create_info->comment=table->comment; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index e56dd4b476e..70c05489f82 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -355,15 +355,18 @@ int st_select_lex_unit::exec() if (uncacheable || !item || !item->assigned() || describe) { - if (optimized && item && item->assigned()) + if (optimized && item) { - item->assigned(0); // We will reinit & rexecute unit - item->reset(); - table->file->delete_all_rows(); + if (item->assigned()) + { + item->assigned(0); // We will reinit & rexecute unit + item->reset(); + table->file->delete_all_rows(); + } + /* re-enabling indexes for next subselect iteration */ + if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL)) + DBUG_ASSERT(1); } - if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL) && - !describe) - DBUG_RETURN(1); // For sub-selects for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select()) { ha_rows records_at_start= 0; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 605d4cf5ecc..4d5b1ce6172 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1003,11 +1003,7 @@ create: THD *thd= YYTHD; LEX *lex=Lex; lex->sql_command= SQLCOM_CREATE_TABLE; - if (!lex->select_lex.add_table_to_list(thd,$5, - ($2 & - HA_LEX_CREATE_TMP_TABLE ? - &tmp_table_alias : - (LEX_STRING*) 0), + if (!lex->select_lex.add_table_to_list(thd, $5, NULL, TL_OPTION_UPDATING, (using_update_log ? TL_READ_NO_INSERT: @@ -1545,25 +1541,25 @@ attribute: { LEX *lex=Lex; lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.flags|= ALTER_ADD_INDEX; } | opt_primary KEY_SYM { LEX *lex=Lex; lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.flags|= ALTER_ADD_INDEX; } | UNIQUE_SYM { LEX *lex=Lex; lex->type|= UNIQUE_FLAG; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.flags|= ALTER_ADD_INDEX; } | UNIQUE_SYM KEY_SYM { LEX *lex=Lex; lex->type|= UNIQUE_KEY_FLAG; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.flags|= ALTER_ADD_INDEX; } | COMMENT_SYM TEXT_STRING_sys { Lex->comment= &$2; } | BINARY { Lex->type|= BINCMP_FLAG; } @@ -1811,18 +1807,15 @@ alter: lex->create_list.empty(); lex->key_list.empty(); lex->col_list.empty(); - lex->drop_list.empty(); - lex->alter_list.empty(); lex->select_lex.init_order(); lex->select_lex.db=lex->name=0; bzero((char*) &lex->create_info,sizeof(lex->create_info)); lex->create_info.db_type= DB_TYPE_DEFAULT; lex->create_info.default_table_charset= thd->variables.collation_database; lex->create_info.row_type= ROW_TYPE_NOT_USED; - lex->alter_keys_onoff=LEAVE_AS_IS; - lex->tablespace_op=NO_TABLESPACE_OP; - lex->simple_alter=1; - lex->alter_flags=0; + lex->alter_info.clear(); + lex->alter_info.is_simple= 1; + lex->alter_info.flags= 0; } alter_list {} @@ -1835,8 +1828,8 @@ alter: alter_list: - | DISCARD TABLESPACE { Lex->tablespace_op=DISCARD_TABLESPACE; } - | IMPORT TABLESPACE { Lex->tablespace_op=IMPORT_TABLESPACE; } + | DISCARD TABLESPACE { Lex->alter_info.tablespace_op= DISCARD_TABLESPACE; } + | IMPORT TABLESPACE { Lex->alter_info.tablespace_op= IMPORT_TABLESPACE; } | alter_list_item | alter_list ',' alter_list_item; @@ -1845,24 +1838,24 @@ add_column: { LEX *lex=Lex; lex->change=0; - lex->alter_flags|= ALTER_ADD_COLUMN; + lex->alter_info.flags|= ALTER_ADD_COLUMN; }; alter_list_item: - add_column column_def opt_place { Lex->simple_alter=0; } + add_column column_def opt_place { Lex->alter_info.is_simple= 0; } | ADD key_def { LEX *lex=Lex; - lex->simple_alter=0; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_ADD_INDEX; } - | add_column '(' field_list ')' { Lex->simple_alter=0; } + | add_column '(' field_list ')' { Lex->alter_info.is_simple= 0; } | CHANGE opt_column field_ident { LEX *lex=Lex; lex->change= $3.str; - lex->simple_alter=0; - lex->alter_flags|= ALTER_CHANGE_COLUMN; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_CHANGE_COLUMN; } field_spec opt_place | MODIFY_SYM opt_column field_ident @@ -1872,8 +1865,8 @@ alter_list_item: lex->default_value= lex->on_update_value= 0; lex->comment=0; lex->charset= NULL; - lex->simple_alter=0; - lex->alter_flags|= ALTER_CHANGE_COLUMN; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_CHANGE_COLUMN; } type opt_attribute { @@ -1891,50 +1884,51 @@ alter_list_item: | DROP opt_column field_ident opt_restrict { LEX *lex=Lex; - lex->drop_list.push_back(new Alter_drop(Alter_drop::COLUMN, - $3.str)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_DROP_COLUMN; + lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::COLUMN, + $3.str)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_DROP_COLUMN; } - | DROP FOREIGN KEY_SYM opt_ident { Lex->simple_alter=0; } + | DROP FOREIGN KEY_SYM opt_ident { Lex->alter_info.is_simple= 0; } | DROP PRIMARY_SYM KEY_SYM { LEX *lex=Lex; - lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, - primary_key_name)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_DROP_INDEX; + lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, + primary_key_name)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_DROP_INDEX; } | DROP key_or_index field_ident { LEX *lex=Lex; - lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, - $3.str)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_DROP_INDEX; + lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, + $3.str)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_DROP_INDEX; } - | DISABLE_SYM KEYS { Lex->alter_keys_onoff=DISABLE; } - | ENABLE_SYM KEYS { Lex->alter_keys_onoff=ENABLE; } + | DISABLE_SYM KEYS { Lex->alter_info.keys_onoff= DISABLE; } + | ENABLE_SYM KEYS { Lex->alter_info.keys_onoff= ENABLE; } | ALTER opt_column field_ident SET DEFAULT signed_literal { LEX *lex=Lex; - lex->alter_list.push_back(new Alter_column($3.str,$6)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_CHANGE_COLUMN; + lex->alter_info.alter_list.push_back(new Alter_column($3.str,$6)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_CHANGE_COLUMN; } | ALTER opt_column field_ident DROP DEFAULT { LEX *lex=Lex; - lex->alter_list.push_back(new Alter_column($3.str,(Item*) 0)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_CHANGE_COLUMN; + lex->alter_info.alter_list.push_back(new Alter_column($3.str, + (Item*) 0)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_CHANGE_COLUMN; } | RENAME opt_to table_ident { LEX *lex=Lex; lex->select_lex.db=$3->db.str; lex->name= $3->table.str; - lex->alter_flags|= ALTER_RENAME; + lex->alter_info.flags|= ALTER_RENAME; } | CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate { @@ -1955,19 +1949,19 @@ alter_list_item: lex->create_info.default_table_charset= $5; lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET); - lex->simple_alter= 0; + lex->alter_info.is_simple= 0; } | create_table_options_space_separated { LEX *lex=Lex; - lex->simple_alter=0; - lex->alter_flags|= ALTER_OPTIONS; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_OPTIONS; } | order_clause { LEX *lex=Lex; - lex->simple_alter=0; - lex->alter_flags|= ALTER_ORDER; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_ORDER; }; opt_column: @@ -3866,9 +3860,9 @@ drop: { LEX *lex=Lex; lex->sql_command= SQLCOM_DROP_INDEX; - lex->drop_list.empty(); - lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, - $3.str)); + lex->alter_info.drop_list.empty(); + lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, + $3.str)); if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL, TL_OPTION_UPDATING)) YYABORT; |