From 573227ec7360d41da5d0df71fc1a65768c92aea2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Jul 2003 14:11:01 +0500 Subject: [PATCH 01/40] SCRUM: Task 499 'init_connect, init_slave options' mysql-test/mysql-test-run.sh: Task 499 'init_connect, init_slave options' This change needs because mysql-test-run cuts string variable on first space sql/mysql_priv.h: Task 499 'init_connect, init_slave options' sql/mysqld.cc: Task 499 'init_connect, init_slave options' sql/protocol.cc: Task 499 'init_connect, init_slave options' sql/set_var.cc: Task 499 'init_connect, init_slave options' sql/set_var.h: Task 499 'init_connect, init_slave options' sql/slave.cc: Task 499 'init_connect, init_slave options' sql/sql_class.cc: Task 499 'init_connect, init_slave options' sql/sql_class.h: Task 499 'init_connect, init_slave options' sql/sql_parse.cc: Task 499 'init_connect, init_slave options' sql/sql_show.cc: Task 499 'init_connect, init_slave options' --- mysql-test/mysql-test-run.sh | 2 +- mysql-test/r/init_connect.result | 24 +++++++ mysql-test/r/rpl_init_slave.result | 23 +++++++ mysql-test/t/init_connect-master.opt | 1 + mysql-test/t/init_connect.test | 34 ++++++++++ mysql-test/t/rpl_init_slave-slave.opt | 1 + mysql-test/t/rpl_init_slave.test | 26 ++++++++ sql/mysql_priv.h | 2 +- sql/mysqld.cc | 29 ++++++++- sql/protocol.cc | 2 + sql/set_var.cc | 91 +++++++++++++++++++++++++++ sql/set_var.h | 3 + sql/slave.cc | 32 ++++++++++ sql/sql_class.cc | 1 + sql/sql_class.h | 1 + sql/sql_parse.cc | 50 ++++++++++++++- sql/sql_show.cc | 7 ++- 17 files changed, 319 insertions(+), 10 deletions(-) create mode 100644 mysql-test/r/init_connect.result create mode 100644 mysql-test/r/rpl_init_slave.result create mode 100644 mysql-test/t/init_connect-master.opt create mode 100644 mysql-test/t/init_connect.test create mode 100644 mysql-test/t/rpl_init_slave-slave.opt create mode 100644 mysql-test/t/rpl_init_slave.test diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 137e99f48b3..502644ad588 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -775,7 +775,7 @@ manager_launch() ident=$1 shift if [ $USE_MANAGER = 0 ] ; then - $@ >> $CUR_MYERR 2>&1 & + echo $@ | /bin/sh >> $CUR_MYERR 2>&1 & sleep 2 #hack return fi diff --git a/mysql-test/r/init_connect.result b/mysql-test/r/init_connect.result new file mode 100644 index 00000000000..3f8e726c775 --- /dev/null +++ b/mysql-test/r/init_connect.result @@ -0,0 +1,24 @@ +select hex(@a); +hex(@a) +NULL +select hex(@a); +hex(@a) +610063 +set global init_connect="set @a=2;set @b=3"; +select @a, @b; +@a @b +2 3 +set GLOBAL init_connect=DEFAULT; +select @a; +@a +NULL +set global init_connect="create table t1(a char(10));\ +insert into t1 values ('\0');insert into t1 values('abc')"; +select hex(a) from t1; +hex(a) +00 +616263 +set GLOBAL init_connect="adsfsdfsdfs"; +select @a; +ERROR HY000: Lost connection to MySQL server during query +drop table t1; diff --git a/mysql-test/r/rpl_init_slave.result b/mysql-test/r/rpl_init_slave.result new file mode 100644 index 00000000000..a91b2da85cd --- /dev/null +++ b/mysql-test/r/rpl_init_slave.result @@ -0,0 +1,23 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +reset master; +create table t1(n int); +insert into t1 values (@a), (@b); +select * from t1; +n +NULL +NULL +select * from t1; +n +1 +2 +set global init_connect="set @c=1"; +show variables like 'init_connect'; +Variable_name Value +init_connect set @c=1 +drop table t1; +stop slave; diff --git a/mysql-test/t/init_connect-master.opt b/mysql-test/t/init_connect-master.opt new file mode 100644 index 00000000000..e3316c2def5 --- /dev/null +++ b/mysql-test/t/init_connect-master.opt @@ -0,0 +1 @@ +--set-variable=init_connect="set @a='a\0c'" diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test new file mode 100644 index 00000000000..563ec6178d0 --- /dev/null +++ b/mysql-test/t/init_connect.test @@ -0,0 +1,34 @@ +# +# Test of init_connect variable +# + +connect (con0,localhost,root,,); +connection con0; +select hex(@a); +connect (con1,localhost,user_1,,); +connection con1; +select hex(@a); +connection con0; +set global init_connect="set @a=2;set @b=3"; +connect (con2,localhost,user_1,,); +connection con2; +select @a, @b; +connection con0; +set GLOBAL init_connect=DEFAULT; +connect (con3,localhost,user_1,,); +connection con3; +select @a; +connection con0; +set global init_connect="create table t1(a char(10));\ +insert into t1 values ('\0');insert into t1 values('abc')"; +connect (con4,localhost,user_1,,); +connection con4; +select hex(a) from t1; +connection con0; +set GLOBAL init_connect="adsfsdfsdfs"; +connect (con5,localhost,user_1,,); +connection con5; +--error 2013 +select @a; +connection con0; +drop table t1; diff --git a/mysql-test/t/rpl_init_slave-slave.opt b/mysql-test/t/rpl_init_slave-slave.opt new file mode 100644 index 00000000000..6433dccf4aa --- /dev/null +++ b/mysql-test/t/rpl_init_slave-slave.opt @@ -0,0 +1 @@ +--init-slave="set @a=1;set @b=2" diff --git a/mysql-test/t/rpl_init_slave.test b/mysql-test/t/rpl_init_slave.test new file mode 100644 index 00000000000..67d35546225 --- /dev/null +++ b/mysql-test/t/rpl_init_slave.test @@ -0,0 +1,26 @@ +source include/master-slave.inc; + +# +# Test of init_slave variable +# + +save_master_pos; +connection slave; +sync_with_master; +reset master; +connection master; +create table t1(n int); +insert into t1 values (@a), (@b); +select * from t1; +save_master_pos; +connection slave; +sync_with_master; +select * from t1; +set global init_connect="set @c=1"; +show variables like 'init_connect'; +connection master; +drop table t1; +save_master_pos; +connection slave; +sync_with_master; +stop slave; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 65451ca40b5..5da81422298 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -769,7 +769,7 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open, LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone, LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_system_variables; -extern rw_lock_t LOCK_grant; +extern rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager; extern pthread_attr_t connection_attrib; extern I_List threads; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 709ba036f7e..df539776b19 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -300,7 +300,8 @@ char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN]; char* log_error_file_ptr= log_error_file; char mysql_real_data_home[FN_REFLEN], language[LIBLEN],reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN], - max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file; + max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file, + *opt_init_connect, *opt_init_slave; 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; @@ -344,7 +345,7 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count, LOCK_crypt, LOCK_bytes_sent, LOCK_bytes_received, LOCK_global_system_variables, LOCK_user_conn, LOCK_slave_list, LOCK_active_mi; -rw_lock_t LOCK_grant; +rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; pthread_cond_t COND_refresh,COND_thread_count, COND_slave_stopped, COND_slave_start; pthread_cond_t COND_thread_cache,COND_flush_thread_cache; @@ -883,6 +884,8 @@ void clean_up(bool print_message) #endif if (defaults_argv) free_defaults(defaults_argv); + my_free(sys_init_connect.value, MYF(MY_ALLOW_ZERO_PTR)); + my_free(sys_init_slave.value, MYF(MY_ALLOW_ZERO_PTR)); free_tmpdir(&mysql_tmpdir_list); #ifdef HAVE_REPLICATION my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR)); @@ -949,6 +952,8 @@ static void clean_up_mutexes() (void) pthread_cond_destroy(&COND_rpl_status); #endif (void) pthread_mutex_destroy(&LOCK_active_mi); + (void) rwlock_destroy(&LOCK_sys_init_connect); + (void) rwlock_destroy(&LOCK_sys_init_slave); (void) pthread_mutex_destroy(&LOCK_global_system_variables); (void) pthread_cond_destroy(&COND_thread_count); (void) pthread_cond_destroy(&COND_refresh); @@ -2056,6 +2061,14 @@ static int init_common_variables(const char *conf_file_name, int argc, global_system_variables.character_set_client= default_charset_info; global_system_variables.collation_connection= default_charset_info; + sys_init_connect.value_length= 0; + if ((sys_init_connect.value= opt_init_connect)) + sys_init_connect.value_length= strlen(opt_init_connect); + + sys_init_slave.value_length= 0; + if ((sys_init_slave.value= opt_init_slave)) + sys_init_slave.value_length= strlen(opt_init_slave); + if (use_temp_pool && bitmap_init(&temp_pool,1024,1)) return 1; return 0; @@ -2081,6 +2094,8 @@ static int init_thread_environment() (void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST); + (void) my_rwlock_init(&LOCK_sys_init_connect, NULL); + (void) my_rwlock_init(&LOCK_sys_init_slave, NULL); (void) my_rwlock_init(&LOCK_grant, NULL); (void) pthread_cond_init(&COND_thread_count,NULL); (void) pthread_cond_init(&COND_refresh,NULL); @@ -3472,7 +3487,9 @@ enum options OPT_EXPIRE_LOGS_DAYS, OPT_DEFAULT_WEEK_FORMAT, OPT_GROUP_CONCAT_MAX_LEN, - OPT_DEFAULT_COLLATION + OPT_DEFAULT_COLLATION, + OPT_INIT_CONNECT, + OPT_INIT_SLAVE }; @@ -3638,6 +3655,12 @@ Disable with --skip-bdb (will save memory).", #endif /* End HAVE_INNOBASE_DB */ {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"init-connect", OPT_INIT_CONNECT, "Command what executes for all new connections", + (gptr*) &opt_init_connect, (gptr*) &opt_init_connect, 0, GET_STR_ALLOC, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"init-slave", OPT_INIT_SLAVE, "Command what is executed when replication is starting", + (gptr*) &opt_init_slave, (gptr*) &opt_init_slave, 0, GET_STR_ALLOC, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, {"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.", (gptr*) &opt_init_file, (gptr*) &opt_init_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/sql/protocol.cc b/sql/protocol.cc index 1b9256c7723..c2b1557ab39 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -92,6 +92,7 @@ void send_error(THD *thd, uint sql_errno, const char *err) /* In bootstrap it's ok to print on stderr */ fprintf(stderr,"ERROR: %d %s\n",sql_errno,err); } + thd->init_connect_error= 1; DBUG_VOID_RETURN; } @@ -210,6 +211,7 @@ net_printf(THD *thd, uint errcode, ...) fprintf(stderr,"ERROR: %d %s\n",errcode,text_pos); thd->fatal_error(); } + thd->init_connect_error= 1; DBUG_VOID_RETURN; } diff --git a/sql/set_var.cc b/sql/set_var.cc index cb6c875d513..29ca3dc951c 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -75,6 +75,10 @@ TYPELIB delay_key_write_typelib= static bool sys_check_charset(THD *thd, set_var *var); static bool sys_update_charset(THD *thd, set_var *var); static void sys_set_default_charset(THD *thd, enum_var_type type); +static bool sys_update_init_connect(THD*, set_var*); +static void sys_default_init_connect(THD*, enum_var_type type); +static bool sys_update_init_slave(THD*, set_var*); +static void sys_default_init_slave(THD*, enum_var_type type); static bool set_option_bit(THD *thd, set_var *var); static bool set_option_autocommit(THD *thd, set_var *var); static bool set_log_update(THD *thd, set_var *var); @@ -109,6 +113,12 @@ sys_var_str sys_charset_system("character_set_system", sys_check_charset, sys_update_charset, sys_set_default_charset); +sys_var_str sys_init_connect("init_connect", 0, + sys_update_init_connect, + sys_default_init_connect); +sys_var_str sys_init_slave("init_slave", 0, + sys_update_init_slave, + sys_default_init_slave); sys_var_character_set_database sys_character_set_database("character_set_database"); sys_var_character_set_client sys_character_set_client("character_set_client"); sys_var_character_set_connection sys_character_set_connection("character_set_connection"); @@ -386,6 +396,8 @@ sys_var *sys_variables[]= &sys_foreign_key_checks, &sys_group_concat_max_len, &sys_identity, + &sys_init_connect, + &sys_init_slave, &sys_insert_id, &sys_interactive_timeout, &sys_join_buffer_size, @@ -522,6 +534,8 @@ struct show_var_st init_vars[]= { {"have_openssl", (char*) &have_openssl, SHOW_HAVE}, {"have_query_cache", (char*) &have_query_cache, SHOW_HAVE}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, + {"init_connect", (char*) &sys_init_connect, SHOW_SYS}, + {"init_slave", (char*) &sys_init_slave, SHOW_SYS}, #ifdef HAVE_INNOBASE_DB {"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG }, {"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG }, @@ -659,6 +673,83 @@ struct show_var_st init_vars[]= { Functions to check and update variables */ + +static bool sys_update_init_connect(THD *thd, set_var *var) +{ + char *res= 0, *old_value; + uint new_length; + /* If the string is "", delete old init command */ + if ((new_length= var->value->str_value.length())) + { + if (!(res= my_strdup_with_length(var->value->str_value.c_ptr(), + new_length, + MYF(0)))) + return 1; + } + /* + Replace the old value in such a way that the any thread using + the value will work. + */ + rw_wrlock(&LOCK_sys_init_connect); + old_value= sys_init_connect.value; + sys_init_connect.value= res; + sys_init_connect.value_length= new_length; + rw_unlock(&LOCK_sys_init_connect); + my_free(old_value, MYF(MY_ALLOW_ZERO_PTR)); + return 0; +} + + +static void sys_default_init_connect(THD* thd, enum_var_type type) +{ + char *old_value; + rw_wrlock(&LOCK_sys_init_connect); + old_value= sys_init_connect.value; + sys_init_connect.value= 0; + sys_init_connect.value_length= 0; + rw_unlock(&LOCK_sys_init_connect); + my_free(old_value, MYF(MY_ALLOW_ZERO_PTR)); +} + + +static bool sys_update_init_slave(THD *thd, set_var *var) +{ + char *res= 0, *old_value; + uint new_length; + /* If the string is "", delete old init command */ + if ((new_length= var->value->str_value.length())) + { + if (!(res= my_strdup_with_length(var->value->str_value.c_ptr(), + new_length, + MYF(0)))) + return 1; + } + /* + Replace the old value in such a way that the any thread using + the value will work. + */ + rw_wrlock(&LOCK_sys_init_slave); + old_value= sys_init_slave.value; + sys_init_slave.value= res; + sys_init_slave.value_length= new_length; + rw_unlock(&LOCK_sys_init_slave); + my_free(old_value, MYF(MY_ALLOW_ZERO_PTR)); + return 0; +} + + +static void sys_default_init_slave(THD* thd, enum_var_type type) +{ + char *old_value; + rw_wrlock(&LOCK_sys_init_slave); + old_value= sys_init_slave.value; + sys_init_slave.value= 0; + sys_init_slave.value_length= 0; + rw_unlock(&LOCK_sys_init_slave); + my_free(old_value, MYF(MY_ALLOW_ZERO_PTR)); +} + + /* The following 3 functions need to be changed in 4.1 when we allow one to change character sets diff --git a/sql/set_var.h b/sql/set_var.h index 978aba3384a..3b11528e7dc 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -137,6 +137,7 @@ class sys_var_str :public sys_var { public: char *value; // Pointer to allocated string + uint value_length; sys_check_func check_func; sys_update_func update_func; sys_set_default_func set_default_func; @@ -704,6 +705,8 @@ int sql_set_variables(THD *thd, List *var_list); void fix_delay_key_write(THD *thd, enum_var_type type); ulong fix_sql_mode(ulong sql_mode); extern sys_var_str sys_charset_system; +extern sys_var_str sys_init_connect; +extern sys_var_str sys_init_slave; CHARSET_INFO *get_old_charset_by_name(const char *old_name); gptr find_named(I_List *list, const char *name, uint length); void delete_elements(I_List *list, void (*free_element)(gptr)); diff --git a/sql/slave.cc b/sql/slave.cc index c45c11f8bef..b9da8c7eca6 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2448,6 +2448,24 @@ err: } +void init_slave_execute(THD *thd, sys_var_str *init_slave_var) +{ + Vio* save_vio; + ulong save_client_capabilities; + + thd->proc_info= "Execution of init_slave"; + thd->query= init_slave_var->value; + thd->query_length= init_slave_var->value_length; + save_client_capabilities= thd->client_capabilities; + thd->client_capabilities|= CLIENT_MULTI_QUERIES; + save_vio= thd->net.vio; + thd->net.vio= 0; + dispatch_command(COM_QUERY, thd, thd->query, thd->query_length+1); + thd->client_capabilities= save_client_capabilities; + thd->net.vio= save_vio; +} + + /* Slave SQL Thread entry point */ extern "C" pthread_handler_decl(handle_slave_sql,arg) @@ -2530,6 +2548,20 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME, llstr(rli->group_master_log_pos,llbuff),rli->group_relay_log_name, llstr(rli->group_relay_log_pos,llbuff1)); + /* execute init_slave variable */ + if (sys_init_slave.value) + { + rw_wrlock(&LOCK_sys_init_slave); + init_slave_execute(thd, &sys_init_slave); + rw_unlock(&LOCK_sys_init_slave); + if (thd->query_error) + { + sql_print_error("\ +Slave SQL thread aborted. Can't execute init_slave query"); + goto err; + } + } + /* Read queries from the IO/THREAD until this thread is killed */ while (!sql_slave_killed(thd,rli)) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c233ffd422a..8677c262437 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -121,6 +121,7 @@ THD::THD():user_time(0), is_fatal_error(0), system_thread=cleanup_done=0; peer_port= 0; // For SHOW PROCESSLIST transaction.changed_tables = 0; + init_connect_error= 0; #ifdef __WIN__ real_id = 0; #endif diff --git a/sql/sql_class.h b/sql/sql_class.h index f6336cb7dd9..900c17a8743 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -560,6 +560,7 @@ public: bool prepare_command; bool tmp_table_used; + bool init_connect_error; /* If we do a purge of binary logs, log index info of the threads that are currently reading it needs to be adjusted. To do that diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9e670a97e92..f2e268abcd2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -794,6 +794,24 @@ check_connections(THD *thd) } +void init_connect_execute(THD *thd, sys_var_str *init_connect_var) +{ + Vio* save_vio; + ulong save_client_capabilities; + + thd->proc_info= "Execution of init_connect"; + thd->query= init_connect_var->value; + thd->query_length= init_connect_var->value_length; + save_client_capabilities= thd->client_capabilities; + thd->client_capabilities|= CLIENT_MULTI_QUERIES; + save_vio= thd->net.vio; + thd->net.vio= 0; + dispatch_command(COM_QUERY, thd, thd->query, thd->query_length+1); + thd->client_capabilities= save_client_capabilities; + thd->net.vio= save_vio; +} + + pthread_handler_decl(handle_one_connection,arg) { THD *thd=(THD*) arg; @@ -866,9 +884,35 @@ pthread_handler_decl(handle_one_connection,arg) if (thd->client_capabilities & CLIENT_COMPRESS) net->compress=1; // Use compression - thd->proc_info=0; // Remove 'login' - thd->command=COM_SLEEP; - thd->version=refresh_version; + thd->version= refresh_version; + if (sys_init_connect.value && !(thd->master_access & SUPER_ACL)) + { + rw_wrlock(&LOCK_sys_init_connect); + init_connect_execute(thd, &sys_init_connect); + rw_unlock(&LOCK_sys_init_connect); + if (thd->init_connect_error) + { + if (thd->user_connect) + decrease_user_connections(thd->user_connect); + free_root(&thd->mem_root,MYF(0)); + if (!thd->killed && thd->variables.log_warnings) + { + sql_print_error(ER(ER_NEW_ABORTING_CONNECTION), + thd->thread_id,(thd->db ? thd->db : "unconnected"), + thd->user ? thd->user : "unauthenticated", + thd->host_or_ip, + "Can't execute init_connect query"); + statistic_increment(aborted_threads,&LOCK_status); + } + else if (thd->killed) + { + statistic_increment(aborted_threads,&LOCK_status); + } + goto end_thread; + } + } + + thd->proc_info=0; thd->set_time(); thd->init_for_queries(); while (!net->error && net->vio != 0 && !thd->killed) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e8cb59e387e..42c89db9ca4 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1587,9 +1587,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, break; } case SHOW_CHAR: - pos= value; - end= strend(pos); + { + if (!(pos= value)) + pos= ""; + end= strend(pos); break; + } case SHOW_STARTTIME: nr= (long) (thd->query_start() - start_time); end= int10_to_str(nr, buff, 10); From 72699882bd149b3c4da5c2a85d78a7ab8db91f1d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 31 Oct 2003 16:24:55 -0400 Subject: [PATCH 02/40] fixed bug #1688 "CREATE TABLE ... SELECT with default()" --- mysql-test/r/create.result | 16 ++++++++++++++++ mysql-test/t/create.test | 7 +++++++ sql/sql_select.cc | 1 + 3 files changed, 24 insertions(+) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index d61614180b3..4e83f195ed2 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -411,6 +411,22 @@ a b c d e f g h dd 1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00 2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00 drop table t1, t2; +create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14'); +insert into t1 values ('','',0,0.0); +describe t1; +Field Type Null Key Default Extra +str varchar(10) YES def +strnull varchar(10) YES NULL +intg int(11) YES 10 +rel double YES 3.14 +create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1; +describe t2; +Field Type Null Key Default Extra +str varchar(10) YES NULL +strnull varchar(10) YES NULL +intg int(11) YES NULL +rel double YES NULL +drop table t1, t2; drop database if exists test_$1; create database test_$1; use test_$1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 059808161a3..826027b977d 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -318,6 +318,13 @@ select * from t2; drop table t1, t2; +create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14'); +insert into t1 values ('','',0,0.0); +describe t1; +create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1; +describe t2; +drop table t1, t2; + # # Bug #1209 # diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9bdb989b6a1..4fb3d70f941 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4473,6 +4473,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, return 0; // Error } case Item::FIELD_ITEM: + case Item::DEFAULT_VALUE_ITEM: { Field *org_field=((Item_field*) item)->field,*new_field; From 2e82008bacf85acafa1d657616690e442f997686 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Dec 2003 19:05:26 +0100 Subject: [PATCH 03/40] fix for my_mbcharlen(charset, c) to return 1 for single-byte characters (isn't it obvious ?) mysys/charset.c: all charsets support my_mbcharlen - no need to protect it with use_mb() sql/sql_load.cc: all charsets support my_mbcharlen - no need to protect it with use_mb() --- mysys/charset.c | 2 +- sql/sql_load.cc | 5 ++--- strings/ctype-big5.c | 2 +- strings/ctype-euc_kr.c | 2 +- strings/ctype-gb2312.c | 2 +- strings/ctype-gbk.c | 2 +- strings/ctype-sjis.c | 2 +- strings/ctype-ujis.c | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mysys/charset.c b/mysys/charset.c index e97ac0675d6..4111dd246cb 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -82,7 +82,7 @@ static void init_state_maps(CHARSET_INFO *cs) else if (my_isdigit(cs,i)) state_map[i]=(uchar) MY_LEX_NUMBER_IDENT; #if defined(USE_MB) && defined(USE_MB_IDENT) - else if (use_mb(cs) && (my_mbcharlen(cs, i)>1)) + else if (my_mbcharlen(cs, i)>1) state_map[i]=(uchar) MY_LEX_IDENT; #endif else if (!my_isgraph(cs,i)) diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 0e7895689b5..0f39ab2663f 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -759,8 +759,7 @@ int READ_INFO::read_field() { chr = GET; #ifdef USE_MB - if (use_mb(read_charset) && - (my_mbcharlen(read_charset, chr) >1 )&& + if ((my_mbcharlen(read_charset, chr) > 1) && to+my_mbcharlen(read_charset, chr) <= end_of_buff) { uchar* p = (uchar*)to; @@ -946,7 +945,7 @@ int READ_INFO::next_line() { int chr = GET; #ifdef USE_MB - if (use_mb(read_charset) && (my_mbcharlen(read_charset, chr) >1 )) + if (my_mbcharlen(read_charset, chr) > 1) { for (int i=1; chr != my_b_EOF && i Date: Sat, 6 Dec 2003 23:21:09 +0100 Subject: [PATCH 04/40] QUERY_NO_GOOD_INDEX_USED and QUERY_NO_INDEX_USED moved from thd->lex.select_lex->options to thd->server_status mysql-test/r/union.result: union and slow log tests mysql-test/t/union.test: union and slow log tests --- include/mysql_com.h | 2 + mysql-test/r/union.result | 38 +++++++++++++++++++ mysql-test/t/union-master.opt | 1 + mysql-test/t/union.test | 26 +++++++++++-- sql/mysql_priv.h | 69 ++++++++++++++++------------------- sql/sql_delete.cc | 2 +- sql/sql_parse.cc | 8 ++-- sql/sql_select.cc | 8 ++-- sql/sql_update.cc | 2 +- 9 files changed, 107 insertions(+), 49 deletions(-) create mode 100644 mysql-test/t/union-master.opt diff --git a/include/mysql_com.h b/include/mysql_com.h index 39e9c48146d..2036b3d0ac2 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -124,6 +124,8 @@ enum enum_server_command #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ #define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */ #define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */ +#define SERVER_QUERY_NO_GOOD_INDEX_USED 16 +#define SERVER_QUERY_NO_INDEX_USED 32 #define MYSQL_ERRMSG_SIZE 512 #define NET_READ_TIMEOUT 30 /* Timeout on read */ diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 241b9847c02..642c07904b5 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -823,3 +823,41 @@ count(*) 13 drop table t1,t2; set local tmp_table_size=default; +create table t1 (a int, index (a), b int); +insert t1 values (1,1),(2,2),(3,3),(4,4),(5,5); +insert t1 select a+1, a+b from t1; +insert t1 select a+1, a+b from t1; +insert t1 select a+1, a+b from t1; +insert t1 select a+1, a+b from t1; +insert t1 select a+1, a+b from t1; +FLUSH STATUS; +show status like 'Slow_queries'; +Variable_name Value +Slow_queries 0 +select count(*) from t1 where a=7; +count(*) +26 +show status like 'Slow_queries'; +Variable_name Value +Slow_queries 0 +select count(*) from t1 where b=13; +count(*) +10 +show status like 'Slow_queries'; +Variable_name Value +Slow_queries 1 +select count(*) from t1 where b=13 union select count(*) from t1 where a=7; +count(*) +0 +26 +show status like 'Slow_queries'; +Variable_name Value +Slow_queries 2 +select count(*) from t1 where a=7 union select count(*) from t1 where b=13; +count(*) +26 +10 +show status like 'Slow_queries'; +Variable_name Value +Slow_queries 3 +drop table t1; diff --git a/mysql-test/t/union-master.opt b/mysql-test/t/union-master.opt new file mode 100644 index 00000000000..3eb98fc3d6b --- /dev/null +++ b/mysql-test/t/union-master.opt @@ -0,0 +1 @@ +--log-slow-queries --log-long-format --log-queries-not-using-indexes diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index e302378e117..a5cb1ce6b6e 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -416,9 +416,6 @@ create table t1 select _latin2"test" union select _latin2"testt" ; show create table t1; drop table t1; -# -# conversion memory->disk table -# # # conversion memory->disk table # @@ -436,3 +433,26 @@ select count(*) from t1; select count(*) from t2; drop table t1,t2; set local tmp_table_size=default; + +# +# slow logging +# +create table t1 (a int, index (a), b int); +insert t1 values (1,1),(2,2),(3,3),(4,4),(5,5); +insert t1 select a+1, a+b from t1; +insert t1 select a+1, a+b from t1; +insert t1 select a+1, a+b from t1; +insert t1 select a+1, a+b from t1; +insert t1 select a+1, a+b from t1; +FLUSH STATUS; +show status like 'Slow_queries'; +select count(*) from t1 where a=7; +show status like 'Slow_queries'; +select count(*) from t1 where b=13; +show status like 'Slow_queries'; +select count(*) from t1 where b=13 union select count(*) from t1 where a=7; +show status like 'Slow_queries'; +select count(*) from t1 where a=7 union select count(*) from t1 where b=13; +show status like 'Slow_queries'; +drop table t1; + diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 4e2be96b9c7..62494da45d4 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -177,50 +177,45 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; #define TEST_SIGINT 1024 /* Allow sigint on threads */ /* options for select set by the yacc parser (stored in lex->options) */ -#define SELECT_DISTINCT 1 -#define SELECT_STRAIGHT_JOIN 2 -#define SELECT_DESCRIBE 4 -#define SELECT_SMALL_RESULT 8 -#define SELECT_BIG_RESULT 16 -#define OPTION_FOUND_ROWS 32 -#define OPTION_TO_QUERY_CACHE 64 -#define SELECT_NO_JOIN_CACHE 256 /* Intern */ - -#define OPTION_BIG_TABLES 512 /* for SQL OPTION */ -#define OPTION_BIG_SELECTS 1024 /* for SQL OPTION */ -#define OPTION_LOG_OFF 2048 -#define OPTION_UPDATE_LOG 4096 /* update log flag */ -#define TMP_TABLE_ALL_COLUMNS 8192 -#define OPTION_WARNINGS 16384 -#define OPTION_AUTO_IS_NULL 32768 -#define OPTION_FOUND_COMMENT 65536L -#define OPTION_SAFE_UPDATES OPTION_FOUND_COMMENT*2 -#define OPTION_BUFFER_RESULT OPTION_SAFE_UPDATES*2 -#define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2 -#define OPTION_NOT_AUTOCOMMIT OPTION_BIN_LOG*2 -#define OPTION_BEGIN OPTION_NOT_AUTOCOMMIT*2 -#define OPTION_TABLE_LOCK OPTION_BEGIN*2 -#define OPTION_QUICK OPTION_TABLE_LOCK*2 -#define OPTION_QUOTE_SHOW_CREATE OPTION_QUICK*2 -#define OPTION_INTERNAL_SUBTRANSACTIONS OPTION_QUOTE_SHOW_CREATE*2 - -/* options for UNION set by the yacc parser (stored in unit->union_option) */ -#define UNION_ALL 1 +#define SELECT_DISTINCT (1L << 0) +#define SELECT_STRAIGHT_JOIN (1L << 1) +#define SELECT_DESCRIBE (1L << 2) +#define SELECT_SMALL_RESULT (1L << 3) +#define SELECT_BIG_RESULT (1L << 4) +#define OPTION_FOUND_ROWS (1L << 5) +#define OPTION_TO_QUERY_CACHE (1L << 6) +#define SELECT_NO_JOIN_CACHE (1L << 7) /* Intern */ +#define OPTION_BIG_TABLES (1L << 8) /* for SQL OPTION */ +#define OPTION_BIG_SELECTS (1L << 9) /* for SQL OPTION */ +#define OPTION_LOG_OFF (1L << 10) +#define OPTION_UPDATE_LOG (1L << 11) /* update log flag */ +#define TMP_TABLE_ALL_COLUMNS (1L << 12) +#define OPTION_WARNINGS (1L << 13) +#define OPTION_AUTO_IS_NULL (1L << 14) +#define OPTION_FOUND_COMMENT (1L << 15) +#define OPTION_SAFE_UPDATES (1L << 16) +#define OPTION_BUFFER_RESULT (1L << 17) +#define OPTION_BIN_LOG (1L << 18) +#define OPTION_NOT_AUTOCOMMIT (1L << 19) +#define OPTION_BEGIN (1L << 20) +#define OPTION_TABLE_LOCK (1L << 21) +#define OPTION_QUICK (1L << 22) +#define OPTION_QUOTE_SHOW_CREATE (1L << 23) +#define OPTION_INTERNAL_SUBTRANSACTIONS (1L << 24) /* Set if we are updating a non-transaction safe table */ -#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_INTERNAL_SUBTRANSACTIONS*2 +#define OPTION_STATUS_NO_TRANS_UPDATE (1L << 25) -/* The following is set when parsing the query */ -#define QUERY_NO_INDEX_USED OPTION_STATUS_NO_TRANS_UPDATE*2 -#define QUERY_NO_GOOD_INDEX_USED QUERY_NO_INDEX_USED*2 /* The following can be set when importing tables in a 'wrong order' to suppress foreign key checks */ -#define OPTION_NO_FOREIGN_KEY_CHECKS QUERY_NO_GOOD_INDEX_USED*2 +#define OPTION_NO_FOREIGN_KEY_CHECKS (1L << 26) /* The following speeds up inserts to InnoDB tables by suppressing unique key checks in some cases */ -#define OPTION_RELAXED_UNIQUE_CHECKS OPTION_NO_FOREIGN_KEY_CHECKS*2 -#define SELECT_NO_UNLOCK ((ulong) OPTION_RELAXED_UNIQUE_CHECKS*2) -/* NOTE: we have now used up all 32 bits of the OPTION flag! */ +#define OPTION_RELAXED_UNIQUE_CHECKS (1L << 27) +#define SELECT_NO_UNLOCK (1L << 28) + +/* options for UNION set by the yacc parser (stored in unit->union_option) */ +#define UNION_ALL 1 /* Bits for different SQL modes modes (including ANSI mode) */ #define MODE_REAL_AS_FLOAT 1 diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 4bab7be255c..94ae1743fd9 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -104,7 +104,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, /* If running in safe sql mode, don't allow updates without keys */ if (table->quick_keys.is_clear_all()) { - thd->lex.select_lex.options|=QUERY_NO_INDEX_USED; + thd->server_status|=SERVER_QUERY_NO_INDEX_USED; if (safe_update && !using_limit) { delete select; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c50bfc43862..6442bbc1e1d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1203,7 +1203,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thread_running++; VOID(pthread_mutex_unlock(&LOCK_thread_count)); - thd->lex.select_lex.options=0; // We store status here + thd->server_status&= + ~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED); switch (command) { case COM_INIT_DB: { @@ -1635,8 +1636,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if ((ulong) (thd->start_time - thd->time_after_lock) > thd->variables.long_query_time || - ((thd->lex.select_lex.options & - (QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED)) && + ((thd->server_status & + (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && (specialflag & SPECIAL_LOG_QUERIES_NOT_USING_INDEXES))) { long_query_count++; @@ -3730,6 +3731,7 @@ mysql_init_query(THD *thd) lex->select_lex.prev= &lex->unit.slave; lex->select_lex.link_next= lex->select_lex.slave= lex->select_lex.next= 0; lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list); + lex->select_lex.options=0; lex->describe= 0; lex->derived_tables= FALSE; lex->lock_option= TL_READ; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 69e8ea8ccff..3d2a572c3a9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3619,7 +3619,7 @@ make_join_readinfo(JOIN *join, uint options) /* These init changes read_record */ if (tab->use_quick == 2) { - select_lex->options|=QUERY_NO_GOOD_INDEX_USED; + join->thd->server_status|=SERVER_QUERY_NO_GOOD_INDEX_USED; tab->read_first_record= join_init_quick_read_record; statistic_increment(select_range_check_count, &LOCK_status); } @@ -3634,7 +3634,7 @@ make_join_readinfo(JOIN *join, uint options) } else { - select_lex->options|=QUERY_NO_INDEX_USED; + join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED; statistic_increment(select_scan_count, &LOCK_status); } } @@ -3646,7 +3646,7 @@ make_join_readinfo(JOIN *join, uint options) } else { - select_lex->options|=QUERY_NO_INDEX_USED; + join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED; statistic_increment(select_full_join_count, &LOCK_status); } } @@ -8926,7 +8926,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, (ulong)join->select_lex, join->select_lex->type, message ? message : "NULL")); /* Don't log this into the slow query log */ - select_lex->options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED); + thd->server_status&= ~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED); join->unit->offset_limit_cnt= 0; if (message) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index d623ea66dfb..95dff107350 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -166,7 +166,7 @@ int mysql_update(THD *thd, /* If running in safe sql mode, don't allow updates without keys */ if (table->quick_keys.is_clear_all()) { - thd->lex.select_lex.options|=QUERY_NO_INDEX_USED; + thd->server_status|=SERVER_QUERY_NO_INDEX_USED; if (safe_update && !using_limit) { my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, From 0ff62350f61f3a79e9a34ccff40fc935dc2c0b24 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 7 Dec 2003 20:36:45 +0100 Subject: [PATCH 05/40] let chk_index() understand 2-level fulltext index format sql/sql_table.cc: typo fixed --- myisam/mi_check.c | 70 +++++++++++++++++++++++++++++++++-------------- sql/sql_table.cc | 2 +- 2 files changed, 50 insertions(+), 22 deletions(-) diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 6b2ad9744c4..f9e943fe42c 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -507,6 +507,36 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) DBUG_RETURN(result); } /* chk_key */ +static int chk_index_down(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, + my_off_t page, uchar *buff, ha_rows *keys, + ha_checksum *key_checksum, uint level) +{ + char llbuff[22],llbuff2[22]; + if (page > info->state->key_file_length || (page & (info->s->blocksize -1))) + { + my_off_t max_length=my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0)); + mi_check_print_error(param,"Wrong pagepointer: %s at page: %s", + llstr(page,llbuff),llstr(page,llbuff2)); + + if (page+info->s->blocksize > max_length) + goto err; + info->state->key_file_length=(max_length & + ~ (my_off_t) (info->s->blocksize-1)); + } + if (!_mi_fetch_keypage(info,keyinfo,page, DFLT_INIT_HITS,buff,0)) + { + mi_check_print_error(param,"Can't read key from filepos: %s", + llstr(page,llbuff)); + goto err; + } + param->key_file_blocks+=keyinfo->block_length; + if (chk_index(param,info,keyinfo,page,buff,keys,key_checksum,level)) + goto err; + + return 0; +err: + return 1; +} /* Check if index is ok */ @@ -553,27 +583,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, if (nod_flag) { next_page=_mi_kpos(nod_flag,keypos); - if (next_page > info->state->key_file_length || - (nod_flag && (next_page & (info->s->blocksize -1)))) - { - my_off_t max_length=my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0)); - mi_check_print_error(param,"Wrong pagepointer: %s at page: %s", - llstr(next_page,llbuff),llstr(page,llbuff2)); - - if (next_page+info->s->blocksize > max_length) - goto err; - info->state->key_file_length=(max_length & - ~ (my_off_t) (info->s->blocksize-1)); - } - if (!_mi_fetch_keypage(info,keyinfo,next_page, - DFLT_INIT_HITS,temp_buff,0)) - { - mi_check_print_error(param,"Can't read key from filepos: %s",llstr(next_page,llbuff)); - goto err; - } - param->key_file_blocks+=keyinfo->block_length; - if (chk_index(param,info,keyinfo,next_page,temp_buff,keys,key_checksum, - level+1)) + if (chk_index_down(param,info,keyinfo,next_page, + temp_buff,keys,key_checksum,level+1)) goto err; } old_keypos=keypos; @@ -615,6 +626,23 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, memcpy((char*) info->lastkey,(char*) key,key_length); info->lastkey_length=key_length; record= _mi_dpos(info,0,key+key_length); + if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */ + { + uint off; + int subkeys; + get_key_full_length_rdonly(off, key); + subkeys=ft_sintXkorr(key+off); + if (subkeys < 0) + { + ha_rows tmp_keys=0; + if (chk_index_down(param,info,&info->s->ft2_keyinfo,record, + temp_buff,&tmp_keys,key_checksum,1)) + goto err; + (*keys)+=tmp_keys-1; + continue; + } + /* fall through */ + } if (record >= info->state->data_file_length) { #ifndef DBUG_OFF diff --git a/sql/sql_table.cc b/sql/sql_table.cc index dcb657bdce8..3a579986b6e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1539,7 +1539,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, case HA_ADMIN_CORRUPT: protocol->store("error", 5, system_charset_info); - protocol->store("Corrupt", 8, system_charset_info); + protocol->store("Corrupt", 7, system_charset_info); fatal_error=1; break; From a0e4a6de568f11f437ed8509f8f748923332c716 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Dec 2003 09:13:14 +0400 Subject: [PATCH 06/40] Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. (Similar to the client command: mysql_options(... MYSQL_INIT_COMMAND ...). sql/mysql_priv.h: Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. sql/mysqld.cc: Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. sql/protocol.cc: Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. sql/set_var.cc: Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. sql/slave.cc: Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. sql/sql_class.cc: Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. sql/sql_class.h: Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. sql/sql_parse.cc: Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. sql/sql_show.cc: Task ID 499:Add a new settable string variable(init_connect, init_slave) to mysqld that is executed for all new connections. --- sql/mysql_priv.h | 2 ++ sql/mysqld.cc | 4 +-- sql/protocol.cc | 2 -- sql/set_var.cc | 71 ++++++++++++++++++------------------------------ sql/slave.cc | 22 +-------------- sql/sql_class.cc | 1 - sql/sql_class.h | 1 - sql/sql_parse.cc | 46 +++++++++++++------------------ sql/sql_show.cc | 8 +++--- 9 files changed, 55 insertions(+), 102 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 5da81422298..a9c98ddca80 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -499,6 +499,8 @@ bool wait_for_tables(THD *thd); bool table_is_used(TABLE *table, bool wait_for_name_lock); bool drop_locked_tables(THD *thd,const char *db, const char *table_name); void abort_locked_tables(THD *thd,const char *db, const char *table_name); +void execute_init_command(THD *thd, sys_var_str *init_command_var, + rw_lock_t *var_mutex); extern const Field *not_found_field; Field *find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, TABLE_LIST **where, bool report_error); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index df539776b19..d3ba147dc76 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3655,10 +3655,10 @@ Disable with --skip-bdb (will save memory).", #endif /* End HAVE_INNOBASE_DB */ {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"init-connect", OPT_INIT_CONNECT, "Command what executes for all new connections", + {"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection", (gptr*) &opt_init_connect, (gptr*) &opt_init_connect, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"init-slave", OPT_INIT_SLAVE, "Command what is executed when replication is starting", + {"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master", (gptr*) &opt_init_slave, (gptr*) &opt_init_slave, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.", diff --git a/sql/protocol.cc b/sql/protocol.cc index c2b1557ab39..1b9256c7723 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -92,7 +92,6 @@ void send_error(THD *thd, uint sql_errno, const char *err) /* In bootstrap it's ok to print on stderr */ fprintf(stderr,"ERROR: %d %s\n",sql_errno,err); } - thd->init_connect_error= 1; DBUG_VOID_RETURN; } @@ -211,7 +210,6 @@ net_printf(THD *thd, uint errcode, ...) fprintf(stderr,"ERROR: %d %s\n",errcode,text_pos); thd->fatal_error(); } - thd->init_connect_error= 1; DBUG_VOID_RETURN; } diff --git a/sql/set_var.cc b/sql/set_var.cc index 29ca3dc951c..012bc5ef6e4 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -674,14 +674,23 @@ struct show_var_st init_vars[]= { */ -static bool sys_update_init_connect(THD *thd, set_var *var) +/* + Update variables 'init_connect, init_slave'. + + In case of 'DEFAULT' value + (for example: 'set GLOBAL init_connect=DEFAULT') + 'var' parameter is NULL pointer. +*/ + +bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex, + set_var *var) { char *res= 0, *old_value; - uint new_length; + uint new_length= 0; /* If the string is "", delete old init command */ - if ((new_length= var->value->str_value.length())) + if (var && (new_length= var->value->str_value.length())) { - if (!(res= my_strdup_with_length(var->value->str_value.c_ptr(), + if (!(res= my_strdup_with_length(var->value->str_value.ptr(), new_length, MYF(0)))) return 1; @@ -690,63 +699,37 @@ static bool sys_update_init_connect(THD *thd, set_var *var) Replace the old value in such a way that the any thread using the value will work. */ - rw_wrlock(&LOCK_sys_init_connect); - old_value= sys_init_connect.value; - sys_init_connect.value= res; - sys_init_connect.value_length= new_length; - rw_unlock(&LOCK_sys_init_connect); + rw_wrlock(var_mutex); + old_value= var_str->value; + var_str->value= res; + var_str->value_length= new_length; + rw_unlock(var_mutex); my_free(old_value, MYF(MY_ALLOW_ZERO_PTR)); return 0; } +static bool sys_update_init_connect(THD *thd, set_var *var) +{ + return update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, var); +} + + static void sys_default_init_connect(THD* thd, enum_var_type type) { - char *old_value; - rw_wrlock(&LOCK_sys_init_connect); - old_value= sys_init_connect.value; - sys_init_connect.value= 0; - sys_init_connect.value_length= 0; - rw_unlock(&LOCK_sys_init_connect); - my_free(old_value, MYF(MY_ALLOW_ZERO_PTR)); + update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, 0); } static bool sys_update_init_slave(THD *thd, set_var *var) { - char *res= 0, *old_value; - uint new_length; - /* If the string is "", delete old init command */ - if ((new_length= var->value->str_value.length())) - { - if (!(res= my_strdup_with_length(var->value->str_value.c_ptr(), - new_length, - MYF(0)))) - return 1; - } - /* - Replace the old value in such a way that the any thread using - the value will work. - */ - rw_wrlock(&LOCK_sys_init_slave); - old_value= sys_init_slave.value; - sys_init_slave.value= res; - sys_init_slave.value_length= new_length; - rw_unlock(&LOCK_sys_init_slave); - my_free(old_value, MYF(MY_ALLOW_ZERO_PTR)); - return 0; + return update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, var); } static void sys_default_init_slave(THD* thd, enum_var_type type) { - char *old_value; - rw_wrlock(&LOCK_sys_init_slave); - old_value= sys_init_slave.value; - sys_init_slave.value= 0; - sys_init_slave.value_length= 0; - rw_unlock(&LOCK_sys_init_slave); - my_free(old_value, MYF(MY_ALLOW_ZERO_PTR)); + update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, 0); } diff --git a/sql/slave.cc b/sql/slave.cc index b9da8c7eca6..58eb214a319 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2448,24 +2448,6 @@ err: } -void init_slave_execute(THD *thd, sys_var_str *init_slave_var) -{ - Vio* save_vio; - ulong save_client_capabilities; - - thd->proc_info= "Execution of init_slave"; - thd->query= init_slave_var->value; - thd->query_length= init_slave_var->value_length; - save_client_capabilities= thd->client_capabilities; - thd->client_capabilities|= CLIENT_MULTI_QUERIES; - save_vio= thd->net.vio; - thd->net.vio= 0; - dispatch_command(COM_QUERY, thd, thd->query, thd->query_length+1); - thd->client_capabilities= save_client_capabilities; - thd->net.vio= save_vio; -} - - /* Slave SQL Thread entry point */ extern "C" pthread_handler_decl(handle_slave_sql,arg) @@ -2551,9 +2533,7 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME, /* execute init_slave variable */ if (sys_init_slave.value) { - rw_wrlock(&LOCK_sys_init_slave); - init_slave_execute(thd, &sys_init_slave); - rw_unlock(&LOCK_sys_init_slave); + execute_init_command(thd, &sys_init_slave, &LOCK_sys_init_slave); if (thd->query_error) { sql_print_error("\ diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 8677c262437..c233ffd422a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -121,7 +121,6 @@ THD::THD():user_time(0), is_fatal_error(0), system_thread=cleanup_done=0; peer_port= 0; // For SHOW PROCESSLIST transaction.changed_tables = 0; - init_connect_error= 0; #ifdef __WIN__ real_id = 0; #endif diff --git a/sql/sql_class.h b/sql/sql_class.h index 900c17a8743..f6336cb7dd9 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -560,7 +560,6 @@ public: bool prepare_command; bool tmp_table_used; - bool init_connect_error; /* If we do a purge of binary logs, log index info of the threads that are currently reading it needs to be adjusted. To do that diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f2e268abcd2..614cbaccf01 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -794,19 +794,31 @@ check_connections(THD *thd) } -void init_connect_execute(THD *thd, sys_var_str *init_connect_var) +void execute_init_command(THD *thd, sys_var_str *init_command_var, + rw_lock_t *var_mutex) { Vio* save_vio; ulong save_client_capabilities; - thd->proc_info= "Execution of init_connect"; - thd->query= init_connect_var->value; - thd->query_length= init_connect_var->value_length; + thd->proc_info= "Execution of init_command"; + /* + We need to lock init_command_var because + during execution of init_command_var query + values of init_command_var can't be changed + */ + rw_rdlock(var_mutex); + thd->query= init_command_var->value; + thd->query_length= init_command_var->value_length; save_client_capabilities= thd->client_capabilities; thd->client_capabilities|= CLIENT_MULTI_QUERIES; + /* + We don't need return result of execution to client side. + To forbid this we should set thd->net.vio to 0. + */ save_vio= thd->net.vio; thd->net.vio= 0; dispatch_command(COM_QUERY, thd, thd->query, thd->query_length+1); + rw_unlock(var_mutex); thd->client_capabilities= save_client_capabilities; thd->net.vio= save_vio; } @@ -887,29 +899,9 @@ pthread_handler_decl(handle_one_connection,arg) thd->version= refresh_version; if (sys_init_connect.value && !(thd->master_access & SUPER_ACL)) { - rw_wrlock(&LOCK_sys_init_connect); - init_connect_execute(thd, &sys_init_connect); - rw_unlock(&LOCK_sys_init_connect); - if (thd->init_connect_error) - { - if (thd->user_connect) - decrease_user_connections(thd->user_connect); - free_root(&thd->mem_root,MYF(0)); - if (!thd->killed && thd->variables.log_warnings) - { - sql_print_error(ER(ER_NEW_ABORTING_CONNECTION), - thd->thread_id,(thd->db ? thd->db : "unconnected"), - thd->user ? thd->user : "unauthenticated", - thd->host_or_ip, - "Can't execute init_connect query"); - statistic_increment(aborted_threads,&LOCK_status); - } - else if (thd->killed) - { - statistic_increment(aborted_threads,&LOCK_status); - } - goto end_thread; - } + execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect); + if (thd->query_error) + thd->killed= 1; } thd->proc_info=0; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 42c89db9ca4..c80393715f6 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1618,10 +1618,10 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, break; case SHOW_CHAR_PTR: { - if (!(pos= *(char**) value)) - pos= ""; - end= strend(pos); - break; + if (!(pos= *(char**) value)) + pos= ""; + end= strend(pos); + break; } #ifdef HAVE_OPENSSL /* First group - functions relying on CTX */ From 8bf9ccb627af48fa24cce5699c9a9c2314cc406d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Dec 2003 12:10:30 +0400 Subject: [PATCH 07/40] Fixed test for 'init_slave' variable --- mysql-test/r/rpl_init_slave.result | 23 ++++++++++++----------- mysql-test/t/rpl_init_slave-slave.opt | 2 +- mysql-test/t/rpl_init_slave.test | 10 +++++----- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/mysql-test/r/rpl_init_slave.result b/mysql-test/r/rpl_init_slave.result index a91b2da85cd..83d0a3289a2 100644 --- a/mysql-test/r/rpl_init_slave.result +++ b/mysql-test/r/rpl_init_slave.result @@ -4,20 +4,21 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +show variables like 'init_slave'; +Variable_name Value +init_slave set global max_connections=500 +show variables like 'max_connections'; +Variable_name Value +max_connections 500 reset master; -create table t1(n int); -insert into t1 values (@a), (@b); -select * from t1; -n -NULL -NULL -select * from t1; -n -1 -2 +show variables like 'init_slave'; +Variable_name Value +init_slave +show variables like 'max_connections'; +Variable_name Value +max_connections 100 set global init_connect="set @c=1"; show variables like 'init_connect'; Variable_name Value init_connect set @c=1 -drop table t1; stop slave; diff --git a/mysql-test/t/rpl_init_slave-slave.opt b/mysql-test/t/rpl_init_slave-slave.opt index 6433dccf4aa..337e8a60d97 100644 --- a/mysql-test/t/rpl_init_slave-slave.opt +++ b/mysql-test/t/rpl_init_slave-slave.opt @@ -1 +1 @@ ---init-slave="set @a=1;set @b=2" +--init-slave="set global max_connections=500" diff --git a/mysql-test/t/rpl_init_slave.test b/mysql-test/t/rpl_init_slave.test index 67d35546225..3ea04117ced 100644 --- a/mysql-test/t/rpl_init_slave.test +++ b/mysql-test/t/rpl_init_slave.test @@ -6,20 +6,20 @@ source include/master-slave.inc; save_master_pos; connection slave; +sleep 1; +show variables like 'init_slave'; +show variables like 'max_connections'; sync_with_master; reset master; connection master; -create table t1(n int); -insert into t1 values (@a), (@b); -select * from t1; +show variables like 'init_slave'; +show variables like 'max_connections'; save_master_pos; connection slave; sync_with_master; -select * from t1; set global init_connect="set @c=1"; show variables like 'init_connect'; connection master; -drop table t1; save_master_pos; connection slave; sync_with_master; From e505696ffc54eeb819c5a59abeb3866155641ed8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Dec 2003 12:25:37 +0200 Subject: [PATCH 08/40] Portability fixes for Windows VC++Files/client/mysqlclient.dsp: Update for windows VC++Files/libmysql/libmysql.dsp: Update for windows VC++Files/strings/strings.dsp: Update for windows libmysqld/lib_sql.cc: Update for windows scripts/make_win_src_distribution.sh: Update for windows scripts/mysql_install_db.sh: Update for windows sql/mysqld.cc: Remove not used variable sql/set_var.cc: Indentation cleanups sql/share/czech/errmsg.txt: Fixed wrong delimiters sql/share/danish/errmsg.txt: Fixed wrong delimiters sql/share/dutch/errmsg.txt: Fixed wrong delimiters sql/share/english/errmsg.txt: Fixed wrong delimiters sql/share/estonian/errmsg.txt: Fixed wrong delimiters sql/share/french/errmsg.txt: Fixed wrong delimiters sql/share/greek/errmsg.txt: Fixed wrong delimiters sql/share/hungarian/errmsg.txt: Fixed wrong delimiters sql/share/italian/errmsg.txt: Fixed wrong delimiters sql/share/japanese/errmsg.txt: Fixed wrong delimiters sql/share/korean/errmsg.txt: Fixed wrong delimiters sql/share/norwegian-ny/errmsg.txt: Fixed wrong delimiters sql/share/norwegian/errmsg.txt: Fixed wrong delimiters sql/share/polish/errmsg.txt: Fixed wrong delimiters sql/share/portuguese/errmsg.txt: Fixed wrong delimiters sql/share/romanian/errmsg.txt: Fixed wrong delimiters sql/share/russian/errmsg.txt: Fixed wrong delimiters sql/share/serbian/errmsg.txt: Fixed wrong delimiters sql/share/slovak/errmsg.txt: Fixed wrong delimiters sql/share/spanish/errmsg.txt: Fixed wrong delimiters sql/share/swedish/errmsg.txt: Fixed wrong delimiters sql/share/ukrainian/errmsg.txt: Fixed wrong delimiters sql/sql_acl.cc: Removed compiler warnings strings/ctype-big5.c: Removed compiler warnings (VC++) strings/ctype-euc_kr.c: Removed compiler warnings (VC++) strings/ctype-gb2312.c: Removed compiler warnings (VC++) strings/ctype-gbk.c: Removed compiler warnings (VC++) strings/ctype-sjis.c: Removed compiler warnings (VC++) strings/ctype-ucs2.c: Removed compiler warnings (VC++) strings/ctype-ujis.c: Removed compiler warnings (VC++) --- VC++Files/client/mysqlclient.dsp | 12 +++++++++++ VC++Files/libmysql/libmysql.dsp | 12 +++++++++++ VC++Files/strings/strings.dsp | 4 ++++ libmysqld/lib_sql.cc | 30 ++++++++++++++++++---------- scripts/make_win_src_distribution.sh | 19 +++++++++--------- scripts/mysql_install_db.sh | 4 +++- sql/mysqld.cc | 1 - sql/set_var.cc | 9 +++++++-- sql/share/czech/errmsg.txt | 8 ++++---- sql/share/danish/errmsg.txt | 8 ++++---- sql/share/dutch/errmsg.txt | 8 ++++---- sql/share/english/errmsg.txt | 8 ++++---- sql/share/estonian/errmsg.txt | 8 ++++---- sql/share/french/errmsg.txt | 8 ++++---- sql/share/greek/errmsg.txt | 8 ++++---- sql/share/hungarian/errmsg.txt | 8 ++++---- sql/share/italian/errmsg.txt | 8 ++++---- sql/share/japanese/errmsg.txt | 8 ++++---- sql/share/korean/errmsg.txt | 8 ++++---- sql/share/norwegian-ny/errmsg.txt | 8 ++++---- sql/share/norwegian/errmsg.txt | 8 ++++---- sql/share/polish/errmsg.txt | 8 ++++---- sql/share/portuguese/errmsg.txt | 8 ++++---- sql/share/romanian/errmsg.txt | 8 ++++---- sql/share/russian/errmsg.txt | 8 ++++---- sql/share/serbian/errmsg.txt | 8 ++++---- sql/share/slovak/errmsg.txt | 8 ++++---- sql/share/spanish/errmsg.txt | 8 ++++---- sql/share/swedish/errmsg.txt | 8 ++++---- sql/share/ukrainian/errmsg.txt | 8 ++++---- sql/sql_acl.cc | 1 - strings/ctype-big5.c | 15 +++++++------- strings/ctype-euc_kr.c | 4 ++-- strings/ctype-gb2312.c | 15 +++++++------- strings/ctype-gbk.c | 4 ++-- strings/ctype-sjis.c | 16 ++++++++------- strings/ctype-ucs2.c | 6 +++--- strings/ctype-ujis.c | 14 ++++++------- 38 files changed, 193 insertions(+), 149 deletions(-) diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp index 4a9d52232ca..2a1b52d54ee 100644 --- a/VC++Files/client/mysqlclient.dsp +++ b/VC++Files/client/mysqlclient.dsp @@ -160,10 +160,22 @@ SOURCE="..\strings\ctype-tis620.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-ucs2.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-ujis.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-utf8.c" +# End Source File +# Begin Source File + +SOURCE="..\strings\ctype-win1250ch.c" +# End Source File +# Begin Source File + SOURCE=..\strings\ctype.c # End Source File # Begin Source File diff --git a/VC++Files/libmysql/libmysql.dsp b/VC++Files/libmysql/libmysql.dsp index 6b76a6147ff..0f94574b3cc 100644 --- a/VC++Files/libmysql/libmysql.dsp +++ b/VC++Files/libmysql/libmysql.dsp @@ -179,10 +179,22 @@ SOURCE="..\strings\ctype-tis620.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-ucs2.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-ujis.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-utf8.c" +# End Source File +# Begin Source File + +SOURCE="..\strings\ctype-win1250ch.c" +# End Source File +# Begin Source File + SOURCE=..\strings\ctype.c # End Source File # Begin Source File diff --git a/VC++Files/strings/strings.dsp b/VC++Files/strings/strings.dsp index 4e43cc875c8..030acdb7451 100644 --- a/VC++Files/strings/strings.dsp +++ b/VC++Files/strings/strings.dsp @@ -156,6 +156,10 @@ SOURCE=".\ctype-tis620.c" # End Source File # Begin Source File +SOURCE=".\ctype-ucs2.c" +# End Source File +# Begin Source File + SOURCE=".\ctype-ujis.c" # End Source File # Begin Source File diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index d4cb916a89c..2fd6927854f 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -45,7 +45,7 @@ C_MODE_START static my_bool org_my_init_done; my_bool server_inited; -static my_bool STDCALL +static my_bool emb_advanced_command(MYSQL *mysql, enum enum_server_command command, const char *header, ulong header_length, const char *arg, ulong arg_length, my_bool skip_check) @@ -103,7 +103,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, return result; } -static MYSQL_DATA * STDCALL +static MYSQL_DATA * emb_read_rows(MYSQL *mysql, MYSQL_FIELD *mysql_fields __attribute__((unused)), unsigned int fields __attribute__((unused))) { @@ -126,12 +126,12 @@ emb_read_rows(MYSQL *mysql, MYSQL_FIELD *mysql_fields __attribute__((unused)), return result; } -static MYSQL_FIELD * STDCALL emb_list_fields(MYSQL *mysql) +static MYSQL_FIELD *emb_list_fields(MYSQL *mysql) { return mysql->fields; } -static my_bool STDCALL emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) +static my_bool emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) { THD *thd= (THD*)mysql->thd; if (mysql->net.last_errno) @@ -159,7 +159,8 @@ static my_bool STDCALL emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) else the lengths are calculated from the offset between pointers. **************************************************************************/ -static void STDCALL emb_fetch_lengths(ulong *to, MYSQL_ROW column, unsigned int field_count) +static void emb_fetch_lengths(ulong *to, MYSQL_ROW column, + unsigned int field_count) { MYSQL_ROW end; @@ -167,7 +168,7 @@ static void STDCALL emb_fetch_lengths(ulong *to, MYSQL_ROW column, unsigned int *to= *column ? *(uint *)((*column) - sizeof(uint)) : 0; } -static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql) +static my_bool emb_mysql_read_query_result(MYSQL *mysql) { if (mysql->net.last_errno) return -1; @@ -178,7 +179,7 @@ static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql) return 0; } -static int STDCALL emb_stmt_execute(MYSQL_STMT *stmt) +static int emb_stmt_execute(MYSQL_STMT *stmt) { DBUG_ENTER("emb_stmt_execute"); THD *thd= (THD*)stmt->mysql->thd; @@ -205,7 +206,7 @@ MYSQL_DATA *emb_read_binary_rows(MYSQL_STMT *stmt) return emb_read_rows(stmt->mysql, 0, 0); } -int STDCALL emb_unbuffered_fetch(MYSQL *mysql, char **row) +int emb_unbuffered_fetch(MYSQL *mysql, char **row) { MYSQL_DATA *data= ((THD*)mysql->thd)->data; if (!data || !data->data) @@ -225,7 +226,7 @@ int STDCALL emb_unbuffered_fetch(MYSQL *mysql, char **row) return 0; } -static void STDCALL emb_free_embedded_thd(MYSQL *mysql) +static void emb_free_embedded_thd(MYSQL *mysql) { THD *thd= (THD*)mysql->thd; if (thd->data) @@ -234,18 +235,25 @@ static void STDCALL emb_free_embedded_thd(MYSQL *mysql) delete thd; } -static const char * STDCALL emb_read_statistic(MYSQL *mysql) +static const char * emb_read_statistic(MYSQL *mysql) { THD *thd= (THD*)mysql->thd; return thd->net.last_error; } + +static MYSQL_RES * emb_mysql_store_result(MYSQL *mysql) +{ + return mysql_store_result(mysql); +} + + MYSQL_METHODS embedded_methods= { emb_mysql_read_query_result, emb_advanced_command, emb_read_rows, - mysql_store_result, + emb_mysql_store_result, emb_fetch_lengths, emb_list_fields, emb_read_prepare_result, diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index d83548d0061..57612ac8edc 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -178,18 +178,8 @@ rm -r -f "$BASE/share/Makefile" rm -r -f "$BASE/share/Makefile.in" rm -r -f "$BASE/share/Makefile.am" -# -# Clean up if we did this from a bk tree -# - -if [ -d $BASE/SCCS ] -then - find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f -fi - mkdir $BASE/Docs $BASE/extra $BASE/include - # # Copy directory files # @@ -320,6 +310,15 @@ done unix_to_dos $BASE/README mv $BASE/README $BASE/README.txt +# +# Clean up if we did this from a bk tree +# + +if [ -d $BASE/SSL/SCCS ] +then + find $BASE -type d -name SCCS | xargs rm -r -f +fi + # # Initialize the initial data directory # diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index acf0f8aa2c8..fcb1f2a4ef1 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -119,11 +119,13 @@ fi mdata=$ldata/mysql mysqld=$execdir/mysqld mysqld_opt="" +scriptdir=$bindir if test "$windows" = 1 then mysqld="./sql/mysqld" mysqld_opt="--language=./sql/share/english" + scriptdir="./scripts" fi if test ! -x $mysqld @@ -199,7 +201,7 @@ then echo "Installing all prepared tables" fi if ( - $bindir/mysql_create_system_tables $create_option $mdata $hostname $windows + $scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows if test -n "$fill_help_tables" then cat $fill_help_tables diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2a5f639a440..e9dee43155f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3327,7 +3327,6 @@ pthread_handler_decl(handle_connections_shared_memory,arg) HANDLE event_connect_answer= 0; ulong smem_buffer_length= shared_memory_buffer_length + 4; ulong connect_number= 1; - my_bool error_allow; char tmp[63]; char *suffix_pos; char connect_number_char[22], *p; diff --git a/sql/set_var.cc b/sql/set_var.cc index 5b956cd9c76..bd06652dc31 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -2412,8 +2412,9 @@ int set_var_password::update(THD *thd) Functions to handle table_type ****************************************************************************/ +/* Based upon sys_var::check_enum() */ + bool sys_var_thd_table_type::check(THD *thd, set_var *var) - /* Based upon sys_var::check_enum() */ { char buff[80]; const char *value; @@ -2436,6 +2437,7 @@ err: return 1; } + byte *sys_var_thd_table_type::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { @@ -2443,9 +2445,10 @@ byte *sys_var_thd_table_type::value_ptr(THD *thd, enum_var_type type, val= ((type == OPT_GLOBAL) ? global_system_variables.*offset : thd->variables.*offset); const char *table_type= ha_get_table_type((enum db_type)val); - return (byte *)table_type; + return (byte *) table_type; } + void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type) { if (type == OPT_GLOBAL) @@ -2454,6 +2457,7 @@ void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type) thd->variables.*offset= (ulong) (global_system_variables.*offset); } + bool sys_var_thd_table_type::update(THD *thd, set_var *var) { if (var->type == OPT_GLOBAL) @@ -2463,6 +2467,7 @@ bool sys_var_thd_table_type::update(THD *thd, set_var *var) return 0; } + /**************************************************************************** Functions to handle sql_mode ****************************************************************************/ diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 2e664d8b892..a77e6e4333b 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -272,10 +272,10 @@ character-set=latin2 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 59eef466ca3..1e04ef7340b 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -266,10 +266,10 @@ character-set=latin1 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 992effea88e..e9b0ac12e29 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -274,10 +274,10 @@ character-set=latin1 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index b57cb62814e..233f57cec28 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -263,10 +263,10 @@ character-set=latin1 "ZLIB: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "ZLIB: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index fd4c6d3e52e..fa6201f9097 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -268,10 +268,10 @@ character-set=latin7 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 1e2c6fa4178..dbc4cfeae5e 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -263,10 +263,10 @@ character-set=latin1 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index d3aebcba5d3..4d8a6d44099 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -263,10 +263,10 @@ character-set=greek "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index ed38956da44..3a6e309435c 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -265,10 +265,10 @@ character-set=latin2 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index e85a134614f..fcc3379e138 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -263,10 +263,10 @@ character-set=latin1 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 49efa03eef2..c4bd5dab028 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -265,10 +265,10 @@ character-set=ujis "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index b2be32402db..14112e5b6bd 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -263,10 +263,10 @@ character-set=euckr "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index c67ff6d8263..9b0274965a7 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -265,10 +265,10 @@ character-set=latin1 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index f412e4f8615..906e4702cab 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -265,10 +265,10 @@ character-set=latin1 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 715f17e3ccc..c9229d0c522 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -267,10 +267,10 @@ character-set=latin2 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index e98879508d6..9ff6325f935 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -264,10 +264,10 @@ character-set=latin1 "Z_BUF_ERROR: Não suficiente espaço no buffer emissor para zlib (provavelmente, o comprimento dos dados descomprimidos está corrupto)", "Z_DATA_ERROR: Dados de entrada está corrupto para zlib", "%d linha(s) foi(foram) cortada(s) por group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Usando engine de armazenamento %s para tabela '%s'", "Combinação ilegal de collations (%s,%s) e (%s,%s) para operação '%s'", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 46ece3bc9ce..34dd64daa2d 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -267,10 +267,10 @@ character-set=latin2 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 40e8c585eb3..6f22d1b87fd 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -265,10 +265,10 @@ character-set=koi8r "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index 4002ffe926c..98308190587 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -258,10 +258,10 @@ character-set=cp1250 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 7324906fca1..5decce35dfd 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -271,10 +271,10 @@ character-set=latin2 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 0db613ae4c7..00f31d351df 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -265,10 +265,10 @@ character-set=latin1 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 96e124207ed..a53b6e4df3a 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -263,10 +263,10 @@ character-set=latin1 "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d rad(er) kapades av group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Använder handler %s för tabell '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 587e599c01e..e3a496831a2 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -268,10 +268,10 @@ character-set=koi8u "Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", "Z_DATA_ERROR: Input data was corrupted for zlib", "%d line(s) was(were) cut by group_concat()", -"Record count is fewer than the column count at row %ld"; -"Record count is more than the column count at row %ld"; -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; -"Data truncated, out of range for column '%s' at row %ld"; +"Record count is fewer than the column count at row %ld", +"Record count is more than the column count at row %ld", +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", +"Data truncated, out of range for column '%s' at row %ld", "Data truncated for column '%s' at row %ld", "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ac517014108..5364357a24b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2548,7 +2548,6 @@ my_bool grant_init(THD *org_thd) { if (hostname_requires_resolving(mem_check->host)) { - char buff[MAX_FIELD_WIDTH]; sql_print_error("Warning: 'tables_priv' entry '%s %s@%s' " "ignored in --skip-name-resolve mode.", mem_check->tname, mem_check->user, diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 878493bc31f..d70b06217c0 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6183,16 +6183,16 @@ my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)), if (s >= e) return MY_CS_TOOSMALL; - if(wc<0x80) + if ((int) wc < 0x80) { - s[0]=wc; + s[0]= (uchar) wc; return 1; } - if(!(code=func_uni_big5_onechar(wc))) + if (!(code=func_uni_big5_onechar(wc))) return MY_CS_ILUNI; - if(s+2>e) + if (s+2>e) return MY_CS_TOOSMALL; s[0]=code>>8; @@ -6201,6 +6201,7 @@ my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)), return 2; } + static int my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *pwc,const uchar *s,const uchar *e) @@ -6211,16 +6212,16 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)), if (s >= e) return MY_CS_TOOFEW(0); - if(hi<0x80) + if (hi<0x80) { pwc[0]=hi; return 1; } - if(s+2>e) + if (s+2>e) return MY_CS_TOOFEW(0); - if(!(pwc[0]=func_big5_uni_onechar((hi<<8)+s[1]))) + if (!(pwc[0]=func_big5_uni_onechar((hi<<8)+s[1]))) return MY_CS_ILSEQ; return 2; diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index d47c4268642..5b04d9fa53b 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8591,9 +8591,9 @@ my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)), if (s >= e) return MY_CS_TOOSMALL; - if (wc<0x80) + if ((uint) wc < 0x80) { - s[0]=wc; + s[0]= (uchar) wc; return 1; } diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index d429fa34eea..afc418e01bd 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5641,16 +5641,16 @@ my_wc_mb_gb2312(CHARSET_INFO *cs __attribute__((unused)), if (s >= e) return MY_CS_TOOSMALL; - if (wc<0x80) + if ((uint) wc < 0x80) { - s[0]=wc; + s[0]= (uchar) wc; return 1; } if (!(code=func_uni_gb2312_onechar(wc))) return MY_CS_ILUNI; - if(s+2>e) + if (s+2>e) return MY_CS_TOOSMALL; code|=0x8080; @@ -5659,26 +5659,27 @@ my_wc_mb_gb2312(CHARSET_INFO *cs __attribute__((unused)), return 2; } + static int my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *pwc, const uchar *s, const uchar *e){ int hi; - hi=s[0]; + hi=(int) s[0]; if (s >= e) return MY_CS_TOOFEW(0); - if(hi<0x80) + if (hi<0x80) { pwc[0]=hi; return 1; } - if(s+2>e) + if (s+2>e) return MY_CS_TOOFEW(0); - if(!(pwc[0]=func_gb2312_uni_onechar(((hi<<8)+s[1])&0x7F7F))) + if (!(pwc[0]=func_gb2312_uni_onechar(((hi<<8)+s[1])&0x7F7F))) return MY_CS_ILSEQ; return 2; diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index fa7aa175103..db500644674 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -9837,9 +9837,9 @@ my_wc_mb_gbk(CHARSET_INFO *cs __attribute__((unused)), if (s >= e) return MY_CS_TOOSMALL; - if (wc<0x80) + if ((uint) wc < 0x80) { - s[0]=wc; + s[0]= (uchar) wc; return 1; } diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index f302e678b9f..f08f8d4f0c2 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4428,16 +4428,16 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)), if (s >= e) return MY_CS_TOOSMALL; - if(wc<0x80) + if ((int) wc < 0x80) { - s[0]=wc; + s[0]= (uchar) wc; return 1; } - if(!(code=func_uni_sjis_onechar(wc))) + if (!(code=func_uni_sjis_onechar(wc))) return MY_CS_ILUNI; - if(s+2>e) + if (s+2>e) return MY_CS_TOOSMALL; s[0]=code>>8; @@ -4445,6 +4445,7 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)), return 2; } + static int my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *pwc, const uchar *s, const uchar *e){ @@ -4453,16 +4454,16 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), if (s >= e) return MY_CS_TOOFEW(0); - if(hi<0x80) + if (hi<0x80) { pwc[0]=hi; return 1; } - if(s+2>e) + if (s+2>e) return MY_CS_TOOFEW(0); - if(!(pwc[0]=func_sjis_uni_onechar((hi<<8)+s[1]))) + if (!(pwc[0]=func_sjis_uni_onechar((hi<<8)+s[1]))) return MY_CS_ILSEQ; return 2; @@ -4481,6 +4482,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = my_hash_sort_simple, }; + static MY_CHARSET_HANDLER my_charset_handler= { ismbchar_sjis, diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index cdcd91b2916..beb803a69f2 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -106,8 +106,8 @@ static int my_uni_ucs2 (CHARSET_INFO *cs __attribute__((unused)) , if ( r+2 > e ) return MY_CS_TOOSMALL; - r[0]=wc >> 8; - r[1]=wc & 0xFF; + r[0]= (uchar) (wc >> 8); + r[1]= (uchar) (wc & 0xFF); return 2; } @@ -862,7 +862,7 @@ double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)), s+=cnv; if (wc > (int) (uchar) 'e' || !wc) break; /* Can't be part of double */ - *b++=wc; + *b++= (char) wc; } *b= 0; diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 29375aca727..a6f8ac65771 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -252,25 +252,25 @@ my_wc_mb_jisx0201(CHARSET_INFO *cs __attribute__((unused)), uchar *e __attribute__((unused))) { - if (wc <= 0x7D) + if ((int) wc <= 0x7D) { - *s = wc; + *s = (uchar) wc; return (wc == 0x5C) ? MY_CS_ILUNI : 1; } if (wc >= 0xFF61 && wc <= 0xFF9F) { - *s = (wc - 0xFEC0); + *s = (uchar) (wc - 0xFEC0); return 1; } - if (wc==0x00A5) + if (wc == 0x00A5) { *s = 0x5C; return 1; } - if (wc==0x203E) + if (wc == 0x203E) { *s = 0x7E; return 1; @@ -8349,12 +8349,12 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e) if (s >= e) return MY_CS_TOOSMALL; - if (wc<0x80) + if ((int) wc < 0x80) { if (s>e) return MY_CS_TOOSMALL; - *s=wc; + *s= (uchar) wc; return 1; } From f6f9b3496a2c6607f91f93876c3062807b6027d1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Dec 2003 13:30:14 +0300 Subject: [PATCH 09/40] commented why valgrind barks at the bug #1500 --- tests/client_test.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/client_test.c b/tests/client_test.c index 048935d2efb..464d5b632ae 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -7955,7 +7955,12 @@ static void test_ts() /* Test for bug #1500. + XXX: despite that this bug is fixed, it spots mysqld code which is not + working correctly yet: to fix all things properly we need to implement + Item::cleanup() method for all items (as described in bugs #1663 and + #1749). So don't be surprised in case valgrind barks on it. */ + static void test_bug1500() { MYSQL_STMT *stmt; From adc470c290a89913aa47e7ab9fcb658f560a5d37 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Dec 2003 14:38:29 +0100 Subject: [PATCH 10/40] Fixed two packaging bugs: - postinstall of the Mac OS X PKG failed as a parameter for mysql_install_db was changed for MySQL 4.1 - postinstall of the Server RPM failed as mysql_create_system_tables was missing from the file list support-files/MacOSX/postinstall.sh: - Fix parameter for mysql_install_db (it was changed from -IN-RPM to --rpm in the 4.1 tree) support-files/mysql.spec.sh: - Added missing file mysql_create_system_tables to the server subpackage --- support-files/MacOSX/postinstall.sh | 2 +- support-files/mysql.spec.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/support-files/MacOSX/postinstall.sh b/support-files/MacOSX/postinstall.sh index f46f4480e3e..ff921d3fee9 100644 --- a/support-files/MacOSX/postinstall.sh +++ b/support-files/MacOSX/postinstall.sh @@ -10,7 +10,7 @@ if cd @prefix@ ; then if [ ! -f data/mysql/db.frm ] ; then - ./scripts/mysql_install_db -IN-RPM + ./scripts/mysql_install_db --rpm fi if [ -d data ] ; then diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 59006a187d0..0eb642650d7 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -470,6 +470,7 @@ fi %attr(755, root, root) %{_bindir}/myisamlog %attr(755, root, root) %{_bindir}/myisampack %attr(755, root, root) %{_bindir}/mysql_convert_table_format +%attr(755, root, root) %{_bindir}/mysql_create_system_tables %attr(755, root, root) %{_bindir}/mysql_explain_log %attr(755, root, root) %{_bindir}/mysql_fix_extensions %attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables @@ -568,6 +569,10 @@ fi # The spec file changelog only includes changes made to the spec file # itself %changelog +* Fri Dec 05 2003 Lenz Grimmer + +- added missing file mysql_create_system_tables to the server subpackage + * Fri Nov 21 2003 Lenz Grimmer - removed dependency on MySQL-client from the MySQL-devel subpackage From 56ea8bfd84a3054c4a270d724d1c0b8a4a9f5347 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Dec 2003 15:28:58 +0400 Subject: [PATCH 11/40] Fix for the bug #1994: mysqldump does not correctly dump UCS2 data. --- client/mysqldump.c | 7 ++++++- mysql-test/r/mysqldump.result | 39 +++++++++++++++++++++++++++++++++++ mysql-test/t/mysqldump.test | 9 ++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 31305c93e6c..cdb0a62d4cc 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -89,7 +89,11 @@ static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, *where=0, *opt_compatible_mode_str= 0, *err_ptr= 0; +#ifdef HAVE_CHARSET_utf8 +static char *default_charset= (char*) "utf8"; +#else static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; +#endif static ulong opt_compatible_mode= 0; static uint opt_mysql_port= 0, err_len= 0; static my_string opt_mysql_unix_port=0; @@ -351,7 +355,7 @@ static void write_header(FILE *sql_file, char *db_name) fprintf(sql_file, "-- Server version\t%s\n", mysql_get_server_info(&mysql_connection)); if (!opt_set_names) - fprintf(sql_file,"\n/*!40101 SET NAMES %s*/;\n",default_charset); + fprintf(sql_file,"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=%s */;\n",default_charset); fprintf(md_result_file,"\ /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n\ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n\ @@ -372,6 +376,7 @@ static void write_footer(FILE *sql_file) /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n\ /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n\ /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n\ +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n\ "); } fputs("\n", sql_file); diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 4025a01bc93..f5d98143f9e 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -62,3 +62,42 @@ INSERT INTO t1 VALUES ("1\""), ("\"2"); DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET ucs2; +INSERT INTO t1 VALUES (_ucs2 x'05D005D505DC05D9'); +-- MySQL dump 10.2 +-- +-- Host: localhost Database: test +-- ------------------------------------------------------ +-- Server version 4.1.2-alpha-debug-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */; + +-- +-- Table structure for table `t1` +-- + +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( + a varchar(255) default NULL +) TYPE=MyISAM DEFAULT CHARSET=ucs2; + +-- +-- Dumping data for table `t1` +-- + + +/*!40000 ALTER TABLE t1 DISABLE KEYS */; +LOCK TABLES t1 WRITE; +INSERT INTO t1 VALUES ('×ולי'); +UNLOCK TABLES; +/*!40000 ALTER TABLE t1 ENABLE KEYS */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; + +DROP TABLE t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 954fdcb925a..2004d5122f1 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -22,3 +22,12 @@ CREATE TABLE t1 (`a"b"` char(2)); INSERT INTO t1 VALUES ("1\""), ("\"2"); --exec $MYSQL_DUMP --skip-all -X test t1 DROP TABLE t1; + +# +# Bug #1994 +# + +CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET ucs2; +INSERT INTO t1 VALUES (_ucs2 x'05D005D505DC05D9'); +--exec $MYSQL_DUMP test t1 +DROP TABLE t1; From 4c8f7bd861ec7f92822d8edb489d67977aa4f4c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Dec 2003 19:05:41 +0100 Subject: [PATCH 12/40] Post-merge fixes. --- mysql-test/r/mysqldump.result | 2 +- sql/sql_parse.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index f5d98143f9e..8efda4b110c 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -68,7 +68,7 @@ INSERT INTO t1 VALUES (_ucs2 x'05D005D505DC05D9'); -- -- Host: localhost Database: test -- ------------------------------------------------------ --- Server version 4.1.2-alpha-debug-log +-- Server version 5.0.0-alpha-debug-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index fa94296cb0a..c8d5ebe0743 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -980,7 +980,7 @@ pthread_handler_decl(handle_one_connection,arg) { execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect); if (thd->query_error) - thd->killed= 1; + thd->killed= THD::KILL_CONNECTION; } thd->proc_info=0; From b6df8bb66ac8eefcbea86aecb0f8c067dcbe004c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Dec 2003 13:29:38 -0800 Subject: [PATCH 13/40] key_cache.result, key_cache.test, mf_keycache.c: Fixed a wrong return code by the function init_key_cache. mysys/mf_keycache.c: Fixed a wrong return code by the function init_key_cache. mysql-test/t/key_cache.test: Fixed a wrong return code by the function init_key_cache. mysql-test/r/key_cache.result: Fixed a wrong return code by the function init_key_cache. --- mysql-test/r/key_cache.result | 4 +++- mysql-test/t/key_cache.test | 6 +++++- mysys/mf_keycache.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index 4bc4cad40a4..394099b363c 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -256,4 +256,6 @@ Table Op Msg_type Msg_text test.t1 assign_to_keycache status OK test.t2 assign_to_keycache status OK drop table t1,t2,t3; -set global keycache1.key_buffer_size=0; +set global keycache2.key_buffer_size=0; +set global keycache3.key_buffer_size=100; +set global keycache3.key_buffer_size=0; diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index a3b8bca847d..df16e11daae 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -135,4 +135,8 @@ drop table t1,t2,t3; # Cleanup # We don't reset keycache2 as we want to ensure that mysqld will reset it -set global keycache1.key_buffer_size=0; +set global keycache2.key_buffer_size=0; + +# Test to set up a too small size for a key cache (bug #2064) +set global keycache3.key_buffer_size=100; +set global keycache3.key_buffer_size=0; diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index f9b11e97f47..08737221fb2 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -391,7 +391,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, } keycache->blocks= keycache->disk_blocks > 0 ? keycache->disk_blocks : 0; - DBUG_RETURN((int) blocks); + DBUG_RETURN((int) keycache->disk_blocks); err: error= my_errno; From 80ec807976ca5ae291883b1096e4af7233788af0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 10 Dec 2003 04:31:42 +0000 Subject: [PATCH 14/40] WorkLog#1323 Deprecate the use of TYPE=... Preferred syntax is ENGINE= include/mysqld_error.h: New warning for deprecated syntax sql/lex.h: Introduce ENGINE keyword Sort order of symbols sql/share/czech/errmsg.txt: New warning for deprecated syntax sql/share/danish/errmsg.txt: New warning for deprecated syntax sql/share/dutch/errmsg.txt: New warning for deprecated syntax sql/share/english/errmsg.txt: New warning for deprecated syntax sql/share/estonian/errmsg.txt: New warning for deprecated syntax sql/share/french/errmsg.txt: New warning for deprecated syntax sql/share/german/errmsg.txt: New warning for deprecated syntax sql/share/greek/errmsg.txt: New warning for deprecated syntax sql/share/hungarian/errmsg.txt: New warning for deprecated syntax sql/share/italian/errmsg.txt: New warning for deprecated syntax sql/share/japanese/errmsg.txt: New warning for deprecated syntax sql/share/korean/errmsg.txt: New warning for deprecated syntax sql/share/norwegian-ny/errmsg.txt: New warning for deprecated syntax sql/share/norwegian/errmsg.txt: New warning for deprecated syntax sql/share/polish/errmsg.txt: New warning for deprecated syntax sql/share/portuguese/errmsg.txt: New warning for deprecated syntax sql/share/romanian/errmsg.txt: New warning for deprecated syntax sql/share/russian/errmsg.txt: New warning for deprecated syntax sql/share/serbian/errmsg.txt: New warning for deprecated syntax sql/share/slovak/errmsg.txt: New warning for deprecated syntax sql/share/spanish/errmsg.txt: New warning for deprecated syntax sql/share/swedish/errmsg.txt: New warning for deprecated syntax sql/share/ukrainian/errmsg.txt: New warning for deprecated syntax sql/sql_show.cc: Change TYPE= with ENGINE= sql/sql_yacc.yy: Introduce ENGINE keyword, Deprecate TYPE= syntax, Introduce SHOW ENGINE syntax, Deprecate SHOW INNODB/BDB syntax. mysql-test/r/alias.result: Change occurances of TYPE= to ENGINE= mysql-test/r/alter_table.result: Change occurances of TYPE= to ENGINE= mysql-test/r/auto_increment.result: Change occurances of TYPE= to ENGINE= mysql-test/r/bdb-alter-table-1.result: Change occurances of TYPE= to ENGINE= mysql-test/r/bdb-crash.result: Change occurances of TYPE= to ENGINE= mysql-test/r/bdb-deadlock.result: Change occurances of TYPE= to ENGINE= mysql-test/r/bdb.result: Change occurances of TYPE= to ENGINE= mysql-test/r/bdb_cache.result: Change occurances of TYPE= to ENGINE= mysql-test/r/case.result: Change occurances of TYPE= to ENGINE= mysql-test/r/cast.result: Change occurances of TYPE= to ENGINE= mysql-test/r/constraints.result: Change occurances of TYPE= to ENGINE= mysql-test/r/create.result: Change occurances of TYPE= to ENGINE= mysql-test/r/ctype_collate.result: Change occurances of TYPE= to ENGINE= mysql-test/r/ctype_latin1_de.result: Change occurances of TYPE= to ENGINE= mysql-test/r/ctype_many.result: Change occurances of TYPE= to ENGINE= mysql-test/r/ctype_mb.result: Change occurances of TYPE= to ENGINE= mysql-test/r/ctype_recoding.result: Change occurances of TYPE= to ENGINE= mysql-test/r/ctype_ucs.result: Change occurances of TYPE= to ENGINE= mysql-test/r/delete.result: Change occurances of TYPE= to ENGINE= mysql-test/r/distinct.result: Change occurances of TYPE= to ENGINE= mysql-test/r/fulltext.result: Change occurances of TYPE= to ENGINE= mysql-test/r/fulltext2.result: Change occurances of TYPE= to ENGINE= mysql-test/r/fulltext_distinct.result: Change occurances of TYPE= to ENGINE= mysql-test/r/fulltext_left_join.result: Change occurances of TYPE= to ENGINE= mysql-test/r/func_compress.result: Change occurances of TYPE= to ENGINE= mysql-test/r/func_date_add.result: Change occurances of TYPE= to ENGINE= mysql-test/r/func_group.result: Change occurances of TYPE= to ENGINE= mysql-test/r/func_if.result: Change occurances of TYPE= to ENGINE= mysql-test/r/func_str.result: Change occurances of TYPE= to ENGINE= mysql-test/r/func_system.result: Change occurances of TYPE= to ENGINE= mysql-test/r/func_test.result: Change occurances of TYPE= to ENGINE= mysql-test/r/func_time.result: Change occurances of TYPE= to ENGINE= mysql-test/r/gis-rtree.result: Change occurances of TYPE= to ENGINE= mysql-test/r/group_by.result: Change occurances of TYPE= to ENGINE= mysql-test/r/handler.result: Change occurances of TYPE= to ENGINE= mysql-test/r/heap.result: Change occurances of TYPE= to ENGINE= mysql-test/r/heap_auto_increment.result: Change occurances of TYPE= to ENGINE= mysql-test/r/heap_btree.result: Change occurances of TYPE= to ENGINE= mysql-test/r/heap_hash.result: Change occurances of TYPE= to ENGINE= mysql-test/r/help.result: Change occurances of TYPE= to ENGINE= mysql-test/r/innodb-deadlock.result: Change occurances of TYPE= to ENGINE= mysql-test/r/innodb.result: Change occurances of TYPE= to ENGINE= mysql-test/r/innodb_cache.result: Change occurances of TYPE= to ENGINE= mysql-test/r/innodb_handler.result: Change occurances of TYPE= to ENGINE= mysql-test/r/insert_select.result: Change occurances of TYPE= to ENGINE= mysql-test/r/isam.result: Change occurances of TYPE= to ENGINE= mysql-test/r/join.result: Change occurances of TYPE= to ENGINE= mysql-test/r/join_crash.result: Change occurances of TYPE= to ENGINE= mysql-test/r/join_outer.result: Change occurances of TYPE= to ENGINE= mysql-test/r/key.result: Change occurances of TYPE= to ENGINE= mysql-test/r/lock.result: Change occurances of TYPE= to ENGINE= mysql-test/r/lock_tables_lost_commit.result: Change occurances of TYPE= to ENGINE= mysql-test/r/merge.result: Change occurances of TYPE= to ENGINE= mysql-test/r/mix_innodb_myisam_binlog.result: Change occurances of TYPE= to ENGINE= mysql-test/r/multi_update.result: Change occurances of TYPE= to ENGINE= mysql-test/r/myisam.result: Change occurances of TYPE= to ENGINE= mysql-test/r/null.result: Change occurances of TYPE= to ENGINE= mysql-test/r/null_key.result: Change occurances of TYPE= to ENGINE= mysql-test/r/order_by.result: Change occurances of TYPE= to ENGINE= mysql-test/r/query_cache.result: Change occurances of TYPE= to ENGINE= mysql-test/r/range.result: Change occurances of TYPE= to ENGINE= mysql-test/r/repair_part1.result: Change occurances of TYPE= to ENGINE= mysql-test/r/replace.result: Change occurances of TYPE= to ENGINE= mysql-test/r/rollback.result: Change occurances of TYPE= to ENGINE= mysql-test/r/rpl000006.result: Change occurances of TYPE= to ENGINE= mysql-test/r/rpl_flush_tables.result: Change occurances of TYPE= to ENGINE= mysql-test/r/rpl_insert_id.result: Change occurances of TYPE= to ENGINE= mysql-test/r/rpl_relayrotate.result: Change occurances of TYPE= to ENGINE= mysql-test/r/select.result: Change occurances of TYPE= to ENGINE= mysql-test/r/select_found.result: Change occurances of TYPE= to ENGINE= mysql-test/r/show_check.result: Change occurances of TYPE= to ENGINE= mysql-test/r/sql_mode.result: Change occurances of TYPE= to ENGINE= mysql-test/r/status.result: Change occurances of TYPE= to ENGINE= mysql-test/r/subselect.result: Change occurances of TYPE= to ENGINE= mysql-test/r/subselect2.result: Change occurances of TYPE= to ENGINE= mysql-test/r/subselect_innodb.result: Change occurances of TYPE= to ENGINE= mysql-test/r/symlink.result: Change occurances of TYPE= to ENGINE= mysql-test/r/temp_table.result: Change occurances of TYPE= to ENGINE= mysql-test/r/type_blob.result: Change occurances of TYPE= to ENGINE= mysql-test/r/type_datetime.result: Change occurances of TYPE= to ENGINE= mysql-test/r/type_enum.result: Change occurances of TYPE= to ENGINE= mysql-test/r/type_nchar.result: Change occurances of TYPE= to ENGINE= mysql-test/r/type_set.result: Change occurances of TYPE= to ENGINE= mysql-test/r/union.result: Change occurances of TYPE= to ENGINE= mysql-test/r/update.result: Change occurances of TYPE= to ENGINE= mysql-test/r/warnings.result: Change occurances of TYPE= to ENGINE= mysql-test/t/alias.test: Change occurances of TYPE= to ENGINE= mysql-test/t/alter_table.test: Change occurances of TYPE= to ENGINE= mysql-test/t/auto_increment.test: Change occurances of TYPE= to ENGINE= mysql-test/t/bdb-alter-table-1.test: Change occurances of TYPE= to ENGINE= mysql-test/t/bdb-crash.test: Change occurances of TYPE= to ENGINE= mysql-test/t/bdb-deadlock.test: Change occurances of TYPE= to ENGINE= mysql-test/t/bdb.test: Change occurances of TYPE= to ENGINE= mysql-test/t/bdb_cache.test: Change occurances of TYPE= to ENGINE= mysql-test/t/create.test: Change occurances of TYPE= to ENGINE= mysql-test/t/ctype_ucs.test: Change occurances of TYPE= to ENGINE= mysql-test/t/delete.test: Change occurances of TYPE= to ENGINE= mysql-test/t/distinct.test: Change occurances of TYPE= to ENGINE= mysql-test/t/fulltext.test: Change occurances of TYPE= to ENGINE= mysql-test/t/fulltext2.test: Change occurances of TYPE= to ENGINE= mysql-test/t/fulltext_distinct.test: Change occurances of TYPE= to ENGINE= mysql-test/t/fulltext_left_join.test: Change occurances of TYPE= to ENGINE= mysql-test/t/func_compress.test: Change occurances of TYPE= to ENGINE= mysql-test/t/func_date_add.test: Change occurances of TYPE= to ENGINE= mysql-test/t/func_group.test: Change occurances of TYPE= to ENGINE= mysql-test/t/func_if.test: Change occurances of TYPE= to ENGINE= mysql-test/t/func_str.test: Change occurances of TYPE= to ENGINE= mysql-test/t/func_test.test: Change occurances of TYPE= to ENGINE= mysql-test/t/func_time.test: Change occurances of TYPE= to ENGINE= mysql-test/t/gis-rtree.test: Change occurances of TYPE= to ENGINE= mysql-test/t/group_by.test: Change occurances of TYPE= to ENGINE= mysql-test/t/handler.test: Change occurances of TYPE= to ENGINE= mysql-test/t/heap.test: Change occurances of TYPE= to ENGINE= mysql-test/t/heap_auto_increment.test: Change occurances of TYPE= to ENGINE= mysql-test/t/heap_btree.test: Change occurances of TYPE= to ENGINE= mysql-test/t/heap_hash.test: Change occurances of TYPE= to ENGINE= mysql-test/t/help.test: Change occurances of TYPE= to ENGINE= mysql-test/t/innodb-deadlock.test: Change occurances of TYPE= to ENGINE= mysql-test/t/innodb.test: Change occurances of TYPE= to ENGINE= mysql-test/t/innodb_cache.test: Change occurances of TYPE= to ENGINE= mysql-test/t/innodb_handler.test: Change occurances of TYPE= to ENGINE= mysql-test/t/insert_select.test: Change occurances of TYPE= to ENGINE= mysql-test/t/isam.test: Change occurances of TYPE= to ENGINE= mysql-test/t/join.test: Change occurances of TYPE= to ENGINE= mysql-test/t/join_crash.test: Change occurances of TYPE= to ENGINE= mysql-test/t/join_outer.test: Change occurances of TYPE= to ENGINE= mysql-test/t/key.test: Change occurances of TYPE= to ENGINE= mysql-test/t/lock.test: Change occurances of TYPE= to ENGINE= mysql-test/t/lock_tables_lost_commit.test: Change occurances of TYPE= to ENGINE= mysql-test/t/merge.test: Change occurances of TYPE= to ENGINE= mysql-test/t/mix_innodb_myisam_binlog.test: Change occurances of TYPE= to ENGINE= mysql-test/t/multi_update.test: Change occurances of TYPE= to ENGINE= mysql-test/t/myisam.test: Change occurances of TYPE= to ENGINE= mysql-test/t/null.test: Change occurances of TYPE= to ENGINE= mysql-test/t/null_key.test: Change occurances of TYPE= to ENGINE= mysql-test/t/order_by.test: Change occurances of TYPE= to ENGINE= mysql-test/t/outfile.test: Change occurances of TYPE= to ENGINE= mysql-test/t/query_cache.test: Change occurances of TYPE= to ENGINE= mysql-test/t/query_cache_merge.test: Change occurances of TYPE= to ENGINE= mysql-test/t/range.test: Change occurances of TYPE= to ENGINE= mysql-test/t/repair_part1.test: Change occurances of TYPE= to ENGINE= mysql-test/t/replace.test: Change occurances of TYPE= to ENGINE= mysql-test/t/rollback.test: Change occurances of TYPE= to ENGINE= mysql-test/t/rpl000006.test: Change occurances of TYPE= to ENGINE= mysql-test/t/rpl_flush_tables.test: Change occurances of TYPE= to ENGINE= mysql-test/t/rpl_insert_id.test: Change occurances of TYPE= to ENGINE= mysql-test/t/rpl_relayrotate.test: Change occurances of TYPE= to ENGINE= mysql-test/t/select.test: Change occurances of TYPE= to ENGINE= mysql-test/t/select_found.test: Change occurances of TYPE= to ENGINE= mysql-test/t/show_check.test: Change occurances of TYPE= to ENGINE= mysql-test/t/sql_mode.test: Change occurances of TYPE= to ENGINE= mysql-test/t/status.test: Change occurances of TYPE= to ENGINE= mysql-test/t/subselect.test: Change occurances of TYPE= to ENGINE= mysql-test/t/subselect2.test: Change occurances of TYPE= to ENGINE= mysql-test/t/subselect_innodb.test: Change occurances of TYPE= to ENGINE= mysql-test/t/symlink.test: Change occurances of TYPE= to ENGINE= mysql-test/t/temp_table.test: Change occurances of TYPE= to ENGINE= mysql-test/t/type_datetime.test: Change occurances of TYPE= to ENGINE= mysql-test/t/type_set.test: Change occurances of TYPE= to ENGINE= mysql-test/t/union.test: Change occurances of TYPE= to ENGINE= mysql-test/t/update.test: Change occurances of TYPE= to ENGINE= mysql-test/t/warnings.test: Change occurances of TYPE= to ENGINE= New test for deprecated syntax --- include/mysqld_error.h | 3 +- mysql-test/r/alias.result | 2 +- mysql-test/r/alter_table.result | 18 +-- mysql-test/r/auto_increment.result | 2 +- mysql-test/r/bdb-alter-table-1.result | 2 +- mysql-test/r/bdb-crash.result | 2 +- mysql-test/r/bdb-deadlock.result | 4 +- mysql-test/r/bdb.result | 94 ++++++------ mysql-test/r/bdb_cache.result | 10 +- mysql-test/r/case.result | 4 +- mysql-test/r/cast.result | 6 +- mysql-test/r/constraints.result | 2 +- mysql-test/r/create.result | 28 ++-- mysql-test/r/ctype_collate.result | 6 +- mysql-test/r/ctype_latin1_de.result | 4 +- mysql-test/r/ctype_many.result | 10 +- mysql-test/r/ctype_mb.result | 10 +- mysql-test/r/ctype_recoding.result | 8 +- mysql-test/r/ctype_ucs.result | 10 +- mysql-test/r/delete.result | 2 +- mysql-test/r/distinct.result | 10 +- mysql-test/r/fulltext.result | 8 +- mysql-test/r/fulltext2.result | 4 +- mysql-test/r/fulltext_distinct.result | 4 +- mysql-test/r/fulltext_left_join.result | 4 +- mysql-test/r/func_compress.result | 2 +- mysql-test/r/func_date_add.result | 2 +- mysql-test/r/func_group.result | 2 +- mysql-test/r/func_if.result | 2 +- mysql-test/r/func_str.result | 8 +- mysql-test/r/func_system.result | 2 +- mysql-test/r/func_test.result | 4 +- mysql-test/r/func_time.result | 2 +- mysql-test/r/gis-rtree.result | 8 +- mysql-test/r/group_by.result | 4 +- mysql-test/r/handler.result | 2 +- mysql-test/r/heap.result | 34 ++--- mysql-test/r/heap_auto_increment.result | 4 +- mysql-test/r/heap_btree.result | 34 ++--- mysql-test/r/heap_hash.result | 32 ++-- mysql-test/r/help.result | 16 +- mysql-test/r/innodb-deadlock.result | 10 +- mysql-test/r/innodb.result | 150 +++++++++---------- mysql-test/r/innodb_cache.result | 12 +- mysql-test/r/innodb_handler.result | 6 +- mysql-test/r/insert_select.result | 4 +- mysql-test/r/isam.result | 14 +- mysql-test/r/join.result | 12 +- mysql-test/r/join_crash.result | 8 +- mysql-test/r/join_outer.result | 2 +- mysql-test/r/key.result | 2 +- mysql-test/r/lock.result | 6 +- mysql-test/r/lock_tables_lost_commit.result | 2 +- mysql-test/r/merge.result | 68 ++++----- mysql-test/r/mix_innodb_myisam_binlog.result | 6 +- mysql-test/r/multi_update.result | 18 +-- mysql-test/r/myisam.result | 8 +- mysql-test/r/null.result | 2 +- mysql-test/r/null_key.result | 10 +- mysql-test/r/order_by.result | 8 +- mysql-test/r/query_cache.result | 2 +- mysql-test/r/range.result | 4 +- mysql-test/r/repair_part1.result | 4 +- mysql-test/r/replace.result | 6 +- mysql-test/r/rollback.result | 2 +- mysql-test/r/rpl000006.result | 2 +- mysql-test/r/rpl_flush_tables.result | 20 +-- mysql-test/r/rpl_insert_id.result | 4 +- mysql-test/r/rpl_relayrotate.result | 2 +- mysql-test/r/select.result | 12 +- mysql-test/r/select_found.result | 2 +- mysql-test/r/show_check.result | 22 +-- mysql-test/r/sql_mode.result | 10 +- mysql-test/r/status.result | 2 +- mysql-test/r/subselect.result | 64 ++++---- mysql-test/r/subselect2.result | 8 +- mysql-test/r/subselect_innodb.result | 14 +- mysql-test/r/symlink.result | 4 +- mysql-test/r/temp_table.result | 6 +- mysql-test/r/type_blob.result | 2 +- mysql-test/r/type_datetime.result | 2 +- mysql-test/r/type_enum.result | 4 +- mysql-test/r/type_nchar.result | 14 +- mysql-test/r/type_set.result | 6 +- mysql-test/r/union.result | 56 +++---- mysql-test/r/update.result | 4 +- mysql-test/r/warnings.result | 11 +- mysql-test/t/alias.test | 2 +- mysql-test/t/alter_table.test | 10 +- mysql-test/t/auto_increment.test | 2 +- mysql-test/t/bdb-alter-table-1.test | 2 +- mysql-test/t/bdb-crash.test | 2 +- mysql-test/t/bdb-deadlock.test | 4 +- mysql-test/t/bdb.test | 94 ++++++------ mysql-test/t/bdb_cache.test | 10 +- mysql-test/t/create.test | 8 +- mysql-test/t/ctype_ucs.test | 8 +- mysql-test/t/delete.test | 2 +- mysql-test/t/distinct.test | 10 +- mysql-test/t/fulltext.test | 6 +- mysql-test/t/fulltext2.test | 4 +- mysql-test/t/fulltext_distinct.test | 4 +- mysql-test/t/fulltext_left_join.test | 4 +- mysql-test/t/func_compress.test | 2 +- mysql-test/t/func_date_add.test | 2 +- mysql-test/t/func_group.test | 2 +- mysql-test/t/func_if.test | 2 +- mysql-test/t/func_str.test | 6 +- mysql-test/t/func_test.test | 4 +- mysql-test/t/func_time.test | 2 +- mysql-test/t/gis-rtree.test | 4 +- mysql-test/t/group_by.test | 4 +- mysql-test/t/handler.test | 2 +- mysql-test/t/heap.test | 34 ++--- mysql-test/t/heap_auto_increment.test | 4 +- mysql-test/t/heap_btree.test | 34 ++--- mysql-test/t/heap_hash.test | 32 ++-- mysql-test/t/help.test | 16 +- mysql-test/t/innodb-deadlock.test | 10 +- mysql-test/t/innodb.test | 148 +++++++++--------- mysql-test/t/innodb_cache.test | 12 +- mysql-test/t/innodb_handler.test | 6 +- mysql-test/t/insert_select.test | 4 +- mysql-test/t/isam.test | 14 +- mysql-test/t/join.test | 12 +- mysql-test/t/join_crash.test | 8 +- mysql-test/t/join_outer.test | 2 +- mysql-test/t/key.test | 2 +- mysql-test/t/lock.test | 6 +- mysql-test/t/lock_tables_lost_commit.test | 2 +- mysql-test/t/merge.test | 48 +++--- mysql-test/t/mix_innodb_myisam_binlog.test | 6 +- mysql-test/t/multi_update.test | 18 +-- mysql-test/t/myisam.test | 8 +- mysql-test/t/null.test | 2 +- mysql-test/t/null_key.test | 10 +- mysql-test/t/order_by.test | 8 +- mysql-test/t/outfile.test | 2 +- mysql-test/t/query_cache.test | 2 +- mysql-test/t/query_cache_merge.test | 2 +- mysql-test/t/range.test | 4 +- mysql-test/t/repair_part1.test | 4 +- mysql-test/t/replace.test | 6 +- mysql-test/t/rollback.test | 2 +- mysql-test/t/rpl000006.test | 2 +- mysql-test/t/rpl_flush_tables.test | 2 +- mysql-test/t/rpl_insert_id.test | 4 +- mysql-test/t/rpl_relayrotate.test | 2 +- mysql-test/t/select.test | 12 +- mysql-test/t/select_found.test | 2 +- mysql-test/t/show_check.test | 4 +- mysql-test/t/sql_mode.test | 2 +- mysql-test/t/status.test | 2 +- mysql-test/t/subselect.test | 56 +++---- mysql-test/t/subselect2.test | 8 +- mysql-test/t/subselect_innodb.test | 14 +- mysql-test/t/symlink.test | 12 +- mysql-test/t/temp_table.test | 6 +- mysql-test/t/type_datetime.test | 2 +- mysql-test/t/type_set.test | 2 +- mysql-test/t/union.test | 6 +- mysql-test/t/update.test | 4 +- mysql-test/t/warnings.test | 12 +- sql/lex.h | 131 ++++++++-------- sql/share/czech/errmsg.txt | 1 + sql/share/danish/errmsg.txt | 1 + sql/share/dutch/errmsg.txt | 1 + sql/share/english/errmsg.txt | 1 + sql/share/estonian/errmsg.txt | 1 + sql/share/french/errmsg.txt | 1 + sql/share/german/errmsg.txt | 1 + sql/share/greek/errmsg.txt | 1 + sql/share/hungarian/errmsg.txt | 1 + sql/share/italian/errmsg.txt | 1 + sql/share/japanese/errmsg.txt | 1 + sql/share/korean/errmsg.txt | 1 + sql/share/norwegian-ny/errmsg.txt | 1 + sql/share/norwegian/errmsg.txt | 1 + sql/share/polish/errmsg.txt | 1 + sql/share/portuguese/errmsg.txt | 1 + sql/share/romanian/errmsg.txt | 1 + sql/share/russian/errmsg.txt | 1 + sql/share/serbian/errmsg.txt | 1 + sql/share/slovak/errmsg.txt | 1 + sql/share/spanish/errmsg.txt | 1 + sql/share/swedish/errmsg.txt | 1 + sql/share/ukrainian/errmsg.txt | 1 + sql/sql_show.cc | 2 +- sql/sql_yacc.yy | 43 +++++- 189 files changed, 1075 insertions(+), 1000 deletions(-) diff --git a/include/mysqld_error.h b/include/mysqld_error.h index bb138f2c7eb..40169cf73c6 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -302,4 +302,5 @@ #define ER_UNKNOWN_KEY_CACHE 1283 #define ER_WARN_HOSTNAME_WONT_WORK 1284 #define ER_UNKNOWN_TABLE_ENGINE 1285 -#define ER_ERROR_MESSAGES 286 +#define ER_WARN_DEPRECATED_SYNTAX 1286 +#define ER_ERROR_MESSAGES 287 diff --git a/mysql-test/r/alias.result b/mysql-test/r/alias.result index 5ed10b58929..7f606367f39 100644 --- a/mysql-test/r/alias.result +++ b/mysql-test/r/alias.result @@ -47,7 +47,7 @@ KEY prov_hdl_nr(prov_hdl_nr), KEY mcbs_aufnr(mcbs_aufnr), KEY kundentyp(kundentyp), KEY p_nr(p_nr,suffix) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); INSERT INTO t1 VALUES (3359358,407,3359358,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1501358,2137473,'N','','N',1909159,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index b82255bf652..7ec12c1b021 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -73,10 +73,10 @@ body text NOT NULL, user_id int(11) unsigned NOT NULL default '0', status enum('new','old') NOT NULL default 'new', PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body; DROP TABLE t1; -CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) type=myisam; +CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam; insert into t1 values (null,"hello"); LOCK TABLES t1 WRITE; ALTER TABLE t1 ADD Column new_col int not null; @@ -323,31 +323,31 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) character set koi8r default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t1 DEFAULT CHARACTER SET latin1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) character set koi8r default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t1 CHARACTER SET latin1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t1 DEFAULT CHARACTER SET cp1251; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) character set latin1 default NULL -) TYPE=MyISAM DEFAULT CHARSET=cp1251 +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 drop table t1; CREATE TABLE t1 ( Host varchar(16) binary NOT NULL default '', User varchar(16) binary NOT NULL default '', PRIMARY KEY (Host,User) -) TYPE=MyISAM; +) ENGINE=MyISAM; ALTER TABLE t1 DISABLE KEYS; LOCK TABLES t1 WRITE; INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty'); @@ -366,7 +366,7 @@ Host varchar(16) binary NOT NULL default '', User varchar(16) binary NOT NULL default '', PRIMARY KEY (Host,User), KEY (Host) -) TYPE=MyISAM; +) ENGINE=MyISAM; ALTER TABLE t1 DISABLE KEYS; SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment @@ -403,7 +403,7 @@ Host varchar(16) binary NOT NULL default '', User varchar(16) binary NOT NULL default '', PRIMARY KEY (Host,User), KEY (Host) -) TYPE=MyISAM; +) ENGINE=MyISAM; LOCK TABLES t1 WRITE; ALTER TABLE t1 DISABLE KEYS; SHOW INDEX FROM t1; diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 113c2930977..05317c0f845 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -1,6 +1,6 @@ drop table if exists t1; SET SQL_WARNINGS=1; -create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3; +create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; insert into t1 values (NULL,5),(NULL,6); diff --git a/mysql-test/r/bdb-alter-table-1.result b/mysql-test/r/bdb-alter-table-1.result index 095d89355ad..0401002f1f3 100644 --- a/mysql-test/r/bdb-alter-table-1.result +++ b/mysql-test/r/bdb-alter-table-1.result @@ -1,5 +1,5 @@ drop table if exists t1; -create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB; +create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) engine=BDB; insert into t1 values(1, 't1',4,9); insert into t1 values(2, 'metatable',1,9); insert into t1 values(3, 'metaindex',1,9 ); diff --git a/mysql-test/r/bdb-crash.result b/mysql-test/r/bdb-crash.result index 5079368ea21..8f5b8c08f1d 100644 --- a/mysql-test/r/bdb-crash.result +++ b/mysql-test/r/bdb-crash.result @@ -14,7 +14,7 @@ ChargeTimeStamp varchar(20), PRIMARY KEY (ChargeID), KEY ServiceID (ServiceID), KEY ChargeDate (ChargeDate) -) type=BDB; +) engine=BDB; BEGIN; INSERT INTO t1 VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now'); diff --git a/mysql-test/r/bdb-deadlock.result b/mysql-test/r/bdb-deadlock.result index 6606b0d9b38..c5871ff282a 100644 --- a/mysql-test/r/bdb-deadlock.result +++ b/mysql-test/r/bdb-deadlock.result @@ -1,6 +1,6 @@ drop table if exists t1,t2; -create table t1 (id integer, x integer) type=BDB; -create table t2 (id integer, x integer) type=BDB; +create table t1 (id integer, x integer) engine=BDB; +create table t2 (id integer, x integer) engine=BDB; insert into t1 values(0, 0); insert into t2 values(0, 0); set autocommit=0; diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index f619775aa97..6021f02f2a6 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -1,5 +1,5 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb; +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=bdb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); select id, code, name from t1 order by id; id code name @@ -38,7 +38,7 @@ level tinyint(4) DEFAULT '0' NOT NULL, PRIMARY KEY (id), KEY parent_id (parent_id), KEY level (level) -) type=bdb; +) engine=bdb; INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); update t1 set parent_id=parent_id+100; select * from t1 where parent_id=102; @@ -176,7 +176,7 @@ CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (gesuchnr,benutzer_id) -) type=BDB; +) engine=BDB; replace into t1 (gesuchnr,benutzer_id) values (2,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); @@ -185,14 +185,14 @@ gesuchnr benutzer_id 1 1 2 1 drop table t1; -create table t1 (id int not null primary key, x int not null, key (x)) type=bdb; +create table t1 (id int not null primary key, x int not null, key (x)) engine=bdb; insert into t1 (id, x) values (1, 1); replace into t1 (id, x) values (1, 2); select * from t1; id x 1 2 drop table t1; -create table t1 (a int) type=bdb; +create table t1 (a int) engine=bdb; insert into t1 values (1), (2); optimize table t1; Table Op Msg_type Msg_text @@ -205,7 +205,7 @@ check table t1; Table Op Msg_type Msg_text test.t1 check error The storage engine for the table doesn't support check drop table t1; -create table t1 (a int,b varchar(20)) type=bdb; +create table t1 (a int,b varchar(20)) engine=bdb; insert into t1 values (1,""), (2,"testing"); delete from t1 where a = 1; select * from t1; @@ -220,13 +220,13 @@ show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 skr 1 a A 3 NULL NULL YES BTREE drop table t1; -create table t1 (a int,b varchar(20),key(a)) type=bdb; +create table t1 (a int,b varchar(20),key(a)) engine=bdb; insert into t1 values (1,""), (2,"testing"); select * from t1 where a = 1; a b 1 drop table t1; -create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) type=BDB; +create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) engine=BDB; insert into t1 values ("a",1),("b",2),("a",2),("c",1); insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL); insert into t1 (a) values ("a"),("b"),("c"),("d"); @@ -256,7 +256,7 @@ select count(*) from t1; count(*) 16 drop table t1; -create table t1 (n int not null primary key) type=bdb; +create table t1 (n int not null primary key) engine=bdb; set autocommit=0; insert into t1 values (4); rollback; @@ -287,7 +287,7 @@ n 6 rollback; drop table t1; -create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=BDB; +create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=BDB; begin; insert into t1 values(1,'hamdouni'); select id as afterbegin_id,nom as afterbegin_nom from t1; @@ -306,7 +306,7 @@ select id as afterrollback_id,nom as afterrollback_nom from t1; afterrollback_id afterrollback_nom set autocommit=1; drop table t1; -CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=bdb; +CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=bdb; insert into t1 values ('pippo', 12); insert into t1 values ('pippo', 12); ERROR 23000: Duplicate entry 'pippo' for key 1 @@ -327,13 +327,13 @@ select * from t1; id val drop table t1; set autocommit=1; -CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=BDB; +CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=BDB; INSERT INTO t1 VALUES (1, 'Jochen'); select * from t1; ID NAME 1 Jochen drop table t1; -CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=BDB; +CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=BDB; set autocommit=0; INSERT INTO t1 SET _userid='marc@anyware.co.uk'; COMMIT; @@ -352,7 +352,7 @@ phone varchar(100), ref_email varchar(100) DEFAULT '' NOT NULL, detail varchar(200), PRIMARY KEY (user_id,ref_email) -)type=bdb; +)engine=bdb; INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); select * from t1 where user_id=10292; user_id name phone ref_email detail @@ -390,7 +390,7 @@ t1 1 a 1 a A NULL NULL NULL BTREE t1 1 a_2 1 a A NULL NULL NULL BTREE drop table t1; create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); -alter table t1 type=BDB; +alter table t1 engine=BDB; insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); select * from t1; col1 col2 @@ -424,8 +424,8 @@ col1 col2 co3 4 7 0 5 2 0 drop table t1; -create table t1 (a int not null , b int, primary key (a)) type = BDB; -create table t2 (a int not null , b int, primary key (a)) type = myisam; +create table t1 (a int not null , b int, primary key (a)) engine = BDB; +create table t2 (a int not null , b int, primary key (a)) engine = myisam; insert into t1 VALUES (1,3) , (2,3), (3,3); select * from t1; a b @@ -460,7 +460,7 @@ email varchar(64) DEFAULT '' NOT NULL, passwd varchar(32) binary DEFAULT '' NOT NULL, PRIMARY KEY (id), UNIQUE ggid (ggid) -) TYPE=BDB; +) ENGINE=BDB; insert into t1 (ggid,passwd) values ('test1','xxx'); insert into t1 (ggid,passwd) values ('test2','yyy'); insert into t1 (ggid,passwd) values ('test2','this will fail'); @@ -502,7 +502,7 @@ access_time time, approved datetime, dummy_primary_key int(11) NOT NULL auto_increment, PRIMARY KEY (dummy_primary_key) -) TYPE=BDB; +) ENGINE=BDB; INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); @@ -523,7 +523,7 @@ level tinyint(4) DEFAULT '0' NOT NULL, KEY (id), KEY parent_id (parent_id), KEY level (level) -) type=bdb; +) engine=bdb; INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); INSERT INTO t1 values (179,5,2); update t1 set parent_id=parent_id+100; @@ -697,7 +697,7 @@ sca_sdesc varchar(50), sca_sch_desc varchar(16), PRIMARY KEY (sca_code, cat_code, lan_code), INDEX sca_pic (sca_pic) -) type = bdb ; +) engine = bdb ; INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); select count(*) from t1 where sca_code = 'PD'; count(*) @@ -730,7 +730,7 @@ update t1 set sca_pic="test" where sca_pic is null; delete from t1 where sca_code='pd'; drop table t1; set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=bdb; +CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb; insert into t1 (a) values(1),(2),(3); select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; a @@ -745,7 +745,7 @@ a 5 drop table t1; flush logs; -create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) type=bdb; +create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) engine=bdb; insert into t1 values ('this is a blob', 1), (null, -1), (null, null),("",1),("",2),("",3); select b from t1 where b = 'this is a blob'; b @@ -774,7 +774,7 @@ updated 1 2 3 drop table t1; -create table t1 (a varchar(100) not null, primary key(a), b int not null) type=bdb; +create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=bdb; insert into t1 values("hello",1),("world",2); select * from t1 order by b desc; a b @@ -787,7 +787,7 @@ show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A 2 NULL NULL BTREE drop table t1; -create table t1 (i int, j int )TYPE=BDB; +create table t1 (i int, j int )ENGINE=BDB; insert into t1 values (1,2); select * from t1 where i=1 and j=2; i j @@ -804,7 +804,7 @@ branch_name varchar(255) not null, branch_active int not null default 1, unique branch_name(branch_name), index branch_active(branch_active) -) type=bdb; +) engine=bdb; create table t2 ( target_id int auto_increment primary key, @@ -812,7 +812,7 @@ target_name varchar(255) not null, target_active int not null default 1, unique target_name(target_name), index target_active(target_active) -) type=bdb; +) engine=bdb; create table t3 ( platform_id int auto_increment primary key, @@ -820,7 +820,7 @@ platform_name varchar(255) not null, platform_active int not null default 1, unique platform_name(platform_name), index platform_active(platform_active) -) type=bdb; +) engine=bdb; create table t4 ( product_id int auto_increment primary key, @@ -829,7 +829,7 @@ version_file varchar(255) not null, product_active int not null default 1, unique product_name(product_name), index product_active(product_active) -) type=bdb; +) engine=bdb; create table t5 ( product_file_id int auto_increment primary key, @@ -841,7 +841,7 @@ module_name varchar(255) not null, file_included int not null default 1, unique product_file(product_id,file_name), index file_included(file_included) -) type=bdb; +) engine=bdb; create table t6 ( file_platform_id int auto_increment primary key, @@ -853,7 +853,7 @@ build_filename varchar(255) not null, /* default filename in the build archive */ archive_filename varchar(255) not null, unique file_platform(product_file_id,platform_id,branch_id) -) type=bdb; +) engine=bdb; create table t8 ( archive_id int auto_increment primary key, @@ -864,7 +864,7 @@ product_id int not null, status_id int not null default 1, unique archive(branch_id,target_id,platform_id,product_id), index status_id(status_id) -) type=bdb; +) engine=bdb; create table t7 ( build_id int auto_increment primary key, @@ -877,7 +877,7 @@ build_tag varchar(255) not null, /* path relative to the build archive root, e.g. 'current' */ build_path text not null, unique build(branch_id,target_id,build_number) -) type=bdb; +) engine=bdb; insert into t1 (branch_name) values ('RealMedia'); insert into t1 (branch_name) @@ -981,7 +981,7 @@ CREATE TABLE t1 ( a tinytext NOT NULL, b tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (a(32),b) -) TYPE=BDB; +) ENGINE=BDB; INSERT INTO t1 VALUES ('a',1),('a',2); SELECT * FROM t1 WHERE a='a' AND b=2; a b @@ -998,13 +998,13 @@ CREATE TABLE t1 ( a int3 unsigned NOT NULL, b int1 unsigned NOT NULL, UNIQUE (a, b) -) TYPE = BDB; +) ENGINE = BDB; INSERT INTO t1 VALUES (1, 1); SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; MIN(B) MAX(b) 1 1 drop table t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; insert into t1 values (99,1,2,'D'),(1,1,2,'D'); @@ -1021,7 +1021,7 @@ id 2 UNLOCK TABLES; DROP TABLE t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; begin; @@ -1042,14 +1042,14 @@ id id3 100 2 UNLOCK TABLES; DROP TABLE t1; -CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) TYPE=BerkeleyDB; -CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) TYPE=BerkeleyDB; +CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) ENGINE=BerkeleyDB; +CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) ENGINE=BerkeleyDB; select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; KINMU_DATE select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; KINMU_DATE DROP TABLE t1,t2; -create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; +create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) engine=bdb; insert into t1 values (1,1), (1,2); select * from t1 where a = 1; a b @@ -1066,9 +1066,9 @@ a b 1 1 1 2 drop table t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; insert into t1 values (0,0,0,'ABCDEFGHIJ'); -create table t2 (id int NOT NULL,primary key (id)) type=bdb; +create table t2 (id int NOT NULL,primary key (id)) engine=bdb; LOCK TABLES t1 WRITE, t2 WRITE; insert into t2 values(1); SELECT t1.* FROM t1 WHERE id IN (1); @@ -1078,13 +1078,13 @@ id id2 id3 dummy1 NULL NULL NULL NULL delete from t1 where id3 >= 0 and id3 <= 0; drop table t1,t2; -CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) TYPE=BDB; +CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) ENGINE=BDB; INSERT INTO t1 VALUES ('00000000-e6c4ddeaa6-003b8-83458387','programs/xxxxxxxx.wmv','00000000-e6c4ddeb32-003bc-83458387'); SELECT * FROM t1 WHERE p='programs/xxxxxxxx.wmv'; i p s 00000000-e6c4ddeaa6-003b8-83458387 programs/xxxxxxxx.wmv 00000000-e6c4ddeb32-003bc-83458387 drop table t1; -CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) TYPE=BerkeleyDB; +CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) ENGINE=BerkeleyDB; select INFO_NOTE from t1 where STR_DATE = '20010610'; INFO_NOTE select INFO_NOTE from t1 where STR_DATE < '20010610'; @@ -1092,8 +1092,8 @@ INFO_NOTE select INFO_NOTE from t1 where STR_DATE > '20010610'; INFO_NOTE drop table t1; -create table t1 (a int not null, b int, primary key (a)) type =bdb; -create table t2 (a int not null, b int, primary key (a)) type =bdb; +create table t1 (a int not null, b int, primary key (a)) engine =bdb; +create table t2 (a int not null, b int, primary key (a)) engine =bdb; insert into t1 values (2, 3),(1, 7),(10, 7); insert into t2 values (2, 3),(1, 7),(10, 7); select * from t1; @@ -1114,7 +1114,7 @@ a b select * from t2; a b drop table t1,t2; -create table t1 (x int not null, index(x)) type=bdb; +create table t1 (x int not null, index(x)) engine=bdb; insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); select * from t1 where x <= 10 and x >= 7; x diff --git a/mysql-test/r/bdb_cache.result b/mysql-test/r/bdb_cache.result index ea00feb2111..218fd489c6a 100644 --- a/mysql-test/r/bdb_cache.result +++ b/mysql-test/r/bdb_cache.result @@ -1,7 +1,7 @@ drop table if exists t1, t2, t3; flush status; set autocommit=0; -create table t1 (a int not null) type=bdb; +create table t1 (a int not null) engine=bdb; insert into t1 values (1),(2),(3); select * from t1; a @@ -15,7 +15,7 @@ drop table t1; commit; set autocommit=1; begin; -create table t1 (a int not null) type=bdb; +create table t1 (a int not null) engine=bdb; insert into t1 values (1),(2),(3); select * from t1; a @@ -27,9 +27,9 @@ Variable_name Value Qcache_queries_in_cache 0 drop table t1; commit; -create table t1 (a int not null) type=bdb; -create table t2 (a int not null) type=bdb; -create table t3 (a int not null) type=bdb; +create table t1 (a int not null) engine=bdb; +create table t2 (a int not null) engine=bdb; +create table t3 (a int not null) engine=bdb; insert into t1 values (1),(2); insert into t2 values (1),(2); insert into t3 values (1),(2); diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index e9d432de077..14b1788ddd6 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -105,7 +105,7 @@ t1 CREATE TABLE `t1` ( `c7` double(3,1) NOT NULL default '0.0', `c8` double(3,1) NOT NULL default '0.0', `c9` double(3,1) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; SELECT CASE WHEN 1 @@ -152,5 +152,5 @@ t1 CREATE TABLE `t1` ( `COALESCE(1,'1')` char(1) NOT NULL default '', `COALESCE(1.1,'1')` char(3) NOT NULL default '', `COALESCE('a' COLLATE latin1_bin,'b')` char(1) character set latin1 collate latin1_bin NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 43afd02169c..acca50b45dd 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -45,7 +45,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `t` char(4) character set cp1251 NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select cast(_latin1'ab' AS char) as c1, @@ -72,7 +72,7 @@ t1 CREATE TABLE `t1` ( `c3` char(2) binary NOT NULL default '', `c4` char(2) binary NOT NULL default '', `c5` char(2) binary NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select cast(_koi8r'ÆÇ' AS nchar) as c1, @@ -99,7 +99,7 @@ t1 CREATE TABLE `t1` ( `c3` char(2) character set utf8 NOT NULL default '', `c4` char(2) character set utf8 NOT NULL default '', `c5` char(2) character set utf8 NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select cast("2001-1-1" as date) = "2001-01-01"; cast("2001-1-1" as date) = "2001-01-01" diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result index 7cd8053c21b..d4d525c8991 100644 --- a/mysql-test/r/constraints.result +++ b/mysql-test/r/constraints.result @@ -25,5 +25,5 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `constraint_1` (`a`), UNIQUE KEY `key_1` (`a`), UNIQUE KEY `key_2` (`a`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 2f61b4838ee..5df29fee298 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -17,9 +17,9 @@ b drop table t1; -create table t1 (a int not null auto_increment,primary key (a)) type=heap; +create table t1 (a int not null auto_increment,primary key (a)) engine=heap; drop table t1; -create table t2 type=heap select * from t1; +create table t2 engine=heap select * from t1; ERROR 42S02: Table 'test.t1' doesn't exist create table t2 select auto+1 from t1; ERROR 42S02: Table 'test.t1' doesn't exist @@ -29,12 +29,12 @@ Note 1051 Unknown table 't1' Note 1051 Unknown table 't2' create table t1 (b char(0) not null, index(b)); ERROR 42000: The used storage engine can't index column 'b' -create table t1 (a int not null,b text) type=heap; +create table t1 (a int not null,b text) engine=heap; ERROR 42000: The used table type doesn't support BLOB/TEXT columns drop table if exists t1; Warnings: Note 1051 Unknown table 't1' -create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap; +create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap; ERROR 42000: Incorrect table definition; There can only be one auto column and it must be defined as a key create table not_existing_database.test (a int); Got one of the listed errors @@ -180,7 +180,7 @@ t1 CREATE TABLE `t1` ( KEY `b_29` (`b`), KEY `b_30` (`b`), KEY `b_31` (`b`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 select if(1,'1','0'), month("2002-08-02"); drop table t1; @@ -198,7 +198,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0' -) TYPE=HEAP DEFAULT CHARSET=latin1 +) ENGINE=HEAP DEFAULT CHARSET=latin1 drop table t1; SET SESSION table_type="gemini"; ERROR 42000: Unknown table engine 'gemini' @@ -210,7 +210,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0' -) TYPE=HEAP DEFAULT CHARSET=latin1 +) ENGINE=HEAP DEFAULT CHARSET=latin1 SET SESSION table_type=default; drop table t1; create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2)); @@ -275,7 +275,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `id` int(11) NOT NULL default '0', `name` char(20) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t3; id name create table if not exists t3 like t1; @@ -289,7 +289,7 @@ show create table t3; Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( `id` int(11) NOT NULL default '0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t3; id drop table t3; @@ -298,7 +298,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `id` int(11) NOT NULL default '0', `name` char(20) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t3; id name drop table t2, t3; @@ -310,14 +310,14 @@ Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( `id` int(11) NOT NULL default '0', `name` char(20) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 create table t2 like t3; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL default '0', `name` char(20) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t2; id name create table t3 like t1; @@ -343,7 +343,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0' -) TYPE=HEAP DEFAULT CHARSET=latin1 +) ENGINE=HEAP DEFAULT CHARSET=latin1 drop table t1; SET SESSION table_type="gemini"; ERROR 42000: Unknown table engine 'gemini' @@ -355,7 +355,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0' -) TYPE=HEAP DEFAULT CHARSET=latin1 +) ENGINE=HEAP DEFAULT CHARSET=latin1 SET SESSION table_type=default; drop table t1; create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob); diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index 2186b155f99..a3e29d24264 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -491,7 +491,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `latin1_f` char(32) NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW FIELDS FROM t1; Field Type Null Key Default Extra latin1_f char(32) @@ -501,7 +501,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `latin1_f` char(32) character set latin1 collate latin1_bin default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW FIELDS FROM t1; Field Type Null Key Default Extra latin1_f char(32) YES NULL @@ -510,7 +510,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `latin1_f` char(32) character set latin1 collate latin1_bin default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW FIELDS FROM t1; Field Type Null Key Default Extra latin1_f char(32) YES NULL diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result index f1049b81d26..7f150cb0698 100644 --- a/mysql-test/r/ctype_latin1_de.result +++ b/mysql-test/r/ctype_latin1_de.result @@ -225,7 +225,7 @@ t1 CREATE TABLE `t1` ( `word` varchar(255) collate latin1_german2_ci NOT NULL default '', `word2` varchar(255) collate latin1_german2_ci NOT NULL default '', KEY `word` (`word`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae'); update t1 set word2=word; select word, word=binary 0xdf as t from t1 having t > 0; @@ -284,7 +284,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `s1` char(5) collate latin1_german2_ci default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci INSERT INTO t1 VALUES ('Ü'); INSERT INTO t1 VALUES ('ue'); SELECT DISTINCT s1 FROM t1; diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index 764503f9e22..173d41ecdd1 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -9,14 +9,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin1 NOT NULL default '', `koi8_ru_f` char(32) character set koi8r NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin5 +) ENGINE=MyISAM DEFAULT CHARSET=latin5 ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', `koi8_ru_f` char(32) character set koi8r NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin5 +) ENGINE=MyISAM DEFAULT CHARSET=latin5 ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table @@ -24,7 +24,7 @@ t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', `koi8_ru_f` char(32) character set koi8r NOT NULL default '', `latin5_f` char(32) NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin5 +) ENGINE=MyISAM DEFAULT CHARSET=latin5 ALTER TABLE t1 DEFAULT CHARSET=latin2; ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; @@ -34,14 +34,14 @@ t1 CREATE TABLE `t1` ( `koi8_ru_f` char(32) character set koi8r NOT NULL default '', `latin5_f` char(32) character set latin5 NOT NULL default '', `latin2_f` char(32) NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin2 +) ENGINE=MyISAM DEFAULT CHARSET=latin2 ALTER TABLE t1 DROP latin2_f, DROP latin5_f; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) NOT NULL default '', `koi8_ru_f` char(32) character set koi8r NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin2 +) ENGINE=MyISAM DEFAULT CHARSET=latin2 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('c','LAT SMALL C'); diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result index 88cd1b4f7fe..288033e7530 100644 --- a/mysql-test/r/ctype_mb.result +++ b/mysql-test/r/ctype_mb.result @@ -5,7 +5,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` char(4) character set utf8 NOT NULL default '', `c2` char(4) character set utf8 NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELETE FROM t1; ALTER TABLE t1 ADD c3 CHAR(4) CHARACTER SET utf8; SHOW CREATE TABLE t1; @@ -14,7 +14,7 @@ t1 CREATE TABLE `t1` ( `c1` char(4) character set utf8 NOT NULL default '', `c2` char(4) character set utf8 NOT NULL default '', `c3` char(4) character set utf8 default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd'); Warnings: Warning 1264 Data truncated for column 'c1' at row 1 @@ -30,7 +30,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(4) character set utf8 default NULL, KEY `key_a` (`a`(3)) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW KEYS FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 key_a 1 a A NULL 9 NULL YES BTREE @@ -40,7 +40,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(4) default NULL, KEY `key_a` (`a`(3)) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW KEYS FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 key_a 1 a A NULL 3 NULL YES BTREE @@ -50,7 +50,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(4) character set utf8 default NULL, KEY `key_a` (`a`(3)) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW KEYS FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 key_a 1 a A NULL 9 NULL YES BTREE diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index 5afd2c041c8..646dcb76f96 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -6,7 +6,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) character set cp1251 default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT a FROM t1; a ÐÒÏÂÁ @@ -25,7 +25,7 @@ SHOW CREATE TABLE Table Create Table ÔÁÂÌÉÃÁ CREATE TABLE `ÔÁÂÌÉÃÁ` ( `ÐÏÌÅ` char(32) character set koi8r NOT NULL default '' COMMENT 'ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ' -) TYPE=MyISAM DEFAULT CHARSET=latin1 COMMENT='ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ' SHOW FIELDS FROM ÔÁÂÌÉÃÁ; Field Type Null Key Default Extra ÐÏÌÅ char(32) @@ -37,7 +37,7 @@ SHOW CREATE TABLE Table Create Table òàáëèöà CREATE TABLE `òàáëèöà` ( `ïîëå` char(32) character set koi8r NOT NULL default '' COMMENT 'êîììåíòàðèé ïîëÿ' -) TYPE=MyISAM DEFAULT CHARSET=latin1 COMMENT='êîììåíòàðèé òàáëèöû' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='êîììåíòàðèé òàáëèöû' SHOW FIELDS FROM òàáëèöà; Field Type Null Key Default Extra ïîëå char(32) @@ -49,7 +49,7 @@ SHOW CREATE TABLE таблица; Table Create Table таблица CREATE TABLE `таблица` ( `поле` char(32) character set koi8r NOT NULL default '' COMMENT 'комментарий полÑ' -) TYPE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы' SHOW FIELDS FROM таблица; Field Type Null Key Default Extra поле char(32) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 977797f0278..2f6dc0c23ca 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -45,7 +45,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `l` char(10) character set ucs2 NOT NULL default '', `r` char(10) character set ucs2 NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; SET NAMES koi8r; SET character_set_connection=ucs2; @@ -155,7 +155,7 @@ a Æù×ÁÐÒÏÌÄÖ DROP TABLE t1; CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word)) -TYPE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci; +ENGINE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci; INSERT INTO t1 (word) VALUES ("cat"); SELECT * FROM t1 WHERE word LIKE "c%"; word @@ -178,7 +178,7 @@ CREATE TABLE t1 ( word VARCHAR(64), bar INT(11) default 0, PRIMARY KEY (word)) -TYPE=MyISAM +ENGINE=MyISAM CHARSET ucs2 COLLATE ucs2_general_ci ; INSERT INTO t1 (word) VALUES ("aar"); @@ -213,7 +213,7 @@ DROP TABLE t1; CREATE TABLE t1 ( word VARCHAR(64) , PRIMARY KEY (word)) -TYPE=MyISAM +ENGINE=MyISAM CHARSET ucs2 COLLATE ucs2_general_ci; INSERT INTO t1 (word) VALUES ("aar"); @@ -238,7 +238,7 @@ CREATE TABLE t1 ( word TEXT, bar INT(11) AUTO_INCREMENT, PRIMARY KEY (bar)) -TYPE=MyISAM +ENGINE=MyISAM CHARSET ucs2 COLLATE ucs2_general_ci ; INSERT INTO t1 (word) VALUES ("aar"); diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 62724c19576..10f2c069429 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -37,7 +37,7 @@ bool char(0) default NULL, not_null varchar(20) binary NOT NULL default '', misc integer not null, PRIMARY KEY (not_null) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7); select * from t1 where misc > 5 and bool is null; bool not_null misc diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index d9beed25edf..80af2dd0983 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -360,7 +360,7 @@ a c 4 NULL 3 NULL drop table t1; -create table t1 (a char(1), key(a)) type=myisam; +create table t1 (a char(1), key(a)) engine=myisam; insert into t1 values('1'),('1'); select * from t1 where a >= '1'; a @@ -402,9 +402,9 @@ test2@testdomain.com Z001 test2@testdomain.com R002 test3@testdomain.com Z001 drop table t1,t2; -CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM; +CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) ENGINE=MyISAM; INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0); -CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM; +CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) ENGINE=MyISAM; INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1); SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid); privatemessageid folderid userid touserid fromuserid title message dateline showsignature iconid messageread readtime receipt deleteprompt multiplerecipients userid usergroupid username password email styleid parentemail coppauser homepage icq aim yahoo signature adminemail showemail invisible usertitle customtitle joindate cookieuser daysprune lastvisit lastactivity lastpost posts timezoneoffset emailnotification buddylist ignorelist pmfolders receivepm emailonpm pmpopup avatarid avatarrevision options birthday maxposts startofweek ipaddress referrerid nosessionhash autorefresh messagepopup inforum ratenum ratetotal allowrate @@ -418,7 +418,7 @@ SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c; a b 1 4 DROP TABLE t1,t2; -CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM AUTO_INCREMENT=3 ; +CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=3 ; INSERT INTO t1 VALUES (1, 'aaaaa'); INSERT INTO t1 VALUES (3, 'aaaaa'); INSERT INTO t1 VALUES (2, 'eeeeeee'); @@ -458,7 +458,7 @@ CREATE TABLE t1 ( html varchar(5) default NULL, rin int(11) default '0', out int(11) default '0' -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('1',1,0); SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin; html prod diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 191331e7a2a..04c36f059e2 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -218,7 +218,7 @@ t2 CREATE TABLE `t2` ( `inhalt` text, KEY `tig` (`ticket`), FULLTEXT KEY `tix` (`inhalt`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t2 where MATCH inhalt AGAINST (NULL); ticket inhalt select * from t2 where MATCH inhalt AGAINST ('foobar'); @@ -251,7 +251,7 @@ id int(11) auto_increment, title varchar(100) default '', PRIMARY KEY (id), KEY ind5 (title) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE FULLTEXT INDEX ft1 ON t1(title); insert into t1 (title) values ('this is a test'); select * from t1 where match title against ('test' in boolean mode); @@ -267,7 +267,7 @@ id title 1 this test once revealed a bug update t1 set title=NULL where id=1; drop table t1; -CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM; +CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) ENGINE=MyISAM; insert into t1 values (1,"I wonder why the fulltext index doesnt work?"); SELECT * from t1 where MATCH (b) AGAINST ('apples'); a b @@ -277,7 +277,7 @@ a b 2 fullaaa fullzzz 1 I wonder why the fulltext index doesnt work? drop table t1; -CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) TYPE=MyISAM; +CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),(4,'MySQL Tutorial'); select 8 from t1; 8 diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result index 687bc6edfa0..0fdb7d4dbd1 100644 --- a/mysql-test/r/fulltext2.result +++ b/mysql-test/r/fulltext2.result @@ -3,7 +3,7 @@ CREATE TABLE t1 ( i int(10) unsigned not null auto_increment primary key, a varchar(255) not null, FULLTEXT KEY (a) -) TYPE=MyISAM; +) ENGINE=MyISAM; repair table t1 quick; Table Op Msg_type Msg_text test.t1 repair status OK @@ -108,7 +108,7 @@ CREATE TABLE t1 ( i int(10) unsigned not null auto_increment primary key, a varchar(255) not null, FULLTEXT KEY (a) -) TYPE=MyISAM; +) ENGINE=MyISAM; select count(*) from t1 where match a against ('aaaxxx'); count(*) 260 diff --git a/mysql-test/r/fulltext_distinct.result b/mysql-test/r/fulltext_distinct.result index abb4929d0ec..de0668ff28c 100644 --- a/mysql-test/r/fulltext_distinct.result +++ b/mysql-test/r/fulltext_distinct.result @@ -7,14 +7,14 @@ PRIMARY KEY (id), KEY kt(tag), KEY kv(value(15)), FULLTEXT KEY kvf(value) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE t2 ( id_t2 mediumint unsigned NOT NULL default '0', id_t1 mediumint unsigned NOT NULL default '0', field_number tinyint unsigned NOT NULL default '0', PRIMARY KEY (id_t2,id_t1,field_number), KEY id_t1(id_t1) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (tag,value) VALUES ('foo123','bar111'); INSERT INTO t1 (tag,value) VALUES ('foo123','bar222'); INSERT INTO t1 (tag,value) VALUES ('bar345','baz333 ar'); diff --git a/mysql-test/r/fulltext_left_join.result b/mysql-test/r/fulltext_left_join.result index d215ea0cea8..bf3fe73690a 100644 --- a/mysql-test/r/fulltext_left_join.result +++ b/mysql-test/r/fulltext_left_join.result @@ -31,9 +31,9 @@ match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) 1 0 drop table t1, t2; -create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) type=myisam; +create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) engine=myisam; insert into t1 (venue_id, venue_text, dt) values (1, 'a1', '2003-05-23 19:30:00'),(null, 'a2', '2003-05-23 19:30:00'); -create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) type=myisam; +create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) engine=myisam; insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3); select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00'; venue_id venue_text dt name entity_id diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 461fc1018c1..1fcda7748b3 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -26,7 +26,7 @@ uncompressed_length(compress(@test_compress_string)) select length(compress(@test_compress_string))",RPAD("",(55 - LENGTH(title)),".")) from t1; diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result index d045d4865dc..a0437ca1c56 100644 --- a/mysql-test/r/func_system.result +++ b/mysql-test/r/func_system.result @@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` ( `database()` char(34) character set utf8 NOT NULL default '', `user()` char(77) character set utf8 NOT NULL default '', `version` char(40) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select TRUE,FALSE,NULL; TRUE FALSE NULL diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 4951d954abb..4bb2e067f9c 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -157,9 +157,9 @@ select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin; ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'like' select _koi8r'a' LIKE _latin1'A'; ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'like' -CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) TYPE=MyISAM; +CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) ENGINE=MyISAM; INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','\r\n\r\n \r\n \r\n \r\n \r\n
 \r\n

How \r\n To: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected.

\r\n
','\r\n \r\n \r\n \r\n \r\n\r\n \r\n
  \r\n \r\n

1. Select \r\n the On/Setup button to access the DynaVox Setup Menu.
\r\n 2. Select Button Features.
\r\n 3. Below the OK button is the Usage Counts button.
\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.
\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.
\r\n c. Select the Usage Counts Option Ring once and it will toggle \r\n to the alternative option.
\r\n 4. Once the correct setting has been chosen, select OK to leave the Button \r\n Features menu.
\r\n 5. Select OK out of the Setup menu and return to the communication \r\n page.

\r\n

For \r\n further information on Usage Counts, see the Button Features \r\n Menu Entry in the DynaVox/DynaMyte Reference Manual.

\r\n
',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL); -CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) TYPE=MyISAM; +CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1); SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank; rank rank rank diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index feaebc9b514..b3c3d8dff5c 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -353,7 +353,7 @@ monthname(date) NULL January drop table t1,t2; -CREATE TABLE t1 (updated text) TYPE=MyISAM; +CREATE TABLE t1 (updated text) ENGINE=MyISAM; INSERT INTO t1 VALUES (''); SELECT month(updated) from t1; month(updated) diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result index ca54ec59938..2a47d0c048d 100644 --- a/mysql-test/r/gis-rtree.result +++ b/mysql-test/r/gis-rtree.result @@ -3,7 +3,7 @@ CREATE TABLE t1 ( fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, g GEOMETRY NOT NULL, SPATIAL KEY(g) -) TYPE=MyISAM; +) ENGINE=MyISAM; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -11,7 +11,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL default '', PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`(32)) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)')); @@ -185,7 +185,7 @@ DROP TABLE t1; CREATE TABLE t2 ( fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, g GEOMETRY NOT NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)))); @@ -294,7 +294,7 @@ t2 CREATE TABLE `t2` ( `g` geometry NOT NULL default '', PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`(32)) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT count(*) FROM t2; count(*) 100 diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index b9eaa81ba2a..853260a0164 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -476,13 +476,13 @@ c2id int(11) unsigned default NULL, value int(11) unsigned NOT NULL default '0', UNIQUE KEY pid2 (pid,c1id,c2id), UNIQUE KEY pid (pid,value) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1, 1, NULL, 1),(1, 2, NULL, 2),(1, NULL, 3, 3),(1, 4, NULL, 4),(1, 5, NULL, 5); CREATE TABLE t2 ( id int(11) unsigned NOT NULL default '0', active enum('Yes','No') NOT NULL default 'Yes', PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (1, 'Yes'),(2, 'No'),(4, 'Yes'),(5, 'No'); CREATE TABLE t3 ( id int(11) unsigned NOT NULL default '0', diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result index 78ccf941b88..d0ea16c5699 100644 --- a/mysql-test/r/handler.result +++ b/mysql-test/r/handler.result @@ -144,7 +144,7 @@ insert into t1 values (17); handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER handler t1 open as t2; -alter table t1 type=MyISAM; +alter table t1 engine=MyISAM; handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER drop table t1; diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index 6c5ef8f3441..c3fbd73ac42 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -1,5 +1,5 @@ drop table if exists t1; -create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; +create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; show keys from t1; @@ -23,15 +23,15 @@ a b 4 6 alter table t1 add c int not null, add key (c,a); drop table t1; -create table t1 (a int not null,b int not null, primary key (a)) type=memory comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key (a)) engine=memory comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a > 0; select * from t1; a b drop table t1; -create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); -alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table"; +alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table"; select * from t1; a b 1 1 @@ -39,7 +39,7 @@ a b 3 3 4 4 drop table t1; -create table t1 (a int not null) type=heap; +create table t1 (a int not null) engine=heap; insert into t1 values (869751),(736494),(226312),(802616); select * from t1 where a > 736494; a @@ -63,13 +63,13 @@ a 736494 802616 869751 -alter table t1 type=myisam; +alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x (x), unique y (y)) -type=heap; +engine=heap; insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6); select * from t1 where x=1; x y @@ -88,13 +88,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL x NULL NULL NULL 6 1 SIMPLE t2 eq_ref y y 4 test.t1.x 1 drop table t1; -create table t1 (a int) type=heap; +create table t1 (a int) engine=heap; insert into t1 values(1); select max(a) from t1; max(a) 1 drop table t1; -CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) TYPE=HEAP; +CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) ENGINE=HEAP; insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6); select * from t1 where a=1; a b @@ -120,7 +120,7 @@ a b 1 2 1 1 drop table t1; -create table t1 (id int unsigned not null, primary key (id)) type=HEAP; +create table t1 (id int unsigned not null, primary key (id)) engine=HEAP; insert into t1 values(1); select max(id) from t1; max(id) @@ -131,12 +131,12 @@ max(id) 2 replace into t1 values(1); drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table if exists t1; CREATE table t1(f1 int not null,f2 char(20) not -null,index(f2)) type=heap; +null,index(f2)) engine=heap; INSERT into t1 set f1=12,f2="bill"; INSERT into t1 set f1=13,f2="bill"; INSERT into t1 set f1=14,f2="bill"; @@ -155,7 +155,7 @@ f1 f2 12 ted 12 ted drop table t1; -create table t1 (btn char(10) not null, key(btn)) type=heap; +create table t1 (btn char(10) not null, key(btn)) engine=heap; insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); explain select * from t1 where btn like "q%"; id select_type table type possible_keys key key_len ref rows Extra @@ -176,7 +176,7 @@ a int default NULL, b int default NULL, KEY a (a), UNIQUE b (b) -) type=heap; +) engine=heap; INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); SELECT * FROM t1 WHERE a=NULL; a b @@ -200,7 +200,7 @@ DROP TABLE t1; CREATE TABLE t1 ( a int default NULL, key a (a) -) TYPE=HEAP; +) ENGINE=HEAP; INSERT INTO t1 VALUES (10), (10), (10); EXPLAIN SELECT * FROM t1 WHERE a=10; id select_type table type possible_keys key key_len ref rows Extra @@ -211,7 +211,7 @@ a 10 10 DROP TABLE t1; -CREATE TABLE t1 (a int not null, primary key(a)) type=heap; +CREATE TABLE t1 (a int not null, primary key(a)) engine=heap; INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11); DELETE from t1 where a < 100; SELECT * from t1; diff --git a/mysql-test/r/heap_auto_increment.result b/mysql-test/r/heap_auto_increment.result index 9a5ed57d741..5b04a77e9eb 100644 --- a/mysql-test/r/heap_auto_increment.result +++ b/mysql-test/r/heap_auto_increment.result @@ -1,5 +1,5 @@ drop table if exists t1; -create table t1 (a int not null auto_increment,b int, primary key (a)) type=heap auto_increment=3; +create table t1 (a int not null auto_increment,b int, primary key (a)) engine=heap auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; insert into t1 values (NULL,5),(NULL,6); @@ -27,7 +27,7 @@ drop table t1; create table t1 ( skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY, sval char(20) -) type=heap; +) engine=heap; insert into t1 values (NULL, "hello"); insert into t1 values (NULL, "hey"); select * from t1; diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result index c42c5e60675..ef63b1d4e00 100644 --- a/mysql-test/r/heap_btree.result +++ b/mysql-test/r/heap_btree.result @@ -1,5 +1,5 @@ drop table if exists t1; -create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; +create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; show keys from t1; @@ -23,15 +23,15 @@ a b 4 6 alter table t1 add c int not null, add key using BTREE (c,a); drop table t1; -create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps"; insert into t1 values(-2,-2),(-1,-1),(0,0),(1,1),(2,2),(3,3),(4,4); delete from t1 where a > -3; select * from t1; a b drop table t1; -create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); -alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table"; +alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table"; select * from t1; a b 1 1 @@ -39,7 +39,7 @@ a b 3 3 4 4 drop table t1; -create table t1 (a int not null) type=heap; +create table t1 (a int not null) engine=heap; insert into t1 values (869751),(736494),(226312),(802616); select * from t1 where a > 736494; a @@ -63,13 +63,13 @@ a 736494 802616 869751 -alter table t1 type=myisam; +alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y)) -type=heap; +engine=heap; insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6); explain select * from t1 where x=1; id select_type table type possible_keys key key_len ref rows Extra @@ -91,13 +91,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL x NULL NULL NULL 6 1 SIMPLE t2 eq_ref y y 4 test.t1.x 1 drop table t1; -create table t1 (a int) type=heap; +create table t1 (a int) engine=heap; insert into t1 values(1); select max(a) from t1; max(a) 1 drop table t1; -CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) TYPE=HEAP; +CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) ENGINE=HEAP; insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6); select * from t1 where a=1; a b @@ -136,7 +136,7 @@ explain select * from tx where b=x; id select_type table type possible_keys key key_len ref rows Extra x SIMPLE tx ref b b x const x Using where drop table t1; -create table t1 (id int unsigned not null, primary key using BTREE (id)) type=HEAP; +create table t1 (id int unsigned not null, primary key using BTREE (id)) engine=HEAP; insert into t1 values(1); select max(id) from t1; max(id) @@ -147,12 +147,12 @@ max(id) 2 replace into t1 values(1); drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table if exists t1; CREATE table t1(f1 int not null,f2 char(20) not -null,index(f2)) type=heap; +null,index(f2)) engine=heap; INSERT into t1 set f1=12,f2="bill"; INSERT into t1 set f1=13,f2="bill"; INSERT into t1 set f1=14,f2="bill"; @@ -171,7 +171,7 @@ f1 f2 12 ted 12 ted drop table t1; -create table t1 (btn char(10) not null, key using BTREE (btn)) type=heap; +create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap; insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); explain select * from t1 where btn like "q%"; id select_type table type possible_keys key key_len ref rows Extra @@ -192,7 +192,7 @@ a int default NULL, b int default NULL, KEY a using BTREE (a), UNIQUE b using BTREE (b) -) type=heap; +) engine=heap; INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); SELECT * FROM t1 WHERE a=NULL; a b @@ -213,7 +213,7 @@ a b INSERT INTO t1 VALUES (1,3); ERROR 23000: Duplicate entry '3' for key 1 DROP TABLE t1; -CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) type=heap; +CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap; INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1); SELECT * FROM t1 WHERE a=1 and b IS NULL; a b c @@ -227,7 +227,7 @@ SELECT * FROM t1 WHERE a=1 and b IS NULL and c IS NULL; a b c 1 NULL NULL DROP TABLE t1; -CREATE TABLE t1 (a int not null, primary key using BTREE (a)) type=heap; +CREATE TABLE t1 (a int not null, primary key using BTREE (a)) engine=heap; INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11); DELETE from t1 where a < 100; SELECT * from t1; diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result index 7ecd1db7447..7affbf788fb 100644 --- a/mysql-test/r/heap_hash.result +++ b/mysql-test/r/heap_hash.result @@ -1,5 +1,5 @@ drop table if exists t1; -create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; +create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; show keys from t1; @@ -23,15 +23,15 @@ a b 4 6 alter table t1 add c int not null, add key using HASH (c,a); drop table t1; -create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a > 0; select * from t1; a b drop table t1; -create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); -alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table"; +alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table"; select * from t1; a b 1 1 @@ -39,7 +39,7 @@ a b 3 3 4 4 drop table t1; -create table t1 (a int not null) type=heap; +create table t1 (a int not null) engine=heap; insert into t1 values (869751),(736494),(226312),(802616); select * from t1 where a > 736494; a @@ -63,13 +63,13 @@ a 736494 802616 869751 -alter table t1 type=myisam; +alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y)) -type=heap; +engine=heap; insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6); select * from t1 where x=1; x y @@ -88,13 +88,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL x NULL NULL NULL 6 1 SIMPLE t2 eq_ref y y 4 test.t1.x 1 drop table t1; -create table t1 (a int) type=heap; +create table t1 (a int) engine=heap; insert into t1 values(1); select max(a) from t1; max(a) 1 drop table t1; -CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) TYPE=HEAP; +CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) ENGINE=HEAP; insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6); select * from t1 where a=1; a b @@ -120,7 +120,7 @@ a b 1 2 1 1 drop table t1; -create table t1 (id int unsigned not null, primary key using HASH (id)) type=HEAP; +create table t1 (id int unsigned not null, primary key using HASH (id)) engine=HEAP; insert into t1 values(1); select max(id) from t1; max(id) @@ -131,12 +131,12 @@ max(id) 2 replace into t1 values(1); drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table if exists t1; CREATE table t1(f1 int not null,f2 char(20) not -null,index(f2)) type=heap; +null,index(f2)) engine=heap; INSERT into t1 set f1=12,f2="bill"; INSERT into t1 set f1=13,f2="bill"; INSERT into t1 set f1=14,f2="bill"; @@ -155,7 +155,7 @@ f1 f2 12 ted 12 ted drop table t1; -create table t1 (btn char(10) not null, key using HASH (btn)) type=heap; +create table t1 (btn char(10) not null, key using HASH (btn)) engine=heap; insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); explain select * from t1 where btn like "q%"; id select_type table type possible_keys key key_len ref rows Extra @@ -176,7 +176,7 @@ a int default NULL, b int default NULL, KEY a using HASH (a), UNIQUE b using HASH (b) -) type=heap; +) engine=heap; INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); SELECT * FROM t1 WHERE a=NULL; a b @@ -197,7 +197,7 @@ a b INSERT INTO t1 VALUES (1,3); ERROR 23000: Duplicate entry '3' for key 1 DROP TABLE t1; -CREATE TABLE t1 (a int not null, primary key using HASH (a)) type=heap; +CREATE TABLE t1 (a int not null, primary key using HASH (a)) engine=heap; INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11); DELETE from t1 where a < 100; SELECT * from t1; diff --git a/mysql-test/r/help.result b/mysql-test/r/help.result index d22539b2bcb..edf7d0e91cb 100644 --- a/mysql-test/r/help.result +++ b/mysql-test/r/help.result @@ -132,10 +132,10 @@ help 'impossible_category_1'; source_category_name name is_it_category impossible_category_1 impossible_function_1 N impossible_category_1 impossible_function_2 N -alter table mysql.help_relation type=innodb; -alter table mysql.help_keyword type=innodb; -alter table mysql.help_topic type=innodb; -alter table mysql.help_category type=innodb; +alter table mysql.help_relation engine=innodb; +alter table mysql.help_keyword engine=innodb; +alter table mysql.help_topic engine=innodb; +alter table mysql.help_category engine=innodb; help 'function_of_my_dream'; name is_it_category help '%possible_f%'; @@ -222,10 +222,10 @@ help 'impossible_category_1'; source_category_name name is_it_category impossible_category_1 impossible_function_1 N impossible_category_1 impossible_function_2 N -alter table mysql.help_relation type=myisam; -alter table mysql.help_keyword type=myisam; -alter table mysql.help_topic type=myisam; -alter table mysql.help_category type=myisam; +alter table mysql.help_relation engine=myisam; +alter table mysql.help_keyword engine=myisam; +alter table mysql.help_topic engine=myisam; +alter table mysql.help_category engine=myisam; delete from mysql.help_topic where help_topic_id=@topic1_id; delete from mysql.help_topic where help_topic_id=@topic2_id; delete from mysql.help_topic where help_topic_id=@topic3_id; diff --git a/mysql-test/r/innodb-deadlock.result b/mysql-test/r/innodb-deadlock.result index e1b3e38b243..2ca82101fb4 100644 --- a/mysql-test/r/innodb-deadlock.result +++ b/mysql-test/r/innodb-deadlock.result @@ -1,5 +1,5 @@ drop table if exists t1,t2; -create table t1 (id integer, x integer) type=INNODB; +create table t1 (id integer, x integer) engine=INNODB; insert into t1 values(0, 0); set autocommit=0; SELECT * from t1 where id = 0 FOR UPDATE; @@ -18,8 +18,8 @@ id x 0 2 commit; drop table t1; -create table t1 (id integer, x integer) type=INNODB; -create table t2 (b integer, a integer) type=INNODB; +create table t1 (id integer, x integer) engine=INNODB; +create table t2 (b integer, a integer) engine=INNODB; insert into t1 values(0, 0), (300, 300); insert into t2 values(0, 10), (1, 20), (2, 30); commit; @@ -54,8 +54,8 @@ id x 300 300 commit; drop table t1, t2; -create table t1 (id integer, x integer) type=INNODB; -create table t2 (b integer, a integer) type=INNODB; +create table t1 (id integer, x integer) engine=INNODB; +create table t2 (b integer, a integer) engine=INNODB; insert into t1 values(0, 0), (300, 300); insert into t2 values(0, 0), (1, 20), (2, 30); commit; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 0ebf3d50ab8..58c0042e122 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1,6 +1,6 @@ drop table if exists t1,t2,t3,t4; drop database if exists mysqltest; -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb; +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); select id, code, name from t1 order by id; id code name @@ -39,7 +39,7 @@ level tinyint(4) DEFAULT '0' NOT NULL, PRIMARY KEY (id), KEY parent_id (parent_id), KEY level (level) -) type=innodb; +) engine=innodb; INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); update t1 set parent_id=parent_id+100; select * from t1 where parent_id=102; @@ -177,7 +177,7 @@ CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (gesuchnr,benutzer_id) -) type=innodb; +) engine=innodb; replace into t1 (gesuchnr,benutzer_id) values (2,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); @@ -186,7 +186,7 @@ gesuchnr benutzer_id 1 1 2 1 drop table t1; -create table t1 (a int) type=innodb; +create table t1 (a int) engine=innodb; insert into t1 values (1), (2); optimize table t1; Table Op Msg_type Msg_text @@ -199,7 +199,7 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; -create table t1 (a int,b varchar(20)) type=innodb; +create table t1 (a int,b varchar(20)) engine=innodb; insert into t1 values (1,""), (2,"testing"); delete from t1 where a = 1; select * from t1; @@ -214,13 +214,13 @@ show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 skr 1 a A # NULL NULL YES BTREE drop table t1; -create table t1 (a int,b varchar(20),key(a)) type=innodb; +create table t1 (a int,b varchar(20),key(a)) engine=innodb; insert into t1 values (1,""), (2,"testing"); select * from t1 where a = 1; a b 1 drop table t1; -create table t1 (n int not null primary key) type=innodb; +create table t1 (n int not null primary key) engine=innodb; set autocommit=0; insert into t1 values (4); rollback; @@ -251,7 +251,7 @@ n 6 rollback; drop table t1; -create table t1 (n int not null primary key) type=innodb; +create table t1 (n int not null primary key) engine=innodb; start transaction; insert into t1 values (4); flush tables with read lock; @@ -262,7 +262,7 @@ select * from t1; n 4 drop table t1; -create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=innodb; +create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb; begin; insert into t1 values(1,'hamdouni'); select id as afterbegin_id,nom as afterbegin_nom from t1; @@ -281,7 +281,7 @@ select id as afterrollback_id,nom as afterrollback_nom from t1; afterrollback_id afterrollback_nom set autocommit=1; drop table t1; -CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=innodb; +CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb; insert into t1 values ('pippo', 12); insert into t1 values ('pippo', 12); ERROR 23000: Duplicate entry 'pippo' for key 1 @@ -301,23 +301,23 @@ commit; select * from t1; id val drop table t1; -create table t1 (a integer) type=innodb; +create table t1 (a integer) engine=innodb; start transaction; rename table t1 to t2; -create table t1 (b integer) type=innodb; +create table t1 (b integer) engine=innodb; insert into t1 values (1); rollback; drop table t1; rename table t2 to t1; drop table t1; set autocommit=1; -CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=innodb; +CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb; INSERT INTO t1 VALUES (1, 'Jochen'); select * from t1; ID NAME 1 Jochen drop table t1; -CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=innodb; +CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb; set autocommit=0; INSERT INTO t1 SET _userid='marc@anyware.co.uk'; COMMIT; @@ -336,7 +336,7 @@ phone varchar(100), ref_email varchar(100) DEFAULT '' NOT NULL, detail varchar(200), PRIMARY KEY (user_id,ref_email) -)type=innodb; +)engine=innodb; INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); select * from t1 where user_id=10292; user_id name phone ref_email detail @@ -374,7 +374,7 @@ t1 1 a 1 a A # NULL NULL BTREE t1 1 a_2 1 a A # NULL NULL BTREE drop table t1; create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); -alter table t1 type=innodb; +alter table t1 engine=innodb; insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); select * from t1; col1 col2 @@ -408,8 +408,8 @@ col1 col2 co3 4 7 0 5 2 0 drop table t1; -create table t1 (a int not null , b int, primary key (a)) type = innodb; -create table t2 (a int not null , b int, primary key (a)) type = myisam; +create table t1 (a int not null , b int, primary key (a)) engine = innodb; +create table t2 (a int not null , b int, primary key (a)) engine = myisam; insert into t1 VALUES (1,3) , (2,3), (3,3); select * from t1; a b @@ -444,7 +444,7 @@ email varchar(64) DEFAULT '' NOT NULL, passwd varchar(32) binary DEFAULT '' NOT NULL, PRIMARY KEY (id), UNIQUE ggid (ggid) -) TYPE=innodb; +) ENGINE=innodb; insert into t1 (ggid,passwd) values ('test1','xxx'); insert into t1 (ggid,passwd) values ('test2','yyy'); insert into t1 (ggid,passwd) values ('test2','this will fail'); @@ -486,7 +486,7 @@ access_time time, approved datetime, dummy_primary_key int(11) NOT NULL auto_increment, PRIMARY KEY (dummy_primary_key) -) TYPE=innodb; +) ENGINE=innodb; INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); @@ -507,7 +507,7 @@ level tinyint(4) DEFAULT '0' NOT NULL, KEY (id), KEY parent_id (parent_id), KEY level (level) -) type=innodb; +) engine=innodb; INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); INSERT INTO t1 values (179,5,2); update t1 set parent_id=parent_id+100; @@ -681,7 +681,7 @@ sca_sdesc varchar(50), sca_sch_desc varchar(16), PRIMARY KEY (sca_code, cat_code, lan_code), INDEX sca_pic (sca_pic) -) type = innodb ; +) engine = innodb ; INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); select count(*) from t1 where sca_code = 'PD'; count(*) @@ -714,7 +714,7 @@ update t1 set sca_pic="test" where sca_pic is null; delete from t1 where sca_code='pd'; drop table t1; set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=innodb; +CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb; insert into t1 (a) values(1),(2),(3); select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; a @@ -728,7 +728,7 @@ a 3 5 drop table t1; -create table t1 (a varchar(100) not null, primary key(a), b int not null) type=innodb; +create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb; insert into t1 values("hello",1),("world",2); select * from t1 order by b desc; a b @@ -741,7 +741,7 @@ show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A # NULL NULL BTREE drop table t1; -create table t1 (i int, j int ) TYPE=innodb; +create table t1 (i int, j int ) ENGINE=innodb; insert into t1 values (1,2); select * from t1 where i=1 and j=2; i j @@ -755,25 +755,25 @@ CREATE TABLE t1 ( a int3 unsigned NOT NULL, b int1 unsigned NOT NULL, UNIQUE (a, b) -) TYPE = innodb; +) ENGINE = innodb; INSERT INTO t1 VALUES (1, 1); SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; MIN(B) MAX(b) 1 1 drop table t1; -CREATE TABLE t1 (a int unsigned NOT NULL) type=innodb; +CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb; INSERT INTO t1 VALUES (1); SELECT * FROM t1; a 1 DROP TABLE t1; -create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb; +create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb; insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); explain select * from t1 where a > 0 and a < 50; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where drop table t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; insert into t1 values (99,1,2,'D'),(1,1,2,'D'); @@ -790,7 +790,7 @@ id 2 UNLOCK TABLES; DROP TABLE t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; begin; @@ -811,17 +811,17 @@ id id3 100 2 UNLOCK TABLES; DROP TABLE t1; -create table t1 (a char(20), unique (a(5))) type=innodb; +create table t1 (a char(20), unique (a(5))) engine=innodb; drop table t1; -create table t1 (a char(20), index (a(5))) type=innodb; +create table t1 (a char(20), index (a(5))) engine=innodb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(20) default NULL, KEY `a` (`a`(5)) -) TYPE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; -create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb; +create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb; insert into t1 values (NULL),(NULL),(NULL); delete from t1 where a=3; insert into t1 values (NULL); @@ -844,7 +844,7 @@ name varchar(32) not null, value text not null, uid int not null, unique key(name,uid) -) type=innodb; +) engine=innodb; insert into t1 values (1,'one','one value',101), (2,'two','two value',102),(3,'three','three value',103); set insert_id=5; @@ -861,18 +861,18 @@ id name value uid 6 two other value 102 drop table t1; create database mysqltest; -create table mysqltest.t1 (a int not null) type= innodb; +create table mysqltest.t1 (a int not null) engine= innodb; insert into mysqltest.t1 values(1); -create table mysqltest.t2 (a int not null) type= myisam; +create table mysqltest.t2 (a int not null) engine= myisam; insert into mysqltest.t2 values(1); -create table mysqltest.t3 (a int not null) type= heap; +create table mysqltest.t3 (a int not null) engine= heap; insert into mysqltest.t3 values(1); commit; drop database mysqltest; show tables from mysqltest; Got one of the listed errors set autocommit=0; -create table t1 (a int not null) type= innodb; +create table t1 (a int not null) engine= innodb; insert into t1 values(1),(2); truncate table t1; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction @@ -887,7 +887,7 @@ a commit; drop table t1; set autocommit=1; -create table t1 (a int not null) type= innodb; +create table t1 (a int not null) engine= innodb; insert into t1 values(1),(2); truncate table t1; insert into t1 values(1),(2); @@ -901,7 +901,7 @@ delete from t1; select * from t1; a drop table t1; -create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb; +create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb; insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); explain select * from t1 order by a; id select_type table type possible_keys key key_len ref rows Extra @@ -928,7 +928,7 @@ explain select a,b,c from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL # drop table t1; -create table t1 (t int not null default 1, key (t)) type=innodb; +create table t1 (t int not null default 1, key (t)) engine=innodb; desc t1; Field Type Null Key Default Extra t int(11) MUL 1 @@ -945,7 +945,7 @@ last_app_id smallint(6) default '-1', version smallint(6) NOT NULL default '0', assigned_scps int(11) default '0', status tinyint(4) default '0' -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1); INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0); INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1); @@ -964,7 +964,7 @@ last_app_id smallint(6) default '-1', version smallint(6) NOT NULL default '0', assigned_scps int(11) default '0', status tinyint(4) default '0' -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1); INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0); INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1); @@ -995,7 +995,7 @@ select * from t2; number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status 333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 drop table t1,t2; -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb; +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; BEGIN; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SELECT @@tx_isolation,@@global.tx_isolation; @@ -1033,8 +1033,8 @@ id code name 7 4 Matt COMMIT; DROP TABLE t1; -create table t1 (n int(10), d int(10)) type=innodb; -create table t2 (n int(10), d int(10)) type=innodb; +create table t1 (n int(10), d int(10)) engine=innodb; +create table t2 (n int(10), d int(10)) engine=innodb; insert into t1 values(1,1),(1,2); insert into t2 values(1,10),(2,20); UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; @@ -1047,7 +1047,7 @@ n d 1 30 2 20 drop table t1,t2; -create table t1 (a int, b int) type=innodb; +create table t1 (a int, b int) engine=innodb; insert into t1 values(20,null); select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on t2.b=t3.a; @@ -1064,19 +1064,19 @@ b ifnull(t2.b,"this is null") NULL this is null NULL this is null drop table t1; -create table t1 (a varchar(10) not null) type=myisam; -create table t2 (b varchar(10) not null unique) type=innodb; +create table t1 (a varchar(10) not null) engine=myisam; +create table t2 (b varchar(10) not null unique) engine=innodb; select t1.a from t1,t2 where t1.a=t2.b; a drop table t1,t2; -create table t1 (a int not null, b int, primary key (a)) type = innodb; -create table t2 (a int not null, b int, primary key (a)) type = innodb; +create table t1 (a int not null, b int, primary key (a)) engine = innodb; +create table t2 (a int not null, b int, primary key (a)) engine = innodb; insert into t1 values (10, 20); insert into t2 values (10, 20); update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10; drop table t1,t2; -CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB; -CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) TYPE=INNODB; +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB; insert into t1 set id=1; insert into t2 set id=1, t1_id=1; delete t1,t2 from t1,t2 where t1.id=t2.t1_id; @@ -1089,8 +1089,8 @@ DROP TABLE IF EXISTS t1,t2; Warnings: Note 1051 Unknown table 't1' Note 1051 Unknown table 't2' -CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB; -CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) TYPE=INNODB; +CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB; INSERT INTO t1 VALUES(1); INSERT INTO t2 VALUES(1, 1); SELECT * from t1; @@ -1106,9 +1106,9 @@ id 3 DROP TABLE t1,t2; set autocommit=0; -CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB; -CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB; -CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) TYPE=InnoDB; +CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; +CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; +CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB; INSERT INTO t3 VALUES("my-test-1", "my-test-2"); COMMIT; INSERT INTO t1 VALUES("this-key", "will disappear"); @@ -1136,7 +1136,7 @@ my-test-1 my-test-2 COMMIT; set autocommit=1; DROP TABLE t1,t2,t3; -CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) type=innodb; +CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb; INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; SELECT * from t1; @@ -1151,8 +1151,8 @@ a b 8 8 9 9 drop table t1; -CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) type=innodb; -CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) type=innodb; +CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; +CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); update t1,t2 set t1.a=t1.a+100; @@ -1227,8 +1227,8 @@ a b 4 14 5 15 drop table t1,t2; -CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) TYPE=MyISAM; -CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) TYPE=InnoDB; +CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=0; INSERT INTO t1 ( B_ID ) VALUES ( 1 ); INSERT INTO t2 ( NEXT_T ) VALUES ( 1 ); @@ -1238,7 +1238,7 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back SELECT * FROM t1; B_ID drop table t1,t2; -create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) type = innodb; +create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb; insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2); select distinct parent,child from t1 order by parent; parent child @@ -1247,7 +1247,7 @@ parent child 1 3 2 1 drop table t1; -create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) type=innodb; +create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb; create table t2 (a int not null auto_increment primary key, b int); insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null); insert into t2 (a) select b from t1; @@ -1279,7 +1279,7 @@ explain select * from t1 where c between 1 and 10000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL c NULL NULL NULL # Using where drop table t1,t2; -create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) type=innodb; +create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; insert into t1 (id) values (null),(null),(null),(null),(null); update t1 set fk=69 where fk is null order by id limit 1; SELECT * from t1; @@ -1312,9 +1312,9 @@ a b 111 100 111 100 drop table t1; -CREATE TABLE t1 (col1 int(1))TYPE=InnoDB; +CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB; CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx -(stamp))TYPE=InnoDB; +(stamp))ENGINE=InnoDB; insert into t1 values (1),(2),(3); insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ); SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp < @@ -1333,14 +1333,14 @@ label varchar(100) NOT NULL default '', PRIMARY KEY (`id`), KEY `id_object` (`id_object`), KEY `id_version` (`id_version`) -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL); CREATE TABLE t2 ( `id` int(10) unsigned NOT NULL auto_increment, `id_version` int(10) unsigned NOT NULL default '1', PRIMARY KEY (`id`), KEY `id_version` (`id_version`) -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9"); SELECT t2.id, t1.label FROM t2 INNER JOIN (SELECT t1.id_object as id_object FROM t1 WHERE t1.label LIKE '%test%') AS lbl @@ -1353,7 +1353,7 @@ id label 3524 Societe Test 3525 Fournisseur Test drop table t1,t2; -create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) type=innodb; +create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb; select * from t1; c1 c2 stamp replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12"); @@ -1365,9 +1365,9 @@ ERROR HY000: Table storage engine for 't1' doesn't have this option select * from t1; c1 c2 stamp drop table t1; -create table t1 (a int, b varchar(200), c text not null) checksum=1 type=myisam; -create table t2 (a int, b varchar(200), c text not null) checksum=0 type=innodb; -create table t3 (a int, b varchar(200), c text not null) checksum=1 type=innodb; +create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam; +create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb; +create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb; insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); insert t2 select * from t1; insert t3 select * from t1; diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/innodb_cache.result index 7706e60d143..5c5e0bb6dfe 100644 --- a/mysql-test/r/innodb_cache.result +++ b/mysql-test/r/innodb_cache.result @@ -1,7 +1,7 @@ drop table if exists t1,t2,t3; flush status; set autocommit=0; -create table t1 (a int not null) type=innodb; +create table t1 (a int not null) engine=innodb; insert into t1 values (1),(2),(3); select * from t1; a @@ -15,7 +15,7 @@ drop table t1; commit; set autocommit=1; begin; -create table t1 (a int not null) type=innodb; +create table t1 (a int not null) engine=innodb; insert into t1 values (1),(2),(3); select * from t1; a @@ -27,9 +27,9 @@ Variable_name Value Qcache_queries_in_cache 0 drop table t1; commit; -create table t1 (a int not null) type=innodb; -create table t2 (a int not null) type=innodb; -create table t3 (a int not null) type=innodb; +create table t1 (a int not null) engine=innodb; +create table t2 (a int not null) engine=innodb; +create table t3 (a int not null) engine=innodb; insert into t1 values (1),(2); insert into t2 values (1),(2); insert into t3 values (1),(2); @@ -99,7 +99,7 @@ show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 drop table if exists t1; -CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB; +CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB; select count(*) from t1; count(*) 0 diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result index 1fadc3a61de..a608e5c71ab 100644 --- a/mysql-test/r/innodb_handler.result +++ b/mysql-test/r/innodb_handler.result @@ -1,5 +1,5 @@ drop table if exists t1,t2; -create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb; +create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb; insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), (14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"), @@ -136,11 +136,11 @@ handler t1 open as t2; handler t2 read first; a b 17 ddd -alter table t1 type=innodb; +alter table t1 engine=innodb; handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER drop table t1; -CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) TYPE=InnoDB; +CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2); HANDLER t1 OPEN; HANDLER t1 READ `primary` = (1, 1000); diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 8eecccf6fec..a77d67b5f64 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -35,7 +35,7 @@ PRIMARY KEY (`numeropost`,`numreponse`) KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE `t2` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', @@ -50,7 +50,7 @@ KEY `ip` (`ip`), KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES (9,1,56,'test','joce','2001-07-25 13:50:53' diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result index 80d78bc72da..4c698075150 100644 --- a/mysql-test/r/isam.result +++ b/mysql-test/r/isam.result @@ -1,11 +1,11 @@ drop table if exists t1,t2; -create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) type=isam; +create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) engine=isam; delete from t1 where (a & 1); select sum(length(b)) from t1; sum(length(b)) 3274494 drop table t1; -create table t1 (a int not null auto_increment,b int, primary key (a)) type=isam; +create table t1 (a int not null auto_increment,b int, primary key (a)) engine=isam; insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4); delete from t1 where a=4 or a=2; insert into t1 values (NULL,4),(NULL,5),(6,6); @@ -29,20 +29,20 @@ a b c 4 4 NULL 6 6 6 drop table t1; -create table t1 (a int,b text, index(a)) type=isam; +create table t1 (a int,b text, index(a)) engine=isam; ERROR 42000: Column 'a' is used with UNIQUE or INDEX but is not defined as NOT NULL -create table t1 (a int,b text, index(b)) type=isam; +create table t1 (a int,b text, index(b)) engine=isam; ERROR 42000: BLOB column 'b' can't be used in key specification with the used table type -create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam; +create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=isam; ERROR 42000: Incorrect table definition; There can only be one auto column and it must be defined as a key -create table t1 (ordid int(8), unique (ordid)) type=isam; +create table t1 (ordid int(8), unique (ordid)) engine=isam; ERROR 42000: Column 'ordid' is used with UNIQUE or INDEX but is not defined as NOT NULL drop table if exists t1; Warnings: Note 1051 Unknown table 't1' create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); -create table t2 type=isam select * from t1; +create table t2 engine=isam select * from t1; optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 24b272a1985..7dbc09f9cc0 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -132,11 +132,11 @@ CREATE TABLE t1 ( a int(11) NOT NULL, b int(11) NOT NULL, PRIMARY KEY (a,b) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3); CREATE TABLE t2 ( a int(11) default NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (2),(3); SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AND b<=3; a a b @@ -236,13 +236,13 @@ min_value double default NULL, max_value double default NULL, t3_id int(11) default NULL, item_id int(11) default NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (12,5,'Percent','Cost',-1,0,-1,-1),(14,4,'Percent','Cost',-1,0,-1,-1),(18,5,'Percent','Cost',-1,0,-1,-1),(19,4,'Percent','Cost',-1,0,-1,-1),(20,5,'Percent','Cost',100,-1,22,291),(21,5,'Percent','Cost',100,-1,18,291),(22,1,'Percent','Cost',100,-1,6,291),(23,1,'Percent','Cost',100,-1,21,291),(24,1,'Percent','Cost',100,-1,9,291),(25,1,'Percent','Cost',100,-1,4,291),(26,1,'Percent','Cost',100,-1,20,291),(27,4,'Percent','Cost',100,-1,7,202),(28,1,'Percent','Cost',50,-1,-1,137),(29,2,'Percent','Cost',100,-1,4,354),(30,2,'Percent','Cost',100,-1,9,137),(93,2,'Cost','Cost',-1,10000000,-1,-1); CREATE TABLE t2 ( id int(10) unsigned NOT NULL auto_increment, name varchar(255) default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5'); select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2; t1_id t2_id type cost_unit min_value max_value t3_id item_id id name @@ -255,7 +255,7 @@ emp_id varchar(30) NOT NULL default '', rate_code varchar(10) default NULL, UNIQUE KEY site_emp (siteid,emp_id), KEY siteid (siteid) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust'); CREATE TABLE t2 ( siteid varchar(25) NOT NULL default '', @@ -263,7 +263,7 @@ rate_code varchar(10) NOT NULL default '', base_rate float NOT NULL default '0', PRIMARY KEY (siteid,rate_code), FULLTEXT KEY rate_code (rate_code) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES ('rivercats','cust',20); SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats'; rate_code base_rate diff --git a/mysql-test/r/join_crash.result b/mysql-test/r/join_crash.result index c7bca9f7497..c1671ea7e20 100644 --- a/mysql-test/r/join_crash.result +++ b/mysql-test/r/join_crash.result @@ -10,7 +10,7 @@ billing_contact_ptr int(11) default NULL, comments mediumtext, PRIMARY KEY (project_id), UNIQUE KEY project (client_ptr,project_name) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; INSERT INTO t1 VALUES (1,0,'Rejected Time',1,NULL,NULL,NULL,NULL); INSERT INTO t1 VALUES (209,0,'MDGRAD Proposal/Investigation',97,NULL,NULL,NULL,''); INSERT INTO t1 VALUES (208,0,'Font 9 Design',84,NULL,NULL,NULL,''); @@ -31,7 +31,7 @@ work_load int(11) default NULL, PRIMARY KEY (period_id), KEY period_index (period_type,period_key), KEY date_index (start_date,end_date) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; INSERT INTO t2 VALUES (1,'user_table',98,'2000-01-01 00:00:00',NULL,NULL); INSERT INTO t2 VALUES (2,'user_table',99,'2000-01-01 00:00:00',NULL,NULL); INSERT INTO t2 VALUES (3,'user_table',100,'2000-01-01 00:00:00',NULL,NULL); @@ -57,7 +57,7 @@ amount_received float(10,2) default NULL, adjustment float(10,2) default NULL, PRIMARY KEY (budget_id), UNIQUE KEY po (project_ptr,po_number) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; CREATE TABLE t4 ( client_id int(11) NOT NULL auto_increment, client_row_lock int(11) NOT NULL default '0', @@ -66,7 +66,7 @@ contact_ptr int(11) default NULL, comments mediumtext, PRIMARY KEY (client_id), UNIQUE KEY client_name (client_name) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; INSERT INTO t4 VALUES (1,0,'CPS',NULL,NULL); select distinct t1.project_id as project_id, diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 165f1522378..76c1b06b638 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -3,7 +3,7 @@ CREATE TABLE t1 ( grp int(11) default NULL, a bigint(20) unsigned default NULL, c char(10) NOT NULL default '' -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,''); create table t2 (id int, a bigint unsigned not null, c char(10), d int, primary key (a)); insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7); diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index 89deab4bb1f..d8e10fd20c7 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -130,7 +130,7 @@ CREATE TABLE t1 ( a tinytext NOT NULL, b tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (a(32),b) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('a',1),('a',2); SELECT * FROM t1 WHERE a='a' AND b=2; a b diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result index 68feb9c44d7..2cb9527b94b 100644 --- a/mysql-test/r/lock.result +++ b/mysql-test/r/lock.result @@ -1,5 +1,5 @@ drop table if exists t1,t2; -CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) TYPE=MyISAM; +CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) ENGINE=MyISAM; insert into t1 (id,id2) values (1,1),(1,2),(1,3); LOCK TABLE t1 WRITE; select dummy1,count(distinct id) from t1 group by dummy1; @@ -23,11 +23,11 @@ CREATE TABLE t1 ( index1 smallint(6) default NULL, nr smallint(6) default NULL, KEY index1(index1) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE t2 ( nr smallint(6) default NULL, name varchar(20) default NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'item1'); INSERT INTO t2 VALUES (2,'item2'); lock tables t1 write, t2 read; diff --git a/mysql-test/r/lock_tables_lost_commit.result b/mysql-test/r/lock_tables_lost_commit.result index ccf56793f45..22885d93d40 100644 --- a/mysql-test/r/lock_tables_lost_commit.result +++ b/mysql-test/r/lock_tables_lost_commit.result @@ -1,5 +1,5 @@ drop table if exists t1; -create table t1(a int) type=innodb; +create table t1(a int) engine=innodb; lock tables t1 write; insert into t1 values(10); select * from t1; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 01635313590..63e0a228aa5 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -4,7 +4,7 @@ create table t1 (a int not null primary key auto_increment, message char(20)); create table t2 (a int not null primary key auto_increment, message char(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2"); -create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(t1,t2); +create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(t1,t2); select * from t3; a b 1 Testing @@ -33,7 +33,7 @@ insert into t2 select NULL,message from t1; insert into t1 select NULL,message from t2; insert into t2 select NULL,message from t1; insert into t1 select NULL,message from t2; -create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2); +create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,test.t2); explain select * from t3 where a < 10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 range a a 4 NULL 18 Using where @@ -175,29 +175,29 @@ t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL default '0', `b` char(20) default NULL, KEY `a` (`a`) -) TYPE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) -create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2); +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) +create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2); select * from t4; ERROR HY000: Can't open file: 't4.MRG' (errno: 143) alter table t4 add column c int; ERROR HY000: Can't open file: 't4.MRG' (errno: 143) create database mysqltest; create table mysqltest.t6 (a int not null primary key auto_increment, message char(20)); -create table t5 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,mysqltest.t6); +create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6); show create table t5; Table Create Table t5 CREATE TABLE `t5` ( `a` int(11) NOT NULL default '0', `b` char(20) default NULL, KEY `a` (`a`) -) TYPE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`) -alter table t5 type=myisam; +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`) +alter table t5 engine=myisam; drop table t5, mysqltest.t6; drop database mysqltest; drop table t4,t3,t1,t2; -create table t1 (c char(10)) type=myisam; -create table t2 (c char(10)) type=myisam; -create table t3 (c char(10)) union=(t1,t2) type=merge; +create table t1 (c char(10)) engine=myisam; +create table t2 (c char(10)) engine=myisam; +create table t3 (c char(10)) union=(t1,t2) engine=merge; insert into t1 (c) values ('test1'); insert into t1 (c) values ('test1'); insert into t1 (c) values ('test1'); @@ -229,7 +229,7 @@ drop table t3,t2,t1; CREATE TABLE t1 (incr int not null, othr int not null, primary key(incr)); CREATE TABLE t2 (incr int not null, othr int not null, primary key(incr)); CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr)) -TYPE=MERGE UNION=(t1,t2); +ENGINE=MERGE UNION=(t1,t2); SELECT * from t3; incr othr INSERT INTO t1 VALUES ( 1,10),( 3,53),( 5,21),( 7,12),( 9,17); @@ -250,35 +250,35 @@ alter table t3 UNION=(t1,t2); select count(*) from t3; count(*) 20 -alter table t3 TYPE=MYISAM; +alter table t3 ENGINE=MYISAM; select count(*) from t3; count(*) 20 drop table t3; CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr)) -TYPE=MERGE UNION=(t1,t2); +ENGINE=MERGE UNION=(t1,t2); show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `incr` int(11) NOT NULL default '0', `othr` int(11) NOT NULL default '0', PRIMARY KEY (`incr`) -) TYPE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) alter table t3 drop primary key; show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `incr` int(11) NOT NULL default '0', `othr` int(11) NOT NULL default '0' -) TYPE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) drop table t3,t2,t1; -create table t1 (a int not null, key(a)) type=merge; +create table t1 (a int not null, key(a)) engine=merge; select * from t1; a drop table t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); -create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2); +create table t3 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2); insert into t1 values (1,2),(2,1),(0,0),(4,4),(5,5),(6,6); insert into t2 values (1,1),(2,2),(0,0),(4,4),(5,5),(6,6); flush tables; @@ -290,37 +290,37 @@ drop table t3,t1,t2; create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO; -create table t4 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=NO; -create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; -create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; +create table t4 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=NO; +create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; +create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', KEY `a` (`a`,`b`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create table t4; Table Create Table t4 CREATE TABLE `t4` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', KEY `a` (`a`,`b`) -) TYPE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) show create table t5; Table Create Table t5 CREATE TABLE `t5` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL auto_increment, PRIMARY KEY (`a`,`b`) -) TYPE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`) show create table t6; Table Create Table t6 CREATE TABLE `t6` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL auto_increment, PRIMARY KEY (`a`,`b`) -) TYPE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL); insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL); select * from t3 order by b,a limit 3; @@ -385,7 +385,7 @@ t4 CREATE TABLE `t4` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', KEY `a` (`a`,`b`) -) TYPE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`,`t3`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`,`t3`) select * from t4 order by a,b; a b 1 1 @@ -411,7 +411,7 @@ t4 CREATE TABLE `t4` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', KEY `a` (`a`,`b`) -) TYPE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`) insert into t4 values (4,1),(4,2); select * from t1 order by a,b; a b @@ -545,11 +545,11 @@ select * from t4 where a+0 > 90; a b 99 1 drop table t6, t5, t4, t3, t2, t1; -CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; +CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1), (2,1); -CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; +CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,2), (2,2); -CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); +CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) ENGINE=MRG_MyISAM UNION=(t1,t2); select max(b) from t3 where a = 2; max(b) 2 @@ -561,7 +561,7 @@ create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); insert into t2 values (2); -create temporary table t3 (a int not null) TYPE=MERGE UNION=(t1,t2); +create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2); select * from t3; a 1 @@ -570,7 +570,7 @@ create temporary table t4 (a int not null); create temporary table t5 (a int not null); insert into t4 values (1); insert into t5 values (2); -create temporary table t6 (a int not null) TYPE=MERGE UNION=(t4,t5); +create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5); select * from t6; a 1 @@ -582,7 +582,7 @@ file_code varchar(32) NOT NULL default '', fileset_root_id tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (fileset_id,file_code), KEY files (fileset_id,fileset_root_id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (2, '0000000111', 1), (2, '0000000112', 1), (2, '0000000113', 1), (2, '0000000114', 1), (2, '0000000115', 1), (2, '0000000116', 1), (2, '0000000117', 1), (2, '0000000118', 1), (2, '0000000119', 1), (2, '0000000120', 1); @@ -592,7 +592,7 @@ file_code varchar(32) NOT NULL default '', fileset_root_id tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (fileset_id,file_code), KEY files (fileset_id,fileset_root_id) -) TYPE=MRG_MyISAM UNION=(t1); +) ENGINE=MRG_MyISAM UNION=(t1); EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra @@ -612,7 +612,7 @@ id select_type table type possible_keys key key_len ref rows Extra DROP TABLE t2, t1; create table t1 (x int, y int, index xy(x, y)); create table t2 (x int, y int, index xy(x, y)); -create table t3 (x int, y int, index xy(x, y)) type=merge union=(t1,t2); +create table t3 (x int, y int, index xy(x, y)) engine=merge union=(t1,t2); insert into t1 values(1, 2); insert into t2 values(1, 3); select * from t3 where x = 1 and y < 5 order by y; diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index d6da3604fd2..54d99d5609e 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -1,6 +1,6 @@ drop table if exists t1, t2; -create table t1 (a int) type=innodb; -create table t2 (a int) type=myisam; +create table t1 (a int) engine=innodb; +create table t2 (a int) engine=myisam; reset master; begin; insert into t1 values(1); @@ -121,7 +121,7 @@ master-bin.000001 139 Query 1 139 use `test`; insert into t2 select * from t1 master-bin.000001 205 Query 1 205 use `test`; BEGIN master-bin.000001 245 Query 1 205 use `test`; insert into t1 values(11) master-bin.000001 305 Query 1 305 use `test`; COMMIT -alter table t2 type=INNODB; +alter table t2 engine=INNODB; delete from t1; delete from t2; reset master; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index b0d597f238a..38d60cd21d5 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -74,19 +74,19 @@ CREATE TABLE t1 ( id int(11) NOT NULL default '0', name varchar(10) default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'aaa'),(2,'aaa'),(3,'aaa'); CREATE TABLE t2 ( id int(11) NOT NULL default '0', name varchar(10) default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (2,'bbb'),(3,'bbb'),(4,'bbb'); CREATE TABLE t3 ( id int(11) NOT NULL default '0', mydate datetime default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t3 VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'2002-05-12 00:00:00'),(6,'2002-06-22 00:00:00'),(7,'2002-07-22 00:00:00'); delete t1,t2,t3 from t1,t2,t3 where to_days(now())-to_days(t3.mydate)>=30 and t3.id=t1.id and t3.id=t2.id; @@ -102,7 +102,7 @@ CREATE TABLE IF NOT EXISTS `t1` ( `tst` text, `tst1` text, PRIMARY KEY (`id`) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE IF NOT EXISTS `t2` ( `ID` int(11) NOT NULL auto_increment, `ParId` int(11) default NULL, @@ -111,7 +111,7 @@ CREATE TABLE IF NOT EXISTS `t2` ( PRIMARY KEY (`ID`), KEY `IX_ParId_t2` (`ParId`), FOREIGN KEY (`ParId`) REFERENCES `t1` (`id`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1(tst,tst1) VALUES("MySQL","MySQL AB"), ("MSSQL","Microsoft"), ("ORACLE","ORACLE"); INSERT INTO t2(ParId) VALUES(1), (2), (3); select * from t2; @@ -251,11 +251,11 @@ n d select * from t2; n d drop table t1,t2; -CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); -CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'); -CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM; INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; @@ -324,7 +324,7 @@ a b 8 8 9 9 drop table t1,t2; -CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) TYPE=MyISAM; +CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) ENGINE=MyISAM; INSERT INTO t3 VALUES ('A',1,1,22,3.2,'R','R','BASE2',0.24,NULL); create table t1 (A varchar(1)); insert into t1 values ("A") ,("B"),("C"),("D"); diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 49475c9cbec..ec70cefc63f 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -3,7 +3,7 @@ SET SQL_WARNINGS=1; CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); INSERT INTO t1 VALUES ('DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'); INSERT INTO t1 VALUES ('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'); @@ -49,7 +49,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par t1 0 PRIMARY 1 a A 5 NULL NULL BTREE t1 1 b 1 b A 1 NULL NULL BTREE drop table t1; -create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=myisam; +create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam; insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); explain select * from t1 order by a; id select_type table type possible_keys key key_len ref rows Extra @@ -313,7 +313,7 @@ KEY `ip` (`ip`), KEY `poster_login` (`poster_login`), KEY `topic_id` (`topic_id`), FULLTEXT KEY `post_text` (`post_text`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'); REPAIR TABLE t1; Table Op Msg_type Msg_text @@ -398,7 +398,7 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; -CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) TYPE=MyISAM; +CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM; ERROR 42000: This version of MySQL doesn't yet support 'RTREE INDEX' create table t1 (a int, b varchar(200), c text not null) checksum=1; create table t2 (a int, b varchar(200), c text not null) checksum=0; diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index f4decd3b79e..c4af221e117 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -71,7 +71,7 @@ indexed_field NULL NULL DROP TABLE t1; -create table t1 (a int, b int) type=myisam; +create table t1 (a int, b int) engine=myisam; insert into t1 values(20,null); select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on t2.b=t3.a; diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 9aaea0d800b..385108216bf 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -1,5 +1,5 @@ drop table if exists t1,t2; -create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam; +create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam; insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); explain select * from t1 where a is null; id select_type table type possible_keys key key_len ref rows Extra @@ -243,12 +243,12 @@ id int(10) unsigned NOT NULL auto_increment, uniq_id int(10) unsigned default NULL, PRIMARY KEY (id), UNIQUE KEY idx1 (uniq_id) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE t2 ( id int(10) unsigned NOT NULL auto_increment, uniq_id int(10) unsigned default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); explain select id from t1 where uniq_id is null; @@ -295,13 +295,13 @@ CREATE TABLE `t1` ( `product_id` char(32) NOT NULL default '', `product_type` int(11) NOT NULL default '0', PRIMARY KEY (`order_id`,`product_id`,`product_type`) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE `t2` ( `order_id` char(32) NOT NULL default '', `product_id` char(32) NOT NULL default '', `product_type` int(11) NOT NULL default '0', PRIMARY KEY (`order_id`,`product_id`,`product_type`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (order_id, product_id, product_type) VALUES ('3d7ce39b5d4b3e3d22aaafe9b633de51',1206029, 3), ('3d7ce39b5d4b3e3d22aaafe9b633de51',5880836, 3), diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index a37f7e3c485..a321e8a44f9 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -251,7 +251,7 @@ favo_muziek varchar(30) NOT NULL default '', info text NOT NULL, ipnr varchar(30) NOT NULL default '', PRIMARY KEY (member_id) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; insert into t1 (member_id) values (1),(2),(3); select member_id, nickname, voornaam FROM t1 ORDER by lastchange_datum DESC LIMIT 2; @@ -429,7 +429,7 @@ gid int(10) unsigned NOT NULL auto_increment, cid smallint(5) unsigned NOT NULL default '0', PRIMARY KEY (gid), KEY component_id (cid) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (103853,108),(103867,108),(103962,108),(104505,108),(104619,108),(104620,108); ALTER TABLE t1 add skr int(10) not null; CREATE TABLE t2 ( @@ -439,12 +439,12 @@ sid tinyint(3) unsigned NOT NULL default '1', PRIMARY KEY (gid), KEY uid (uid), KEY status_id (sid) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (103853,250,5),(103867,27,5),(103962,27,5),(104505,117,5),(104619,75,5),(104620,15,5); CREATE TABLE t3 ( uid smallint(6) NOT NULL auto_increment, PRIMARY KEY (uid) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t3 VALUES (1),(15),(27),(75),(117),(250); ALTER TABLE t3 add skr int(10) not null; select t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index e668b9031cc..bf658bae89e 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -44,7 +44,7 @@ create table t1 (a int not null); insert into t1 values (1),(2),(3); create table t2 (a int not null); insert into t2 values (4),(5),(6); -create table t3 (a int not null) type=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; +create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; select * from t3; a 1 diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 0c8f2cb5323..5e61b1c58c3 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -160,7 +160,7 @@ PRIMARY KEY (t1ID), KEY IdxArt (art), KEY IdxKnr (KNR), KEY IdxArtnr (ARTNR) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'), ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'), ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'), @@ -267,7 +267,7 @@ a int(11) default NULL, b int(11) default NULL, KEY a (a), KEY b (b) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(10,2), (13,2),(14,2),(15,2),(16,2),(17,3),(17,3),(16,3),(17,3),(19,3),(20,3), diff --git a/mysql-test/r/repair_part1.result b/mysql-test/r/repair_part1.result index 27dfdac24f0..e0030327743 100644 --- a/mysql-test/r/repair_part1.result +++ b/mysql-test/r/repair_part1.result @@ -4,7 +4,7 @@ repair table t1 use_frm; Table Op Msg_type Msg_text test.t1 repair warning Number of rows changed from 0 to 1 test.t1 repair status OK -alter table t1 TYPE=HEAP; +alter table t1 ENGINE=HEAP; repair table t1 use_frm; Table Op Msg_type Msg_text test.t1 repair error The storage engine for the table doesn't support repair @@ -12,4 +12,4 @@ drop table t1; repair table t1 use_frm; Table Op Msg_type Msg_text test.t1 repair error Table 'test.t1' doesn't exist -create table t1 type=myisam SELECT 1,"table 1"; +create table t1 engine=myisam SELECT 1,"table 1"; diff --git a/mysql-test/r/replace.result b/mysql-test/r/replace.result index 2d95343245b..83cde76215a 100644 --- a/mysql-test/r/replace.result +++ b/mysql-test/r/replace.result @@ -3,13 +3,13 @@ CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (gesuchnr,benutzer_id) -) type=ISAM; +) engine=ISAM; replace into t1 (gesuchnr,benutzer_id) values (2,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); -alter table t1 type=myisam; +alter table t1 engine=myisam; replace into t1 (gesuchnr,benutzer_id) values (1,1); -alter table t1 type=heap; +alter table t1 engine=heap; replace into t1 (gesuchnr,benutzer_id) values (1,1); drop table t1; create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value"); diff --git a/mysql-test/r/rollback.result b/mysql-test/r/rollback.result index d87aa68dce4..e562b73c981 100644 --- a/mysql-test/r/rollback.result +++ b/mysql-test/r/rollback.result @@ -1,5 +1,5 @@ drop table if exists t1; -create table t1 (n int not null primary key) type=myisam; +create table t1 (n int not null primary key) engine=myisam; begin work; insert into t1 values (4); insert into t1 values (5); diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result index 7209ec3c3d1..e4c2006c2f0 100644 --- a/mysql-test/r/rpl000006.result +++ b/mysql-test/r/rpl000006.result @@ -19,7 +19,7 @@ drop table t1; set SQL_LOG_BIN=0; CREATE TABLE t1 ( a int not null -) TYPE=MyISAM MAX_ROWS=4000 CHECKSUM=1; +) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1; INSERT INTO t1 VALUES (1); load table t1 from master; check table t1; diff --git a/mysql-test/r/rpl_flush_tables.result b/mysql-test/r/rpl_flush_tables.result index 6353a6101d6..70e4774a920 100644 --- a/mysql-test/r/rpl_flush_tables.result +++ b/mysql-test/r/rpl_flush_tables.result @@ -7,7 +7,7 @@ start slave; create table t1 (a int); insert into t1 values (10); create table t2 (a int); -create table t3 (a int) type=merge union(t1); +create table t3 (a int) engine=merge union(t1); create table t4 (a int); insert into t4 select * from t3; rename table t1 to t5, t2 to t1; @@ -18,10 +18,10 @@ master-bin.000001 4 Start 1 4 Server ver: SERVER_VERSION, Binlog ver: 3 master-bin.000001 79 Query 1 79 use `test`; create table t1 (a int) master-bin.000001 137 Query 1 137 use `test`; insert into t1 values (10) master-bin.000001 198 Query 1 198 use `test`; create table t2 (a int) -master-bin.000001 256 Query 1 256 use `test`; create table t3 (a int) type=merge union(t1) -master-bin.000001 335 Query 1 335 use `test`; create table t4 (a int) -master-bin.000001 393 Query 1 393 use `test`; insert into t4 select * from t3 -master-bin.000001 459 Query 1 459 use `test`; rename table t1 to t5, t2 to t1 +master-bin.000001 256 Query 1 256 use `test`; create table t3 (a int) engine=merge union(t1) +master-bin.000001 337 Query 1 337 use `test`; create table t4 (a int) +master-bin.000001 395 Query 1 395 use `test`; insert into t4 select * from t3 +master-bin.000001 461 Query 1 461 use `test`; rename table t1 to t5, t2 to t1 select * from t3; a flush tables; @@ -31,10 +31,10 @@ master-bin.000001 4 Start 1 4 Server ver: SERVER_VERSION, Binlog ver: 3 master-bin.000001 79 Query 1 79 use `test`; create table t1 (a int) master-bin.000001 137 Query 1 137 use `test`; insert into t1 values (10) master-bin.000001 198 Query 1 198 use `test`; create table t2 (a int) -master-bin.000001 256 Query 1 256 use `test`; create table t3 (a int) type=merge union(t1) -master-bin.000001 335 Query 1 335 use `test`; create table t4 (a int) -master-bin.000001 393 Query 1 393 use `test`; insert into t4 select * from t3 -master-bin.000001 459 Query 1 459 use `test`; rename table t1 to t5, t2 to t1 -master-bin.000001 525 Query 1 525 use `test`; flush tables +master-bin.000001 256 Query 1 256 use `test`; create table t3 (a int) engine=merge union(t1) +master-bin.000001 337 Query 1 337 use `test`; create table t4 (a int) +master-bin.000001 395 Query 1 395 use `test`; insert into t4 select * from t3 +master-bin.000001 461 Query 1 461 use `test`; rename table t1 to t5, t2 to t1 +master-bin.000001 527 Query 1 527 use `test`; flush tables select * from t3; a diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result index cf70e196921..6e331abf102 100644 --- a/mysql-test/r/rpl_insert_id.result +++ b/mysql-test/r/rpl_insert_id.result @@ -20,8 +20,8 @@ b c 1 4 drop table t1; drop table t2; -create table t1(a int auto_increment, key(a)) type=innodb; -create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) type=innodb; +create table t1(a int auto_increment, key(a)) engine=innodb; +create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb; SET FOREIGN_KEY_CHECKS=0; insert into t1 values (10); insert into t1 values (null),(null),(null); diff --git a/mysql-test/r/rpl_relayrotate.result b/mysql-test/r/rpl_relayrotate.result index 802be911ad7..bf9bbbb9b93 100644 --- a/mysql-test/r/rpl_relayrotate.result +++ b/mysql-test/r/rpl_relayrotate.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; stop slave; -create table t1 (a int) type=innodb; +create table t1 (a int) engine=innodb; reset slave; start slave; stop slave; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 8edd0182dec..30b391dd947 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -488,7 +488,7 @@ price2 double(11,0), key (period), key (name) ); -create temporary table tmp type = myisam select * from t3; +create temporary table tmp engine = myisam select * from t3; insert into t3 select * from tmp; insert into tmp select * from t3; insert into t3 select * from tmp; @@ -1288,7 +1288,7 @@ companynr tinyint(2) unsigned zerofill NOT NULL default '00', companyname char(30) NOT NULL default '', PRIMARY KEY (companynr), UNIQUE KEY companyname(companyname) -) TYPE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames'; +) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames'; select STRAIGHT_JOIN t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr; companynr companyname 00 Unknown @@ -2067,9 +2067,9 @@ INSERT INTO t1 (pseudo) VALUES ('test1'); SELECT 1 as rnd1 from t1 where rand() > 2; rnd1 DROP TABLE t1; -CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) TYPE=MyISAM; +CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM; INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL); -CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) TYPE=MyISAM; +CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35); SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'NULL' AND b.sampletime < 'NULL' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time @@ -2289,9 +2289,9 @@ a a a 2 2 2 3 3 3 drop table t1; -CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM; +CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM; INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522); -CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM; +CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM; INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522); select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5; aa id t2_id id diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result index d79f45a9334..42f7257dbba 100644 --- a/mysql-test/r/select_found.result +++ b/mysql-test/r/select_found.result @@ -159,7 +159,7 @@ CREATE TABLE `t1` ( `maxnumrep` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`numeropost`), KEY `maxnumrep` (`maxnumrep`) -) TYPE=MyISAM ROW_FORMAT=FIXED; +) ENGINE=MyISAM ROW_FORMAT=FIXED; INSERT INTO t1 (titre,maxnumrep) VALUES ('test1','1'),('test2','2'),('test3','3'); SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost IN (1,2) ORDER BY maxnumrep DESC LIMIT 0, 1; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 2f29dcfdb47..f39fa3e7576 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -77,13 +77,13 @@ show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) NOT NULL default '0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t1 rename t2; show create table t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `a` int(11) NOT NULL default '0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t2; create table t1 ( test_set set( 'val1', 'val2', 'val3' ) not null default '', @@ -96,7 +96,7 @@ t1 CREATE TABLE `t1` ( `test_set` set('val1','val2','val3') NOT NULL default '', `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default', `c` int(11) NOT NULL default '0' COMMENT 'int column' -) TYPE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table' show full columns from t1; Field Type Collation Null Key Default Extra Privileges Comment test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references @@ -109,7 +109,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', UNIQUE KEY `aa` (`a`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int not null, primary key (a)); show create table t1; @@ -117,7 +117,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', PRIMARY KEY (`a`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; flush tables; show open tables; @@ -128,14 +128,14 @@ show open tables; Database Table In_use Name_locked test t1 0 0 drop table t1; -create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed; +create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', `b` char(10) default NULL, KEY `b` (`b`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0; show create table t1; Table Create Table @@ -143,7 +143,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', `b` varchar(10) default NULL, KEY `b` (`b`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default; show create table t1; Table Create Table @@ -151,7 +151,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', `b` varchar(10) default NULL, KEY `b` (`b`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0)); show columns from t1; @@ -194,7 +194,7 @@ type_blob blob, type_medium_blob mediumblob, type_long_blob longblob, index(type_short) -) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1; +) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -221,7 +221,7 @@ t1 CREATE TABLE `t1` ( `type_long_blob` longblob, PRIMARY KEY (`type_tiny`), KEY `type_short` (`type_short`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' insert into t1 (type_timestamp) values ("2003-02-07 10:00:01"); select * from t1; type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_numeric empty_char type_char type_varchar type_timestamp type_date type_time type_datetime type_year type_enum type_set type_tinyblob type_blob type_medium_blob type_long_blob diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result index dddfe2432ee..ddc848af1ed 100644 --- a/mysql-test/r/sql_mode.result +++ b/mysql-test/r/sql_mode.result @@ -5,7 +5,7 @@ a int not null auto_increment, `email` varchar(60) character set latin2 NOT NULL default '', PRIMARY KEY (a), UNIQUE KEY `email` USING BTREE (`email`) -) TYPE=HEAP CHARSET=latin1 ROW_FORMAT DYNAMIC; +) ENGINE=HEAP CHARSET=latin1 ROW_FORMAT DYNAMIC; set @@sql_mode=""; show variables like 'sql_mode'; Variable_name Value @@ -18,7 +18,7 @@ t1 CREATE TABLE `t1` ( `email` varchar(60) character set latin2 NOT NULL default '', PRIMARY KEY (`a`), UNIQUE KEY `email` TYPE BTREE (`email`) -) TYPE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC set @@sql_mode="ansi_quotes"; show variables like 'sql_mode'; Variable_name Value @@ -31,7 +31,7 @@ t1 CREATE TABLE "t1" ( "email" varchar(60) character set latin2 NOT NULL default '', PRIMARY KEY ("a"), UNIQUE KEY "email" TYPE BTREE ("email") -) TYPE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC set @@sql_mode="no_table_options"; show variables like 'sql_mode'; Variable_name Value @@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` ( `email` varchar(60) character set latin2 NOT NULL default '', PRIMARY KEY (`a`), UNIQUE KEY `email` (`email`) -) TYPE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC set @@sql_mode="no_field_options,mysql323,mysql40"; show variables like 'sql_mode'; Variable_name Value @@ -70,7 +70,7 @@ t1 CREATE TABLE `t1` ( `email` varchar(60) NOT NULL default '', PRIMARY KEY (`a`), UNIQUE KEY `email` (`email`) -) TYPE=HEAP ROW_FORMAT=DYNAMIC +) ENGINE=HEAP ROW_FORMAT=DYNAMIC set sql_mode="postgresql,oracle,mssql,db2,maxdb"; select @@sql_mode; @@sql_mode diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result index 3ef6cec32b3..e9616232fa1 100644 --- a/mysql-test/r/status.result +++ b/mysql-test/r/status.result @@ -5,7 +5,7 @@ Table_locks_immediate 0 Table_locks_waited 0 SET SQL_LOG_BIN=0; drop table if exists t1; -create table t1(n int) type=myisam; +create table t1(n int) engine=myisam; insert into t1 values(1); lock tables t1 read; unlock tables; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 71755aac52d..672a39299dd 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -351,7 +351,7 @@ CREATE TABLE `t8` ( `email` varchar(60) character set latin1 NOT NULL default '', PRIMARY KEY (`pseudo`), UNIQUE KEY `email` (`email`) -) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1'); @@ -381,7 +381,7 @@ CREATE TABLE `t1` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', PRIMARY KEY (`pseudo`,`date`,`topic`), KEY `topic` (`topic`) -) TYPE=MyISAM ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM ROW_FORMAT=DYNAMIC; INSERT INTO t1 (topic,date,pseudo) VALUES ('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; @@ -421,7 +421,7 @@ CREATE TABLE `t1` ( `maxnumrep` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`numeropost`), UNIQUE KEY `maxnumrep` (`maxnumrep`) -) TYPE=MyISAM ROW_FORMAT=FIXED; +) ENGINE=MyISAM ROW_FORMAT=FIXED; INSERT INTO t1 (numeropost,maxnumrep) VALUES (40143,1),(43506,2); CREATE TABLE `t2` ( `mot` varchar(30) NOT NULL default '', @@ -429,7 +429,7 @@ CREATE TABLE `t2` ( `date` date NOT NULL default '0000-00-00', `pseudo` varchar(35) NOT NULL default '', PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`) -) TYPE=MyISAM ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM ROW_FORMAT=DYNAMIC; INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce'); select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1); a @@ -493,7 +493,7 @@ CREATE TABLE `t1` ( `maxnumrep` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`numeropost`), UNIQUE KEY `maxnumrep` (`maxnumrep`) -) TYPE=MyISAM ROW_FORMAT=FIXED; +) ENGINE=MyISAM ROW_FORMAT=FIXED; INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1); select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1); ERROR 21000: Subquery returns more than 1 row @@ -520,7 +520,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`numeropost`,`numreponse`), UNIQUE KEY `numreponse` (`numreponse`), KEY `pseudo` (`pseudo`,`numeropost`) -) TYPE=MyISAM; +) ENGINE=MyISAM; SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list) SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; @@ -698,7 +698,7 @@ x y drop table t1, t2, t3; SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *); ERROR HY000: No tables used -CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t2 VALUES (1),(2); SELECT * FROM t2 WHERE id IN (SELECT 1); id @@ -742,7 +742,7 @@ SELECT * FROM t2; id 1 2 -CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 values (1),(1); UPDATE t2 SET id=(SELECT * FROM t1); ERROR 21000: Subquery returns more than 1 row @@ -990,7 +990,7 @@ a b 1 2 1 3 drop table t1, t2; -CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES (1); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); ERROR HY000: Invalid use of group function @@ -1023,7 +1023,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`), KEY `pseudo` (`pseudo`,`date`,`topic`), KEY `topic` (`topic`) -) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; CREATE TABLE `t2` ( `mot` varchar(30) character set latin1 NOT NULL default '', `topic` mediumint(8) unsigned NOT NULL default '0', @@ -1032,13 +1032,13 @@ CREATE TABLE `t2` ( PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`), KEY `pseudo` (`pseudo`,`date`,`topic`), KEY `topic` (`topic`) -) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; CREATE TABLE `t3` ( `numeropost` mediumint(8) unsigned NOT NULL auto_increment, `maxnumrep` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`numeropost`), UNIQUE KEY `maxnumrep` (`maxnumrep`) -) TYPE=MyISAM CHARSET=latin1; +) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test'); Warnings: Warning 1264 Data truncated for column 'date' at row 1 @@ -1071,7 +1071,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(1) NOT NULL default '0', `(SELECT 1)` bigint(1) NOT NULL default '0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; SHOW CREATE TABLE t1; @@ -1079,7 +1079,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(1) NOT NULL default '0', `(SELECT a)` bigint(1) NOT NULL default '0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; @@ -1087,7 +1087,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(1) NOT NULL default '0', `(SELECT a+0)` bigint(17) NOT NULL default '0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; select * from t1; @@ -1097,7 +1097,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(17) NOT NULL default '0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int); insert into t1 values (1), (2), (3); @@ -1119,7 +1119,7 @@ t2 char(3) NOT NULL default '', District char(20) NOT NULL default '', Population int(11) NOT NULL default '0', PRIMARY KEY (ID) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (130,'Sydney','AUS','New South Wales',3276207); INSERT INTO t1 VALUES (131,'Melbourne','AUS','Victoria',2865329); INSERT INTO t1 VALUES (132,'Brisbane','AUS','Queensland',1291117); @@ -1140,7 +1140,7 @@ HeadOfState char(60) default NULL, Capital int(11) default NULL, Code2 char(2) NOT NULL default '', PRIMARY KEY (Code) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU'); INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ'); select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2 where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent); @@ -1152,7 +1152,7 @@ CREATE TABLE `t1` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `pseudo` (`pseudo`), -) TYPE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC; INSERT INTO t1 (pseudo) VALUES ('test'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1177,7 +1177,7 @@ drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', PRIMARY KEY (`i`) -) TYPE=MyISAM CHARSET=latin1; +) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES (1); UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i)); ERROR HY000: Invalid use of group function @@ -1188,12 +1188,12 @@ ERROR 42S02: Unknown table 't' in field list drop table t1; CREATE TABLE t1 ( id int(11) default NULL -) TYPE=MyISAM CHARSET=latin1; +) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3); CREATE TABLE t2 ( id int(11) default NULL, name varchar(15) default NULL -) TYPE=MyISAM CHARSET=latin1; +) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita'); update t1, t2 set t2.name='lenka' where t2.id in (select id from t1); select * from t2; @@ -1227,7 +1227,7 @@ PRIMARY KEY (ID,SUB_ID), UNIQUE KEY t1_PK (ID,SUB_ID), KEY t1_FK (REF_ID,REF_SUB), KEY t1_REFID (REF_ID) -) TYPE=MyISAM CHARSET=cp1251; +) ENGINE=MyISAM CHARSET=cp1251; INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL); SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2); REF_ID @@ -1257,7 +1257,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`), UNIQUE KEY `pseudo` (`pseudo`), -) TYPE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC; INSERT INTO t1 (id,pseudo,email) VALUES (1,'test','test'),(2,'test1','test1'); SELECT pseudo as a, pseudo as b FROM t1 GROUP BY (SELECT a) ORDER BY (SELECT id*1); a b @@ -1496,13 +1496,13 @@ id select_type table type possible_keys key key_len ref rows Extra Warnings: Note 1003 select high_priority test.t3.a AS `a` from test.t3 where ((test.t3.a <= (select max(test.t2.b) AS `max(b)` from test.t2 group by test.t2.a))) drop table t2, t3; -CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) TYPE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; +CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); -CREATE TABLE `t2` (`db_id` int(11) NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` smallint(6) NOT NULL default '0',`secondary_uid` smallint(6) NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`),FULLTEXT KEY `name` (`name`)) TYPE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2147483647; +CREATE TABLE `t2` (`db_id` int(11) NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` smallint(6) NOT NULL default '0',`secondary_uid` smallint(6) NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`),FULLTEXT KEY `name` (`name`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2147483647; INSERT INTO `t2` (`db_id`, `name`, `primary_uid`, `secondary_uid`) VALUES (18, 'Not Set 1', 0, 0),(19, 'Valid', 1, 2),(20, 'Valid 2', 1, 2),(21, 'Should Not Return', 1, 2),(26, 'Not Set 2', 0, 0),(-1, 'ALL DB\'S', 0, 0); -CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(11) NOT NULL default '0',`taskid` int(11) NOT NULL default '0',`mon` tinyint(4) NOT NULL default '1',`tues` tinyint(4) NOT NULL default '1',`wed` tinyint(4) NOT NULL default '1',`thur` tinyint(4) NOT NULL default '1',`fri` tinyint(4) NOT NULL default '1',`sat` tinyint(4) NOT NULL default '0',`sun` tinyint(4) NOT NULL default '0',`how_often` smallint(6) NOT NULL default '1',`userid` smallint(6) NOT NULL default '0',`active` tinyint(4) NOT NULL default '1',PRIMARY KEY (`taskgenid`)) TYPE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2 ; +CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(11) NOT NULL default '0',`taskid` int(11) NOT NULL default '0',`mon` tinyint(4) NOT NULL default '1',`tues` tinyint(4) NOT NULL default '1',`wed` tinyint(4) NOT NULL default '1',`thur` tinyint(4) NOT NULL default '1',`fri` tinyint(4) NOT NULL default '1',`sat` tinyint(4) NOT NULL default '0',`sun` tinyint(4) NOT NULL default '0',`how_often` smallint(6) NOT NULL default '1',`userid` smallint(6) NOT NULL default '0',`active` tinyint(4) NOT NULL default '1',PRIMARY KEY (`taskgenid`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2 ; INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1); -CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') TYPE=MyISAM CHARSET=latin1; +CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status'); select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') @@ -1514,9 +1514,9 @@ dbid name -1 Valid -1 Valid 2 drop table t1,t2,t3,t4; -CREATE TABLE t1 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t1 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES (1),(5); -CREATE TABLE t2 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t2 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t2 VALUES (2),(6); select * from t1 where (1,2,6) in (select * from t2); ERROR 21000: Operand should contain 3 column(s) @@ -1542,9 +1542,9 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t1 system NULL NULL NULL NULL 1 3 UNION t1 system NULL NULL NULL NULL 1 drop table t1; -CREATE TABLE t1 (number char(11) NOT NULL default '') TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874'); -CREATE TABLE t2 (code char(5) NOT NULL default '',UNIQUE KEY code (code)) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t2 (code char(5) NOT NULL default '',UNIQUE KEY code (code)) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t2 VALUES ('1'),('1226'),('1245'),('1862'),('18623'),('1874'),('1967'),('6'); select c.number as phone,(select p.code from t2 p where c.number like concat(p.code, '%') order by length(p.code) desc limit 1) as code from t1 c; phone code diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result index 98df44553d2..b04fec26c6f 100644 --- a/mysql-test/r/subselect2.result +++ b/mysql-test/r/subselect2.result @@ -12,7 +12,7 @@ DOCID VARCHAR(32)BINARY NOT NULL , MODIFIER VARCHAR(255)BINARY , ORIGINATOR INTEGER , PRIMARY KEY ( DOCID ) -) TYPE=InnoDB +) ENGINE=InnoDB ; CREATE TABLE t2 ( @@ -36,7 +36,7 @@ DOCID VARCHAR(32)BINARY NOT NULL , PUBLISHSTATUS INTEGER , ORIGINATOR INTEGER , PRIMARY KEY ( DOCID ) -) TYPE=InnoDB +) ENGINE=InnoDB ; CREATE INDEX DDOCTYPEID_IDX ON t2 (DOCTYPEID); CREATE INDEX DFOLDERID_IDX ON t2 (FOLDERID); @@ -55,7 +55,7 @@ FOLDERID VARCHAR(32)BINARY NOT NULL , REPID VARCHAR(32)BINARY , ORIGINATOR INTEGER , PRIMARY KEY ( FOLDERID ) -) TYPE=InnoDB; +) ENGINE=InnoDB; CREATE INDEX FFOLDERID_IDX ON t3 (FOLDERID); CREATE INDEX CMFLDRPARNT_IDX ON t3 (PARENTID); CREATE TABLE t4 @@ -68,7 +68,7 @@ DOCTYPEID VARCHAR(32)BINARY NOT NULL , MODIFIER VARCHAR(255)BINARY , ORIGINATOR INTEGER , PRIMARY KEY ( DOCTYPEID ) -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t2 VALUES("c373e9f59cf15a6c3e57444553544200", "c373e9f59cf15a6c3e57444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-06 07:48:42", NULL, NULL, NULL, "2003-06-06 07:48:42", "2003-06-06 07:48:42", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-06 07:48:42", "admin", "0", NULL); INSERT INTO t2 VALUES("c373e9f5a472f43ba45e444553544200", "c373e9f5a472f43ba45e444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 18:50:12", NULL, NULL, NULL, "2003-06-07 18:50:12", "2003-06-07 18:50:12", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 18:50:12", "admin", "0", NULL); INSERT INTO t2 VALUES("c373e9f5a4a0f56014eb444553544200", "c373e9f5a4a0f56014eb444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 19:39:26", NULL, NULL, NULL, "2003-06-07 19:39:26", "2003-06-07 19:39:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 19:39:26", "admin", "0", NULL); diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result index 2f5b92fd05d..6729916f1c8 100644 --- a/mysql-test/r/subselect_innodb.result +++ b/mysql-test/r/subselect_innodb.result @@ -14,7 +14,7 @@ FOLDERID VARCHAR(32)BINARY NOT NULL , REPID VARCHAR(32)BINARY , ORIGINATOR INTEGER , PRIMARY KEY ( FOLDERID ) -) TYPE=InnoDB; +) ENGINE=InnoDB; CREATE INDEX FFOLDERID_IDX ON t1 (FOLDERID); CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID); INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1"); @@ -24,9 +24,9 @@ SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1') 0 drop table t1; -create table t1 (a int) type=innodb; -create table t2 (a int) type=innodb; -create table t3 (a int) type=innodb; +create table t1 (a int) engine=innodb; +create table t2 (a int) engine=innodb; +create table t3 (a int) engine=innodb; insert into t1 values (1),(2),(3),(4); insert into t2 values (10),(20),(30),(40); insert into t3 values (1),(2),(10),(50); @@ -39,12 +39,12 @@ drop table t1,t2,t3; CREATE TABLE t1 ( processor_id INTEGER NOT NULL, PRIMARY KEY (processor_id) -) TYPE=InnoDB; +) ENGINE=InnoDB; CREATE TABLE t3 ( yod_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, login_processor INTEGER UNSIGNED , PRIMARY KEY (yod_id) -) TYPE=InnoDB; +) ENGINE=InnoDB; CREATE TABLE t2 ( processor_id INTEGER NOT NULL, yod_id BIGINT UNSIGNED NOT NULL, @@ -53,7 +53,7 @@ INDEX (processor_id), INDEX (yod_id), FOREIGN KEY (processor_id) REFERENCES t1(processor_id), FOREIGN KEY (yod_id) REFERENCES t3(yod_id) -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t3 VALUES (1,1),(2,2),(3,3); INSERT INTO t2 VALUES (1,1),(2,2),(3,3); diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index a56fe3e1462..48a44fc2b44 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -40,7 +40,7 @@ t9 CREATE TABLE `t9` ( `b` char(16) NOT NULL default '', `c` int(11) NOT NULL default '0', PRIMARY KEY (`a`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/' alter table t9 rename t8, add column d int not null; alter table t8 rename t7; rename table t7 to t9; @@ -62,5 +62,5 @@ t9 CREATE TABLE `t9` ( `c` int(11) NOT NULL default '0', `d` int(11) NOT NULL default '0', PRIMARY KEY (`a`) -) TYPE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/' drop database mysqltest; diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index fbc5c234256..10c0a2e3652 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -21,8 +21,8 @@ a b 4 e 5 f 6 g -create TEMPORARY TABLE t2 type=heap select * from t1; -create TEMPORARY TABLE IF NOT EXISTS t2 (a int) type=heap; +create TEMPORARY TABLE t2 engine=heap select * from t1; +create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap; CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null); ERROR 42S01: Table 't1' already exists ALTER TABLE t1 RENAME t2; @@ -78,7 +78,7 @@ ERROR 23000: Duplicate entry '1' for key 1 drop table t1; CREATE TABLE t1 ( d datetime default NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'); flush status; select * from t1 group by d; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index c521aa0296c..a69e3308f0a 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -23,7 +23,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` mediumtext, `b` mediumblob -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2,t3 #; CREATE TABLE t1 (a char(257) default "hello"); diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 95e64a2a70e..204266d6ec2 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -71,7 +71,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`numfacture`), KEY `date` (`date`), KEY `expedition` (`expedition`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (expedition) VALUES ('0001-00-00 00:00:00'); SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; date numfacture expedition diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index f30feb4c0e6..42ee54ce105 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1627,12 +1627,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('','a','b') NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a enum (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('','a','b') NOT NULL default 'b' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/type_nchar.result b/mysql-test/r/type_nchar.result index 63193418f77..f844b3b0241 100644 --- a/mysql-test/r/type_nchar.result +++ b/mysql-test/r/type_nchar.result @@ -4,47 +4,47 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) character set utf8 default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (c national char(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) character set utf8 default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (c national varchar(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c` varchar(10) character set utf8 default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (c nvarchar(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c` varchar(10) character set utf8 default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (c nchar varchar(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c` varchar(10) character set utf8 default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (c national character varying(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c` varchar(10) character set utf8 default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (c nchar varying(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c` varchar(10) character set utf8 default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index e98ec2c3fc4..084e004cd47 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -4,14 +4,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` set('','a','b') NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a set (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` set('','a','b') NOT NULL default 'b' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; -CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) TYPE=MyISAM CHARSET=utf8; +CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) ENGINE=MyISAM CHARSET=utf8; DROP TABLE t1; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 642c07904b5..b3bf95bdf3d 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -168,7 +168,7 @@ CREATE TABLE t1 ( `same` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`pseudo1`), KEY `pseudo` (`pseudo`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (pseudo,pseudo1,same) VALUES ('joce', 'testtt', 1),('joce', 'tsestset', 1),('dekad', 'joce', 1); SELECT pseudo FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo FROM t1 WHERE pseudo='joce'; pseudo @@ -435,9 +435,9 @@ a (SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1; ERROR 42000: Wrong usage/placement of 'SQL_CALC_FOUND_ROWS' drop table t1,t2; -CREATE TABLE t1 ( id int(3) unsigned default '0') TYPE=MyISAM; +CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM; INSERT INTO t1 (id) VALUES("1"); -CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) TYPE=MyISAM; +CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) ENGINE=MyISAM; INSERT INTO t2 (id, id_master, text1, text2) VALUES("1", "1", "foo1", "bar1"); INSERT INTO t2 (id, id_master, text1, text2) VALUES("2", "1", @@ -532,7 +532,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT 12 as a UNION select "aa" as a; select * from t1; @@ -543,7 +543,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT 12 as a UNION select 12.2 as a; select * from t1; @@ -554,7 +554,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double(4,1) NOT NULL default '0.0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text); insert into t2 values (NULL, 1, 3, 4, 1.5, 2.5, 1972, '1972-10-22', '1972-10-22 11:50', 'testc', 'testv', 'tetetetetest', 'teeeeeeeeeeeest'); @@ -567,7 +567,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `it2` tinyint(4) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT it2 from t2 UNION select i from t2; select * from t1; @@ -578,7 +578,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `it2` int(11) NOT NULL default '0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT i from t2 UNION select f from t2; select * from t1; @@ -589,7 +589,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` double default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT f from t2 UNION select d from t2; select * from t1; @@ -600,7 +600,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f` double default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT ib from t2 UNION select f from t2; select * from t1; @@ -611,7 +611,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `ib` double default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT ib from t2 UNION select d from t2; select * from t1; @@ -622,7 +622,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `ib` double default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT f from t2 UNION select y from t2; select * from t1; @@ -633,7 +633,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f` float default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT f from t2 UNION select da from t2; select * from t1; @@ -644,7 +644,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f` char(12) binary default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT y from t2 UNION select da from t2; select * from t1; @@ -655,7 +655,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `y` char(10) binary default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT y from t2 UNION select dt from t2; select * from t1; @@ -666,7 +666,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `y` char(19) binary default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT da from t2 UNION select dt from t2; select * from t1; @@ -677,7 +677,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `da` datetime default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT dt from t2 UNION select sc from t2; select * from t1; @@ -688,7 +688,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `dt` char(19) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT dt from t2 UNION select sv from t2; select * from t1; @@ -699,7 +699,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `dt` char(19) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT sc from t2 UNION select sv from t2; select * from t1; @@ -710,7 +710,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `sc` varchar(10) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT dt from t2 UNION select b from t2; select * from t1; @@ -721,7 +721,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `dt` longblob -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT sv from t2 UNION select b from t2; select * from t1; @@ -732,7 +732,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `sv` longblob -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2; select * from t1; @@ -744,7 +744,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` blob -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT sv from t2 UNION select tx from t2; select * from t1; @@ -755,7 +755,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `sv` text -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT b from t2 UNION select tx from t2; select * from t1; @@ -766,7 +766,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `b` longblob -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2; create table t1 (d decimal(10,1)); create table t2 (d decimal(10,9)); @@ -781,7 +781,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `d` decimal(10,9) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2,t3; create table t1 select 1 union select -1; select * from t1; @@ -792,7 +792,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `1` bigint(1) NOT NULL default '0' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 select _latin1"test" union select _latin2"testt" ; ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'UNION' @@ -801,7 +801,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `test` char(5) character set latin2 NOT NULL default '' -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (s char(200)); insert into t1 values (repeat("1",200)); diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index a0370272396..6a5546200ce 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -94,7 +94,7 @@ KEY k2 (type), KEY k3 (parent), KEY k4 (assignment), KEY ticket (ticket) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','',''); alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment; update t1 set status=1 where type='Open'; @@ -146,7 +146,7 @@ CREATE TABLE t1 ( `nom_option` char(40) NOT NULL default '', `valid` tinyint(1) NOT NULL default '0', KEY `id_param` (`id_param`,`nom_option`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1); UPDATE t1 SET nom_option='test' WHERE id_param=185 AND nom_option='600x1200' AND valid=1 LIMIT 1; select * from t1; diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 1942f1a25bb..2769e284a95 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -119,10 +119,17 @@ select @@warning_count; @@warning_count 50 drop table t1; -create table t1 (id int) type=isam; +create table t1 (id int) engine=isam; Warnings: Warning 1265 Using storage engine MyISAM for table 't1' -alter table t1 type=isam; +alter table t1 engine=isam; Warnings: Warning 1265 Using storage engine MyISAM for table 't1' drop table t1; +create table t1 (id int) type=heap; +Warnings: +Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead. +alter table t1 type=myisam; +Warnings: +Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead. +drop table t1; diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test index e0fa10d56d5..852b78dd04e 100644 --- a/mysql-test/t/alias.test +++ b/mysql-test/t/alias.test @@ -50,7 +50,7 @@ CREATE TABLE t1 ( KEY mcbs_aufnr(mcbs_aufnr), KEY kundentyp(kundentyp), KEY p_nr(p_nr,suffix) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 11fe997e789..eab4fd7f5f0 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -61,7 +61,7 @@ CREATE TABLE t1 ( user_id int(11) unsigned NOT NULL default '0', status enum('new','old') NOT NULL default 'new', PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body; DROP TABLE t1; @@ -70,7 +70,7 @@ DROP TABLE t1; # The following combination found a hang-bug in MyISAM # -CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) type=myisam; +CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam; insert into t1 values (null,"hello"); LOCK TABLES t1 WRITE; ALTER TABLE t1 ADD Column new_col int not null; @@ -191,7 +191,7 @@ CREATE TABLE t1 ( Host varchar(16) binary NOT NULL default '', User varchar(16) binary NOT NULL default '', PRIMARY KEY (Host,User) -) TYPE=MyISAM; +) ENGINE=MyISAM; ALTER TABLE t1 DISABLE KEYS; LOCK TABLES t1 WRITE; @@ -211,7 +211,7 @@ CREATE TABLE t1 ( User varchar(16) binary NOT NULL default '', PRIMARY KEY (Host,User), KEY (Host) -) TYPE=MyISAM; +) ENGINE=MyISAM; ALTER TABLE t1 DISABLE KEYS; SHOW INDEX FROM t1; @@ -238,7 +238,7 @@ CREATE TABLE t1 ( User varchar(16) binary NOT NULL default '', PRIMARY KEY (Host,User), KEY (Host) -) TYPE=MyISAM; +) ENGINE=MyISAM; LOCK TABLES t1 WRITE; ALTER TABLE t1 DISABLE KEYS; diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index d02850f6745..6cf286f86c0 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -6,7 +6,7 @@ drop table if exists t1; --enable_warnings SET SQL_WARNINGS=1; -create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3; +create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; insert into t1 values (NULL,5),(NULL,6); diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test index 7537cc358e8..18b6c70758f 100644 --- a/mysql-test/t/bdb-alter-table-1.test +++ b/mysql-test/t/bdb-alter-table-1.test @@ -6,7 +6,7 @@ drop table if exists t1; --enable_warnings -create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB; +create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) engine=BDB; insert into t1 values(1, 't1',4,9); insert into t1 values(2, 'metatable',1,9); insert into t1 values(3, 'metaindex',1,9 ); diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test index d77de901a30..fffed379e79 100644 --- a/mysql-test/t/bdb-crash.test +++ b/mysql-test/t/bdb-crash.test @@ -20,7 +20,7 @@ DEFAULT 'New' NOT NULL, PRIMARY KEY (ChargeID), KEY ServiceID (ServiceID), KEY ChargeDate (ChargeDate) -) type=BDB; +) engine=BDB; BEGIN; INSERT INTO t1 diff --git a/mysql-test/t/bdb-deadlock.test b/mysql-test/t/bdb-deadlock.test index 2453c42e49a..d86403fcffc 100644 --- a/mysql-test/t/bdb-deadlock.test +++ b/mysql-test/t/bdb-deadlock.test @@ -15,8 +15,8 @@ connect (con2,localhost,root,,); drop table if exists t1,t2; --enable_warnings connection con1; -create table t1 (id integer, x integer) type=BDB; -create table t2 (id integer, x integer) type=BDB; +create table t1 (id integer, x integer) engine=BDB; +create table t2 (id integer, x integer) engine=BDB; insert into t1 values(0, 0); insert into t2 values(0, 0); set autocommit=0; diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test index a0fbc56a9da..44bb753d6a1 100644 --- a/mysql-test/t/bdb.test +++ b/mysql-test/t/bdb.test @@ -7,7 +7,7 @@ --disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; --enable_warnings -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb; +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=bdb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); select id, code, name from t1 order by id; @@ -30,7 +30,7 @@ CREATE TABLE t1 ( PRIMARY KEY (id), KEY parent_id (parent_id), KEY level (level) -) type=bdb; +) engine=bdb; INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); update t1 set parent_id=parent_id+100; select * from t1 where parent_id=102; @@ -59,7 +59,7 @@ CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (gesuchnr,benutzer_id) -) type=BDB; +) engine=BDB; replace into t1 (gesuchnr,benutzer_id) values (2,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); @@ -68,7 +68,7 @@ select * from t1; drop table t1; # test for bug in replace with secondary key -create table t1 (id int not null primary key, x int not null, key (x)) type=bdb; +create table t1 (id int not null primary key, x int not null, key (x)) engine=bdb; insert into t1 (id, x) values (1, 1); replace into t1 (id, x) values (1, 2); select * from t1; @@ -78,7 +78,7 @@ drop table t1; # test delete using hidden_primary_key # -create table t1 (a int) type=bdb; +create table t1 (a int) engine=bdb; insert into t1 values (1), (2); optimize table t1; delete from t1 where a = 1; @@ -86,7 +86,7 @@ select * from t1; check table t1; drop table t1; -create table t1 (a int,b varchar(20)) type=bdb; +create table t1 (a int,b varchar(20)) engine=bdb; insert into t1 values (1,""), (2,"testing"); delete from t1 where a = 1; select * from t1; @@ -98,7 +98,7 @@ drop table t1; # Test of reading on secondary key with may be null -create table t1 (a int,b varchar(20),key(a)) type=bdb; +create table t1 (a int,b varchar(20),key(a)) engine=bdb; insert into t1 values (1,""), (2,"testing"); select * from t1 where a = 1; drop table t1; @@ -107,7 +107,7 @@ drop table t1; # Test auto_increment on sub key # -create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) type=BDB; +create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) engine=BDB; insert into t1 values ("a",1),("b",2),("a",2),("c",1); insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL); insert into t1 (a) values ("a"),("b"),("c"),("d"); @@ -123,7 +123,7 @@ drop table t1; # Test rollback # -create table t1 (n int not null primary key) type=bdb; +create table t1 (n int not null primary key) engine=bdb; set autocommit=0; insert into t1 values (4); rollback; @@ -150,7 +150,7 @@ drop table t1; # Testing transactions # -create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=BDB; +create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=BDB; begin; insert into t1 values(1,'hamdouni'); select id as afterbegin_id,nom as afterbegin_nom from t1; @@ -168,7 +168,7 @@ drop table t1; # Simple not autocommit test # -CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=bdb; +CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=bdb; insert into t1 values ('pippo', 12); -- error 1062 insert into t1 values ('pippo', 12); # Gives error @@ -191,12 +191,12 @@ set autocommit=1; # The following simple tests failed at some point # -CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=BDB; +CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=BDB; INSERT INTO t1 VALUES (1, 'Jochen'); select * from t1; drop table t1; -CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=BDB; +CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=BDB; set autocommit=0; INSERT INTO t1 SET _userid='marc@anyware.co.uk'; COMMIT; @@ -215,7 +215,7 @@ CREATE TABLE t1 ( ref_email varchar(100) DEFAULT '' NOT NULL, detail varchar(200), PRIMARY KEY (user_id,ref_email) -)type=bdb; +)engine=bdb; INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); select * from t1 where user_id=10292; @@ -240,7 +240,7 @@ drop table t1; # create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); -alter table t1 type=BDB; +alter table t1 engine=BDB; insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); select * from t1; update t1 set col2='7' where col1='4'; @@ -255,8 +255,8 @@ drop table t1; # INSERT INTO BDB tables # -create table t1 (a int not null , b int, primary key (a)) type = BDB; -create table t2 (a int not null , b int, primary key (a)) type = myisam; +create table t1 (a int not null , b int, primary key (a)) engine = BDB; +create table t2 (a int not null , b int, primary key (a)) engine = myisam; insert into t1 VALUES (1,3) , (2,3), (3,3); select * from t1; insert into t2 select * from t1; @@ -279,7 +279,7 @@ CREATE TABLE t1 ( passwd varchar(32) binary DEFAULT '' NOT NULL, PRIMARY KEY (id), UNIQUE ggid (ggid) -) TYPE=BDB; +) ENGINE=BDB; insert into t1 (ggid,passwd) values ('test1','xxx'); insert into t1 (ggid,passwd) values ('test2','yyy'); @@ -317,7 +317,7 @@ CREATE TABLE t1 ( approved datetime, dummy_primary_key int(11) NOT NULL auto_increment, PRIMARY KEY (dummy_primary_key) -) TYPE=BDB; +) ENGINE=BDB; INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); @@ -337,7 +337,7 @@ CREATE TABLE t1 ( KEY (id), KEY parent_id (parent_id), KEY level (level) -) type=bdb; +) engine=bdb; INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); INSERT INTO t1 values (179,5,2); update t1 set parent_id=parent_id+100; @@ -370,7 +370,7 @@ CREATE TABLE t1 ( sca_sch_desc varchar(16), PRIMARY KEY (sca_code, cat_code, lan_code), INDEX sca_pic (sca_pic) -) type = bdb ; +) engine = bdb ; INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); select count(*) from t1 where sca_code = 'PD'; @@ -392,7 +392,7 @@ drop table t1; # Test of opening table twice and timestamps # set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=bdb; +CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb; insert into t1 (a) values(1),(2),(3); select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; update t1 set a=5 where a=1; @@ -407,7 +407,7 @@ flush logs; # # Test key on blob with null values # -create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) type=bdb; +create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) engine=bdb; insert into t1 values ('this is a blob', 1), (null, -1), (null, null),("",1),("",2),("",3); select b from t1 where b = 'this is a blob'; select * from t1 where b like 't%'; @@ -421,7 +421,7 @@ drop table t1; # # Test with variable length primary key # -create table t1 (a varchar(100) not null, primary key(a), b int not null) type=bdb; +create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=bdb; insert into t1 values("hello",1),("world",2); select * from t1 order by b desc; optimize table t1; @@ -431,7 +431,7 @@ drop table t1; # # Test of bug in create index with NULL columns # -create table t1 (i int, j int )TYPE=BDB; +create table t1 (i int, j int )ENGINE=BDB; insert into t1 values (1,2); select * from t1 where i=1 and j=2; create index ax1 on t1 (i,j); @@ -451,7 +451,7 @@ create table t1 unique branch_name(branch_name), index branch_active(branch_active) -) type=bdb; +) engine=bdb; create table t2 ( target_id int auto_increment primary key, @@ -460,7 +460,7 @@ create table t2 unique target_name(target_name), index target_active(target_active) -) type=bdb; +) engine=bdb; create table t3 ( platform_id int auto_increment primary key, @@ -469,7 +469,7 @@ create table t3 unique platform_name(platform_name), index platform_active(platform_active) -) type=bdb; +) engine=bdb; create table t4 ( product_id int auto_increment primary key, @@ -479,7 +479,7 @@ create table t4 unique product_name(product_name), index product_active(product_active) -) type=bdb; +) engine=bdb; create table t5 ( product_file_id int auto_increment primary key, @@ -492,7 +492,7 @@ create table t5 unique product_file(product_id,file_name), index file_included(file_included) -) type=bdb; +) engine=bdb; create table t6 ( file_platform_id int auto_increment primary key, @@ -505,7 +505,7 @@ create table t6 archive_filename varchar(255) not null, unique file_platform(product_file_id,platform_id,branch_id) -) type=bdb; +) engine=bdb; create table t8 ( archive_id int auto_increment primary key, @@ -517,7 +517,7 @@ create table t8 unique archive(branch_id,target_id,platform_id,product_id), index status_id(status_id) -) type=bdb; +) engine=bdb; create table t7 ( build_id int auto_increment primary key, @@ -531,7 +531,7 @@ create table t7 build_path text not null, unique build(branch_id,target_id,build_number) -) type=bdb; +) engine=bdb; insert into t1 (branch_name) values ('RealMedia'); @@ -659,7 +659,7 @@ CREATE TABLE t1 ( a tinytext NOT NULL, b tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (a(32),b) -) TYPE=BDB; +) ENGINE=BDB; INSERT INTO t1 VALUES ('a',1),('a',2); SELECT * FROM t1 WHERE a='a' AND b=2; SELECT * FROM t1 WHERE a='a' AND b in (2); @@ -674,7 +674,7 @@ CREATE TABLE t1 ( a int3 unsigned NOT NULL, b int1 unsigned NOT NULL, UNIQUE (a, b) -) TYPE = BDB; +) ENGINE = BDB; INSERT INTO t1 VALUES (1, 1); SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; @@ -684,7 +684,7 @@ drop table t1; # Test problem with BDB and lock tables with duplicate write. # -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; --error 1062 @@ -694,7 +694,7 @@ select id from t1; UNLOCK TABLES; DROP TABLE t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; begin; @@ -711,8 +711,8 @@ DROP TABLE t1; # Test with empty tables (crashed with lock error) # -CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) TYPE=BerkeleyDB; -CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) TYPE=BerkeleyDB; +CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) ENGINE=BerkeleyDB; +CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) ENGINE=BerkeleyDB; select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; DROP TABLE t1,t2; @@ -721,7 +721,7 @@ DROP TABLE t1,t2; # Test problem with joining table to itself on a multi-part unique key # -create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; +create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) engine=bdb; insert into t1 values (1,1), (1,2); select * from t1 where a = 1; select t1.*, t2.* from t1, t1 t2 where t1.a = t2.a and t2.a = 1; @@ -732,9 +732,9 @@ drop table t1; # This caused a deadlock in BDB internal locks # -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; insert into t1 values (0,0,0,'ABCDEFGHIJ'); -create table t2 (id int NOT NULL,primary key (id)) type=bdb; +create table t2 (id int NOT NULL,primary key (id)) engine=bdb; LOCK TABLES t1 WRITE, t2 WRITE; insert into t2 values(1); SELECT t1.* FROM t1 WHERE id IN (1); @@ -746,7 +746,7 @@ drop table t1,t2; # Test problems with NULL # -CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) TYPE=BDB; +CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) ENGINE=BDB; INSERT INTO t1 VALUES ('00000000-e6c4ddeaa6-003b8-83458387','programs/xxxxxxxx.wmv','00000000-e6c4ddeb32-003bc-83458387'); SELECT * FROM t1 WHERE p='programs/xxxxxxxx.wmv'; drop table t1; @@ -755,7 +755,7 @@ drop table t1; # Test problem which gave error 'Can't find record in 't1'' # -CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) TYPE=BerkeleyDB; +CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) ENGINE=BerkeleyDB; select INFO_NOTE from t1 where STR_DATE = '20010610'; select INFO_NOTE from t1 where STR_DATE < '20010610'; select INFO_NOTE from t1 where STR_DATE > '20010610'; @@ -765,8 +765,8 @@ drop table t1; # Test problem with multi table delete which quickly shows up with bdb tables. # -create table t1 (a int not null, b int, primary key (a)) type =bdb; -create table t2 (a int not null, b int, primary key (a)) type =bdb; +create table t1 (a int not null, b int, primary key (a)) engine =bdb; +create table t2 (a int not null, b int, primary key (a)) engine =bdb; insert into t1 values (2, 3),(1, 7),(10, 7); insert into t2 values (2, 3),(1, 7),(10, 7); select * from t1; @@ -781,7 +781,7 @@ drop table t1,t2; # The bug #971 # -create table t1 (x int not null, index(x)) type=bdb; +create table t1 (x int not null, index(x)) engine=bdb; insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); select * from t1 where x <= 10 and x >= 7; select * from t1 where x <= 10 and x >= 7 order by x; diff --git a/mysql-test/t/bdb_cache.test b/mysql-test/t/bdb_cache.test index 0d7de75ccf6..0082c83faff 100644 --- a/mysql-test/t/bdb_cache.test +++ b/mysql-test/t/bdb_cache.test @@ -9,7 +9,7 @@ drop table if exists t1, t2, t3; --enable_warnings flush status; set autocommit=0; -create table t1 (a int not null) type=bdb; +create table t1 (a int not null) engine=bdb; insert into t1 values (1),(2),(3); select * from t1; show status like "Qcache_queries_in_cache"; @@ -17,15 +17,15 @@ drop table t1; commit; set autocommit=1; begin; -create table t1 (a int not null) type=bdb; +create table t1 (a int not null) engine=bdb; insert into t1 values (1),(2),(3); select * from t1; show status like "Qcache_queries_in_cache"; drop table t1; commit; -create table t1 (a int not null) type=bdb; -create table t2 (a int not null) type=bdb; -create table t3 (a int not null) type=bdb; +create table t1 (a int not null) engine=bdb; +create table t2 (a int not null) engine=bdb; +create table t3 (a int not null) engine=bdb; insert into t1 values (1),(2); insert into t2 values (1),(2); insert into t3 values (1),(2); diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 54166c3b0dc..32565c0e20b 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -18,7 +18,7 @@ insert into t1 values (""),(null); select * from t1; drop table t1; -create table t1 (a int not null auto_increment,primary key (a)) type=heap; +create table t1 (a int not null auto_increment,primary key (a)) engine=heap; drop table t1; # @@ -26,18 +26,18 @@ drop table t1; # --error 1146 -create table t2 type=heap select * from t1; +create table t2 engine=heap select * from t1; --error 1146 create table t2 select auto+1 from t1; drop table if exists t1,t2; --error 1167 create table t1 (b char(0) not null, index(b)); --error 1163 -create table t1 (a int not null,b text) type=heap; +create table t1 (a int not null,b text) engine=heap; drop table if exists t1; --error 1075 -create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap; +create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap; -- error 1044,1 create table not_existing_database.test (a int); diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 0457c204e32..90b423cd1e0 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -84,7 +84,7 @@ DROP TABLE t1; # Bug 1181 # CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word)) -TYPE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci; +ENGINE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci; INSERT INTO t1 (word) VALUES ("cat"); SELECT * FROM t1 WHERE word LIKE "c%"; SELECT * FROM t1 WHERE word LIKE "ca_"; @@ -126,7 +126,7 @@ CREATE TABLE t1 ( word VARCHAR(64), bar INT(11) default 0, PRIMARY KEY (word)) - TYPE=MyISAM + ENGINE=MyISAM CHARSET ucs2 COLLATE ucs2_general_ci ; @@ -149,7 +149,7 @@ DROP TABLE t1; CREATE TABLE t1 ( word VARCHAR(64) , PRIMARY KEY (word)) - TYPE=MyISAM + ENGINE=MyISAM CHARSET ucs2 COLLATE ucs2_general_ci; @@ -172,7 +172,7 @@ CREATE TABLE t1 ( word TEXT, bar INT(11) AUTO_INCREMENT, PRIMARY KEY (bar)) - TYPE=MyISAM + ENGINE=MyISAM CHARSET ucs2 COLLATE ucs2_general_ci ; INSERT INTO t1 (word) VALUES ("aar"); diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index c529994f31b..bd5d9e5c0d9 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -56,7 +56,7 @@ CREATE TABLE t1 ( not_null varchar(20) binary NOT NULL default '', misc integer not null, PRIMARY KEY (not_null) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7); diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 56c00e7501c..3c1f18b7524 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -223,7 +223,7 @@ drop table t1; # Test problem with DISTINCT and ORDER BY DESC # -create table t1 (a char(1), key(a)) type=myisam; +create table t1 (a char(1), key(a)) engine=myisam; insert into t1 values('1'),('1'); select * from t1 where a >= '1'; select distinct a from t1 order by a desc; @@ -257,9 +257,9 @@ drop table t1,t2; # test with table.* in DISTINCT # -CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM; +CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) ENGINE=MyISAM; INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0); -CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM; +CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) ENGINE=MyISAM; INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1); SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid); DROP TABLE t1,t2; @@ -279,7 +279,7 @@ DROP TABLE t1,t2; # Test of LEFT() with distinct # -CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM AUTO_INCREMENT=3 ; +CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=3 ; INSERT INTO t1 VALUES (1, 'aaaaa'); INSERT INTO t1 VALUES (3, 'aaaaa'); INSERT INTO t1 VALUES (2, 'eeeeeee'); @@ -327,7 +327,7 @@ CREATE TABLE t1 ( html varchar(5) default NULL, rin int(11) default '0', out int(11) default '0' -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('1',1,0); SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin; diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 38c09682bac..02ada3dc8cb 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -176,7 +176,7 @@ CREATE TABLE t1 ( title varchar(100) default '', PRIMARY KEY (id), KEY ind5 (title) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE FULLTEXT INDEX ft1 ON t1(title); insert into t1 (title) values ('this is a test'); @@ -191,7 +191,7 @@ drop table t1; # one more bug - const_table related -CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM; +CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) ENGINE=MyISAM; insert into t1 values (1,"I wonder why the fulltext index doesnt work?"); SELECT * from t1 where MATCH (b) AGAINST ('apples'); @@ -199,7 +199,7 @@ insert into t1 values (2,"fullaaa fullzzz"); select * from t1 where match b against ('full*' in boolean mode); drop table t1; -CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) TYPE=MyISAM; +CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),(4,'MySQL Tutorial'); select 8 from t1; drop table t1; diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test index a01ec3a59c9..cab1d096fe7 100644 --- a/mysql-test/t/fulltext2.test +++ b/mysql-test/t/fulltext2.test @@ -14,7 +14,7 @@ CREATE TABLE t1 ( i int(10) unsigned not null auto_increment primary key, a varchar(255) not null, FULLTEXT KEY (a) -) TYPE=MyISAM; +) ENGINE=MyISAM; # two-level entry, second-level tree with depth 2 --disable_query_log @@ -100,7 +100,7 @@ CREATE TABLE t1 ( i int(10) unsigned not null auto_increment primary key, a varchar(255) not null, FULLTEXT KEY (a) -) TYPE=MyISAM; +) ENGINE=MyISAM; # two-level entry, second-level tree with depth 2 --disable_query_log diff --git a/mysql-test/t/fulltext_distinct.test b/mysql-test/t/fulltext_distinct.test index 2ccfb94c819..1f4cb8cd7bc 100644 --- a/mysql-test/t/fulltext_distinct.test +++ b/mysql-test/t/fulltext_distinct.test @@ -15,14 +15,14 @@ CREATE TABLE t1 ( KEY kt(tag), KEY kv(value(15)), FULLTEXT KEY kvf(value) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE t2 ( id_t2 mediumint unsigned NOT NULL default '0', id_t1 mediumint unsigned NOT NULL default '0', field_number tinyint unsigned NOT NULL default '0', PRIMARY KEY (id_t2,id_t1,field_number), KEY id_t1(id_t1) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (tag,value) VALUES ('foo123','bar111'); INSERT INTO t1 (tag,value) VALUES ('foo123','bar222'); diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test index e3083ddc4e1..f8dcfb2aad6 100644 --- a/mysql-test/t/fulltext_left_join.test +++ b/mysql-test/t/fulltext_left_join.test @@ -35,9 +35,9 @@ drop table t1, t2; # Bug #484, reported by Stephen Brandon # -create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) type=myisam; +create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) engine=myisam; insert into t1 (venue_id, venue_text, dt) values (1, 'a1', '2003-05-23 19:30:00'),(null, 'a2', '2003-05-23 19:30:00'); -create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) type=myisam; +create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) engine=myisam; insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3); select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00'; select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00'; diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index 06ebb388517..79de99276a6 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -13,7 +13,7 @@ explain extended select uncompressed_length(compress(@test_compress_string))=len select uncompressed_length(compress(@test_compress_string)); select length(compress(@test_compress_string))",RPAD("",(55 - LENGTH(title)),".")) from t1; diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index 86e0ee2637b..1559fef7e6e 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -79,9 +79,9 @@ select _koi8r'a' LIKE _latin1'A'; # # Test for LEAST() BUG in LEFT JOIN # -CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) TYPE=MyISAM; +CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) ENGINE=MyISAM; INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','\r\n\r\n \r\n \r\n \r\n \r\n
 \r\n

How \r\n To: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected.

\r\n
','\r\n \r\n \r\n \r\n \r\n\r\n \r\n
  \r\n \r\n

1. Select \r\n the On/Setup button to access the DynaVox Setup Menu.
\r\n 2. Select Button Features.
\r\n 3. Below the OK button is the Usage Counts button.
\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.
\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.
\r\n c. Select the Usage Counts Option Ring once and it will toggle \r\n to the alternative option.
\r\n 4. Once the correct setting has been chosen, select OK to leave the Button \r\n Features menu.
\r\n 5. Select OK out of the Setup menu and return to the communication \r\n page.

\r\n

For \r\n further information on Usage Counts, see the Button Features \r\n Menu Entry in the DynaVox/DynaMyte Reference Manual.

\r\n
',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL); -CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) TYPE=MyISAM; +CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1); SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank; DROP TABLE t1,t2; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index f1a24a4c3cb..6f114fe18ae 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -151,7 +151,7 @@ drop table t1,t2; # # Test bug with month() and year() on text fields with wrong information -CREATE TABLE t1 (updated text) TYPE=MyISAM; +CREATE TABLE t1 (updated text) ENGINE=MyISAM; INSERT INTO t1 VALUES (''); SELECT month(updated) from t1; SELECT year(updated) from t1; diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index 0368ddb41cb..08ba8329b48 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -9,7 +9,7 @@ CREATE TABLE t1 ( fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, g GEOMETRY NOT NULL, SPATIAL KEY(g) -) TYPE=MyISAM; +) ENGINE=MyISAM; SHOW CREATE TABLE t1; @@ -31,7 +31,7 @@ DROP TABLE t1; CREATE TABLE t2 ( fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, g GEOMETRY NOT NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; let $1=10; while ($1) diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 705e32c82df..1e65bef19b7 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -352,7 +352,7 @@ CREATE TABLE t1 ( value int(11) unsigned NOT NULL default '0', UNIQUE KEY pid2 (pid,c1id,c2id), UNIQUE KEY pid (pid,value) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1, 1, NULL, 1),(1, 2, NULL, 2),(1, NULL, 3, 3),(1, 4, NULL, 4),(1, 5, NULL, 5); @@ -360,7 +360,7 @@ CREATE TABLE t2 ( id int(11) unsigned NOT NULL default '0', active enum('Yes','No') NOT NULL default 'Yes', PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (1, 'Yes'),(2, 'No'),(4, 'Yes'),(5, 'No'); diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test index 99ca858990c..d734882591a 100644 --- a/mysql-test/t/handler.test +++ b/mysql-test/t/handler.test @@ -80,7 +80,7 @@ insert into t1 values (17); --error 1109 handler t2 read first; handler t1 open as t2; -alter table t1 type=MyISAM; +alter table t1 engine=MyISAM; --error 1109 handler t2 read first; drop table t1; diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index 797472e7769..d867d5f4323 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -6,7 +6,7 @@ drop table if exists t1; --enable_warnings -create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; +create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; #show table status like "t1"; @@ -20,20 +20,20 @@ select * from t1; alter table t1 add c int not null, add key (c,a); drop table t1; -create table t1 (a int not null,b int not null, primary key (a)) type=memory comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key (a)) engine=memory comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a > 0; select * from t1; drop table t1; -create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); -alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table"; +alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table"; #show table status like "t1"; select * from t1; drop table t1; -create table t1 (a int not null) type=heap; +create table t1 (a int not null) engine=heap; insert into t1 values (869751),(736494),(226312),(802616); select * from t1 where a > 736494; alter table t1 add unique uniq_id(a); @@ -41,31 +41,31 @@ select * from t1 where a > 736494; select * from t1 where a = 736494; select * from t1 where a=869751 or a=736494; select * from t1 where a in (869751,736494,226312,802616); -alter table t1 type=myisam; +alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); drop table t1; create table t1 (x int not null, y int not null, key x (x), unique y (y)) -type=heap; +engine=heap; insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6); select * from t1 where x=1; select * from t1,t1 as t2 where t1.x=t2.y; explain select * from t1,t1 as t2 where t1.x=t2.y; drop table t1; -create table t1 (a int) type=heap; +create table t1 (a int) engine=heap; insert into t1 values(1); select max(a) from t1; drop table t1; -CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) TYPE=HEAP; +CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) ENGINE=HEAP; insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6); select * from t1 where a=1; insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6); select * from t1 where a=1; drop table t1; -create table t1 (id int unsigned not null, primary key (id)) type=HEAP; +create table t1 (id int unsigned not null, primary key (id)) engine=HEAP; insert into t1 values(1); select max(id) from t1; insert into t1 values(2); @@ -73,16 +73,16 @@ select max(id) from t1; replace into t1 values(1); drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table if exists t1; # Test of non unique index CREATE table t1(f1 int not null,f2 char(20) not -null,index(f2)) type=heap; +null,index(f2)) engine=heap; INSERT into t1 set f1=12,f2="bill"; INSERT into t1 set f1=13,f2="bill"; INSERT into t1 set f1=14,f2="bill"; @@ -100,7 +100,7 @@ drop table t1; # Test when using part key searches # -create table t1 (btn char(10) not null, key(btn)) type=heap; +create table t1 (btn char(10) not null, key(btn)) engine=heap; insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); explain select * from t1 where btn like "q%"; select * from t1 where btn like "q%"; @@ -119,7 +119,7 @@ CREATE TABLE t1 ( b int default NULL, KEY a (a), UNIQUE b (b) -) type=heap; +) engine=heap; INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); SELECT * FROM t1 WHERE a=NULL; explain SELECT * FROM t1 WHERE a IS NULL; @@ -135,7 +135,7 @@ DROP TABLE t1; CREATE TABLE t1 ( a int default NULL, key a (a) -) TYPE=HEAP; +) ENGINE=HEAP; INSERT INTO t1 VALUES (10), (10), (10); EXPLAIN SELECT * FROM t1 WHERE a=10; SELECT * FROM t1 WHERE a=10; @@ -145,7 +145,7 @@ DROP TABLE t1; # Test when deleting all rows # -CREATE TABLE t1 (a int not null, primary key(a)) type=heap; +CREATE TABLE t1 (a int not null, primary key(a)) engine=heap; INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11); DELETE from t1 where a < 100; SELECT * from t1; diff --git a/mysql-test/t/heap_auto_increment.test b/mysql-test/t/heap_auto_increment.test index 6f392f6830d..9d0fefa4d52 100644 --- a/mysql-test/t/heap_auto_increment.test +++ b/mysql-test/t/heap_auto_increment.test @@ -6,7 +6,7 @@ drop table if exists t1; --enable_warnings -create table t1 (a int not null auto_increment,b int, primary key (a)) type=heap auto_increment=3; +create table t1 (a int not null auto_increment,b int, primary key (a)) engine=heap auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; insert into t1 values (NULL,5),(NULL,6); @@ -25,7 +25,7 @@ drop table t1; create table t1 ( skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY, sval char(20) -) type=heap; +) engine=heap; insert into t1 values (NULL, "hello"); insert into t1 values (NULL, "hey"); select * from t1; diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test index 34aeeec0a11..a520065a8b3 100644 --- a/mysql-test/t/heap_btree.test +++ b/mysql-test/t/heap_btree.test @@ -6,7 +6,7 @@ drop table if exists t1; --enable_warnings -create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; +create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; #show table status like "t1"; @@ -20,20 +20,20 @@ select * from t1; alter table t1 add c int not null, add key using BTREE (c,a); drop table t1; -create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps"; insert into t1 values(-2,-2),(-1,-1),(0,0),(1,1),(2,2),(3,3),(4,4); delete from t1 where a > -3; select * from t1; drop table t1; -create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); -alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table"; +alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table"; #show table status like "t1"; select * from t1; drop table t1; -create table t1 (a int not null) type=heap; +create table t1 (a int not null) engine=heap; insert into t1 values (869751),(736494),(226312),(802616); select * from t1 where a > 736494; alter table t1 add unique uniq_id using BTREE (a); @@ -41,12 +41,12 @@ select * from t1 where a > 736494; select * from t1 where a = 736494; select * from t1 where a=869751 or a=736494; select * from t1 where a in (869751,736494,226312,802616); -alter table t1 type=myisam; +alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); drop table t1; create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y)) -type=heap; +engine=heap; insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6); explain select * from t1 where x=1; select * from t1 where x=1; @@ -54,12 +54,12 @@ select * from t1,t1 as t2 where t1.x=t2.y; explain select * from t1,t1 as t2 where t1.x=t2.y; drop table t1; -create table t1 (a int) type=heap; +create table t1 (a int) engine=heap; insert into t1 values(1); select max(a) from t1; drop table t1; -CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) TYPE=HEAP; +CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) ENGINE=HEAP; insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6); select * from t1 where a=1; insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6); @@ -73,7 +73,7 @@ select * from t1 where b=1; explain select * from t1 where b=1; drop table t1; -create table t1 (id int unsigned not null, primary key using BTREE (id)) type=HEAP; +create table t1 (id int unsigned not null, primary key using BTREE (id)) engine=HEAP; insert into t1 values(1); select max(id) from t1; insert into t1 values(2); @@ -81,16 +81,16 @@ select max(id) from t1; replace into t1 values(1); drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table if exists t1; # Test of non unique index CREATE table t1(f1 int not null,f2 char(20) not -null,index(f2)) type=heap; +null,index(f2)) engine=heap; INSERT into t1 set f1=12,f2="bill"; INSERT into t1 set f1=13,f2="bill"; INSERT into t1 set f1=14,f2="bill"; @@ -108,7 +108,7 @@ drop table t1; # Test when using part key searches # -create table t1 (btn char(10) not null, key using BTREE (btn)) type=heap; +create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap; insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); explain select * from t1 where btn like "q%"; select * from t1 where btn like "q%"; @@ -127,7 +127,7 @@ CREATE TABLE t1 ( b int default NULL, KEY a using BTREE (a), UNIQUE b using BTREE (b) -) type=heap; +) engine=heap; INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); SELECT * FROM t1 WHERE a=NULL; explain SELECT * FROM t1 WHERE a IS NULL; @@ -140,7 +140,7 @@ SELECT * FROM t1 WHERE b<=>NULL; INSERT INTO t1 VALUES (1,3); DROP TABLE t1; -CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) type=heap; +CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap; INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1); SELECT * FROM t1 WHERE a=1 and b IS NULL; SELECT * FROM t1 WHERE a=1 and c IS NULL; @@ -151,7 +151,7 @@ DROP TABLE t1; # Test when deleting all rows # -CREATE TABLE t1 (a int not null, primary key using BTREE (a)) type=heap; +CREATE TABLE t1 (a int not null, primary key using BTREE (a)) engine=heap; INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11); DELETE from t1 where a < 100; SELECT * from t1; diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test index f339a10efc6..412b6f2e705 100644 --- a/mysql-test/t/heap_hash.test +++ b/mysql-test/t/heap_hash.test @@ -6,7 +6,7 @@ drop table if exists t1; --enable_warnings -create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; +create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; #show table status like "t1"; @@ -20,20 +20,20 @@ select * from t1; alter table t1 add c int not null, add key using HASH (c,a); drop table t1; -create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a > 0; select * from t1; drop table t1; -create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps"; +create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); -alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table"; +alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table"; #show table status like "t1"; select * from t1; drop table t1; -create table t1 (a int not null) type=heap; +create table t1 (a int not null) engine=heap; insert into t1 values (869751),(736494),(226312),(802616); select * from t1 where a > 736494; alter table t1 add unique uniq_id using HASH (a); @@ -41,31 +41,31 @@ select * from t1 where a > 736494; select * from t1 where a = 736494; select * from t1 where a=869751 or a=736494; select * from t1 where a in (869751,736494,226312,802616); -alter table t1 type=myisam; +alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); drop table t1; create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y)) -type=heap; +engine=heap; insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6); select * from t1 where x=1; select * from t1,t1 as t2 where t1.x=t2.y; explain select * from t1,t1 as t2 where t1.x=t2.y; drop table t1; -create table t1 (a int) type=heap; +create table t1 (a int) engine=heap; insert into t1 values(1); select max(a) from t1; drop table t1; -CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) TYPE=HEAP; +CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) ENGINE=HEAP; insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6); select * from t1 where a=1; insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6); select * from t1 where a=1; drop table t1; -create table t1 (id int unsigned not null, primary key using HASH (id)) type=HEAP; +create table t1 (id int unsigned not null, primary key using HASH (id)) engine=HEAP; insert into t1 values(1); select max(id) from t1; insert into t1 values(2); @@ -73,16 +73,16 @@ select max(id) from t1; replace into t1 values(1); drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table t1; -create table t1 (n int) type=heap; +create table t1 (n int) engine=heap; drop table if exists t1; # Test of non unique index CREATE table t1(f1 int not null,f2 char(20) not -null,index(f2)) type=heap; +null,index(f2)) engine=heap; INSERT into t1 set f1=12,f2="bill"; INSERT into t1 set f1=13,f2="bill"; INSERT into t1 set f1=14,f2="bill"; @@ -100,7 +100,7 @@ drop table t1; # Test when using part key searches # -create table t1 (btn char(10) not null, key using HASH (btn)) type=heap; +create table t1 (btn char(10) not null, key using HASH (btn)) engine=heap; insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); explain select * from t1 where btn like "q%"; select * from t1 where btn like "q%"; @@ -119,7 +119,7 @@ CREATE TABLE t1 ( b int default NULL, KEY a using HASH (a), UNIQUE b using HASH (b) -) type=heap; +) engine=heap; INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); SELECT * FROM t1 WHERE a=NULL; explain SELECT * FROM t1 WHERE a IS NULL; @@ -136,7 +136,7 @@ DROP TABLE t1; # Test when deleting all rows # -CREATE TABLE t1 (a int not null, primary key using HASH (a)) type=heap; +CREATE TABLE t1 (a int not null, primary key using HASH (a)) engine=heap; INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11); DELETE from t1 where a < 100; SELECT * from t1; diff --git a/mysql-test/t/help.test b/mysql-test/t/help.test index 82312340336..54c551ccd7a 100644 --- a/mysql-test/t/help.test +++ b/mysql-test/t/help.test @@ -65,10 +65,10 @@ help 'impossible_function_1'; help 'impossible_category_1'; ############## -alter table mysql.help_relation type=innodb; -alter table mysql.help_keyword type=innodb; -alter table mysql.help_topic type=innodb; -alter table mysql.help_category type=innodb; +alter table mysql.help_relation engine=innodb; +alter table mysql.help_keyword engine=innodb; +alter table mysql.help_topic engine=innodb; +alter table mysql.help_category engine=innodb; ############## help 'function_of_my_dream'; @@ -90,10 +90,10 @@ help 'impossible_function_1'; help 'impossible_category_1'; ############## -alter table mysql.help_relation type=myisam; -alter table mysql.help_keyword type=myisam; -alter table mysql.help_topic type=myisam; -alter table mysql.help_category type=myisam; +alter table mysql.help_relation engine=myisam; +alter table mysql.help_keyword engine=myisam; +alter table mysql.help_topic engine=myisam; +alter table mysql.help_category engine=myisam; delete from mysql.help_topic where help_topic_id=@topic1_id; delete from mysql.help_topic where help_topic_id=@topic2_id; diff --git a/mysql-test/t/innodb-deadlock.test b/mysql-test/t/innodb-deadlock.test index ba4ec4a9ae4..8a36982b0c1 100644 --- a/mysql-test/t/innodb-deadlock.test +++ b/mysql-test/t/innodb-deadlock.test @@ -12,7 +12,7 @@ drop table if exists t1,t2; # connection con1; -create table t1 (id integer, x integer) type=INNODB; +create table t1 (id integer, x integer) engine=INNODB; insert into t1 values(0, 0); set autocommit=0; SELECT * from t1 where id = 0 FOR UPDATE; @@ -44,8 +44,8 @@ drop table t1; # connection con1; -create table t1 (id integer, x integer) type=INNODB; -create table t2 (b integer, a integer) type=INNODB; +create table t1 (id integer, x integer) engine=INNODB; +create table t2 (b integer, a integer) engine=INNODB; insert into t1 values(0, 0), (300, 300); insert into t2 values(0, 10), (1, 20), (2, 30); commit; @@ -77,8 +77,8 @@ select * from t1; commit; drop table t1, t2; -create table t1 (id integer, x integer) type=INNODB; -create table t2 (b integer, a integer) type=INNODB; +create table t1 (id integer, x integer) engine=INNODB; +create table t2 (b integer, a integer) engine=INNODB; insert into t1 values(0, 0), (300, 300); insert into t2 values(0, 0), (1, 20), (2, 30); commit; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 3349ea21c45..6f7a0e100c3 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -9,7 +9,7 @@ drop table if exists t1,t2,t3,t4; drop database if exists mysqltest; --enable_warnings -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb; +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); select id, code, name from t1 order by id; @@ -34,7 +34,7 @@ CREATE TABLE t1 ( PRIMARY KEY (id), KEY parent_id (parent_id), KEY level (level) -) type=innodb; +) engine=innodb; INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); update t1 set parent_id=parent_id+100; select * from t1 where parent_id=102; @@ -67,7 +67,7 @@ CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (gesuchnr,benutzer_id) -) type=innodb; +) engine=innodb; replace into t1 (gesuchnr,benutzer_id) values (2,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); @@ -79,7 +79,7 @@ drop table t1; # test delete using hidden_primary_key # -create table t1 (a int) type=innodb; +create table t1 (a int) engine=innodb; insert into t1 values (1), (2); optimize table t1; delete from t1 where a = 1; @@ -87,7 +87,7 @@ select * from t1; check table t1; drop table t1; -create table t1 (a int,b varchar(20)) type=innodb; +create table t1 (a int,b varchar(20)) engine=innodb; insert into t1 values (1,""), (2,"testing"); delete from t1 where a = 1; select * from t1; @@ -101,7 +101,7 @@ drop table t1; # Test of reading on secondary key with may be null -create table t1 (a int,b varchar(20),key(a)) type=innodb; +create table t1 (a int,b varchar(20),key(a)) engine=innodb; insert into t1 values (1,""), (2,"testing"); select * from t1 where a = 1; drop table t1; @@ -110,7 +110,7 @@ drop table t1; # Test rollback # -create table t1 (n int not null primary key) type=innodb; +create table t1 (n int not null primary key) engine=innodb; set autocommit=0; insert into t1 values (4); rollback; @@ -137,7 +137,7 @@ drop table t1; # Test for commit and FLUSH TABLES WITH READ LOCK # -create table t1 (n int not null primary key) type=innodb; +create table t1 (n int not null primary key) engine=innodb; start transaction; insert into t1 values (4); flush tables with read lock; @@ -154,7 +154,7 @@ drop table t1; # Testing transactions # -create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=innodb; +create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb; begin; insert into t1 values(1,'hamdouni'); select id as afterbegin_id,nom as afterbegin_nom from t1; @@ -172,7 +172,7 @@ drop table t1; # Simple not autocommit test # -CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=innodb; +CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb; insert into t1 values ('pippo', 12); -- error 1062 insert into t1 values ('pippo', 12); # Gives error @@ -194,10 +194,10 @@ drop table t1; # Test of active transactions # -create table t1 (a integer) type=innodb; +create table t1 (a integer) engine=innodb; start transaction; rename table t1 to t2; -create table t1 (b integer) type=innodb; +create table t1 (b integer) engine=innodb; insert into t1 values (1); rollback; drop table t1; @@ -209,12 +209,12 @@ set autocommit=1; # The following simple tests failed at some point # -CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=innodb; +CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb; INSERT INTO t1 VALUES (1, 'Jochen'); select * from t1; drop table t1; -CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=innodb; +CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb; set autocommit=0; INSERT INTO t1 SET _userid='marc@anyware.co.uk'; COMMIT; @@ -233,7 +233,7 @@ CREATE TABLE t1 ( ref_email varchar(100) DEFAULT '' NOT NULL, detail varchar(200), PRIMARY KEY (user_id,ref_email) -)type=innodb; +)engine=innodb; INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); select * from t1 where user_id=10292; @@ -259,7 +259,7 @@ drop table t1; # create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); -alter table t1 type=innodb; +alter table t1 engine=innodb; insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); select * from t1; update t1 set col2='7' where col1='4'; @@ -274,8 +274,8 @@ drop table t1; # INSERT INTO innodb tables # -create table t1 (a int not null , b int, primary key (a)) type = innodb; -create table t2 (a int not null , b int, primary key (a)) type = myisam; +create table t1 (a int not null , b int, primary key (a)) engine = innodb; +create table t2 (a int not null , b int, primary key (a)) engine = myisam; insert into t1 VALUES (1,3) , (2,3), (3,3); select * from t1; insert into t2 select * from t1; @@ -298,7 +298,7 @@ CREATE TABLE t1 ( passwd varchar(32) binary DEFAULT '' NOT NULL, PRIMARY KEY (id), UNIQUE ggid (ggid) -) TYPE=innodb; +) ENGINE=innodb; insert into t1 (ggid,passwd) values ('test1','xxx'); insert into t1 (ggid,passwd) values ('test2','yyy'); @@ -336,7 +336,7 @@ CREATE TABLE t1 ( approved datetime, dummy_primary_key int(11) NOT NULL auto_increment, PRIMARY KEY (dummy_primary_key) -) TYPE=innodb; +) ENGINE=innodb; INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); @@ -356,7 +356,7 @@ CREATE TABLE t1 ( KEY (id), KEY parent_id (parent_id), KEY level (level) -) type=innodb; +) engine=innodb; INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); INSERT INTO t1 values (179,5,2); update t1 set parent_id=parent_id+100; @@ -390,7 +390,7 @@ CREATE TABLE t1 ( sca_sch_desc varchar(16), PRIMARY KEY (sca_code, cat_code, lan_code), INDEX sca_pic (sca_pic) -) type = innodb ; +) engine = innodb ; INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); select count(*) from t1 where sca_code = 'PD'; @@ -412,7 +412,7 @@ drop table t1; # Test of opening table twice and timestamps # set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=innodb; +CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb; insert into t1 (a) values(1),(2),(3); select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; update t1 set a=5 where a=1; @@ -422,7 +422,7 @@ drop table t1; # # Test with variable length primary key # -create table t1 (a varchar(100) not null, primary key(a), b int not null) type=innodb; +create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb; insert into t1 values("hello",1),("world",2); select * from t1 order by b desc; optimize table t1; @@ -433,7 +433,7 @@ drop table t1; # # Test of create index with NULL columns # -create table t1 (i int, j int ) TYPE=innodb; +create table t1 (i int, j int ) ENGINE=innodb; insert into t1 values (1,2); select * from t1 where i=1 and j=2; create index ax1 on t1 (i,j); @@ -448,7 +448,7 @@ CREATE TABLE t1 ( a int3 unsigned NOT NULL, b int1 unsigned NOT NULL, UNIQUE (a, b) -) TYPE = innodb; +) ENGINE = innodb; INSERT INTO t1 VALUES (1, 1); SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; @@ -458,7 +458,7 @@ drop table t1; # Test INSERT DELAYED # -CREATE TABLE t1 (a int unsigned NOT NULL) type=innodb; +CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb; # Can't test this in 3.23 # INSERT DELAYED INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); @@ -470,7 +470,7 @@ DROP TABLE t1; # Crash when using many tables (Test case by Jeremy D Zawodny) # -create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb; +create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb; insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); --replace_column 9 # explain select * from t1 where a > 0 and a < 50; @@ -480,7 +480,7 @@ drop table t1; # Test lock tables # -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; --error 1062 @@ -490,7 +490,7 @@ select id from t1; UNLOCK TABLES; DROP TABLE t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; begin; @@ -506,9 +506,9 @@ DROP TABLE t1; # # Test prefix key # -create table t1 (a char(20), unique (a(5))) type=innodb; +create table t1 (a char(20), unique (a(5))) engine=innodb; drop table t1; -create table t1 (a char(20), index (a(5))) type=innodb; +create table t1 (a char(20), index (a(5))) engine=innodb; show create table t1; drop table t1; @@ -516,7 +516,7 @@ drop table t1; # Test using temporary table and auto_increment # -create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb; +create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb; insert into t1 values (NULL),(NULL),(NULL); delete from t1 where a=3; insert into t1 values (NULL); @@ -533,7 +533,7 @@ create table t1 value text not null, uid int not null, unique key(name,uid) - ) type=innodb; + ) engine=innodb; insert into t1 values (1,'one','one value',101), (2,'two','two value',102),(3,'three','three value',103); set insert_id=5; @@ -551,11 +551,11 @@ drop table t1; # create database mysqltest; -create table mysqltest.t1 (a int not null) type= innodb; +create table mysqltest.t1 (a int not null) engine= innodb; insert into mysqltest.t1 values(1); -create table mysqltest.t2 (a int not null) type= myisam; +create table mysqltest.t2 (a int not null) engine= myisam; insert into mysqltest.t2 values(1); -create table mysqltest.t3 (a int not null) type= heap; +create table mysqltest.t3 (a int not null) engine= heap; insert into mysqltest.t3 values(1); commit; drop database mysqltest; @@ -568,7 +568,7 @@ show tables from mysqltest; # set autocommit=0; -create table t1 (a int not null) type= innodb; +create table t1 (a int not null) engine= innodb; insert into t1 values(1),(2); --error 1192 truncate table t1; @@ -582,7 +582,7 @@ commit; drop table t1; set autocommit=1; -create table t1 (a int not null) type= innodb; +create table t1 (a int not null) engine= innodb; insert into t1 values(1),(2); truncate table t1; insert into t1 values(1),(2); @@ -597,7 +597,7 @@ drop table t1; # Test of how ORDER BY works when doing it on the whole table # -create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb; +create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb; insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); --replace_column 9 # explain select * from t1 order by a; @@ -621,7 +621,7 @@ drop table t1; # Check describe # -create table t1 (t int not null default 1, key (t)) type=innodb; +create table t1 (t int not null default 1, key (t)) engine=innodb; desc t1; drop table t1; @@ -641,7 +641,7 @@ CREATE TABLE t1 ( version smallint(6) NOT NULL default '0', assigned_scps int(11) default '0', status tinyint(4) default '0' -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1); INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0); INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1); @@ -660,7 +660,7 @@ CREATE TABLE t2 ( version smallint(6) NOT NULL default '0', assigned_scps int(11) default '0', status tinyint(4) default '0' -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1); INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0); INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1); @@ -679,7 +679,7 @@ drop table t1,t2; # this works. # -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb; +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; BEGIN; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; @@ -704,8 +704,8 @@ DROP TABLE t1; # # Test of multi-table-update # -create table t1 (n int(10), d int(10)) type=innodb; -create table t2 (n int(10), d int(10)) type=innodb; +create table t1 (n int(10), d int(10)) engine=innodb; +create table t2 (n int(10), d int(10)) engine=innodb; insert into t1 values(1,1),(1,2); insert into t2 values(1,10),(2,20); UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; @@ -716,7 +716,7 @@ drop table t1,t2; # # Testing of IFNULL # -create table t1 (a int, b int) type=innodb; +create table t1 (a int, b int) engine=innodb; insert into t1 values(20,null); select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on t2.b=t3.a; @@ -731,12 +731,12 @@ drop table t1; # Test of read_through not existing const_table # -create table t1 (a varchar(10) not null) type=myisam; -create table t2 (b varchar(10) not null unique) type=innodb; +create table t1 (a varchar(10) not null) engine=myisam; +create table t2 (b varchar(10) not null unique) engine=innodb; select t1.a from t1,t2 where t1.a=t2.b; drop table t1,t2; -create table t1 (a int not null, b int, primary key (a)) type = innodb; -create table t2 (a int not null, b int, primary key (a)) type = innodb; +create table t1 (a int not null, b int, primary key (a)) engine = innodb; +create table t2 (a int not null, b int, primary key (a)) engine = innodb; insert into t1 values (10, 20); insert into t2 values (10, 20); update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10; @@ -746,8 +746,8 @@ drop table t1,t2; # Test of multi-table-delete with foreign key constraints # -CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB; -CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) TYPE=INNODB; +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB; insert into t1 set id=1; insert into t2 set id=1, t1_id=1; delete t1,t2 from t1,t2 where t1.id=t2.t1_id; @@ -755,8 +755,8 @@ select * from t1; select * from t2; drop table t1,t2; DROP TABLE IF EXISTS t1,t2; -CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB; -CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) TYPE=INNODB; +CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB; INSERT INTO t1 VALUES(1); INSERT INTO t2 VALUES(1, 1); SELECT * from t1; @@ -772,11 +772,11 @@ DROP TABLE t1,t2; set autocommit=0; -CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB; +CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; -CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB; +CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; -CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) TYPE=InnoDB; +CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB; INSERT INTO t3 VALUES("my-test-1", "my-test-2"); COMMIT; @@ -802,7 +802,7 @@ DROP TABLE t1,t2,t3; # Check update with conflicting key # -CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) type=innodb; +CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb; INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); # We need the a < 1000 test here to quard against the halloween problems UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; @@ -813,8 +813,8 @@ drop table t1; # Test multi update with different join methods # -CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) type=innodb; -CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) type=innodb; +CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; +CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); @@ -836,15 +836,15 @@ select * from t1; select * from t2; drop table t1,t2; -CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) TYPE=MyISAM; -CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) TYPE=InnoDB; +CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=0; INSERT INTO t1 ( B_ID ) VALUES ( 1 ); INSERT INTO t2 ( NEXT_T ) VALUES ( 1 ); ROLLBACK; SELECT * FROM t1; drop table t1,t2; -create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) type = innodb; +create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb; insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2); select distinct parent,child from t1 order by parent; drop table t1; @@ -852,7 +852,7 @@ drop table t1; # # Test that MySQL priorities clustered indexes # -create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) type=innodb; +create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb; create table t2 (a int not null auto_increment primary key, b int); insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null); insert into t2 (a) select b from t1; @@ -885,7 +885,7 @@ drop table t1,t2; # Test of UPDATE ... ORDER BY # -create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) type=innodb; +create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; insert into t1 (id) values (null),(null),(null),(null),(null); update t1 set fk=69 where fk is null order by id limit 1; @@ -903,9 +903,9 @@ select * from t1 order by a,b; drop table t1; -CREATE TABLE t1 (col1 int(1))TYPE=InnoDB; +CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB; CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx -(stamp))TYPE=InnoDB; +(stamp))ENGINE=InnoDB; insert into t1 values (1),(2),(3); insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ); SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp < @@ -925,7 +925,7 @@ CREATE TABLE t1 ( PRIMARY KEY (`id`), KEY `id_object` (`id_object`), KEY `id_version` (`id_version`) -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL); @@ -934,7 +934,7 @@ CREATE TABLE t2 ( `id_version` int(10) unsigned NOT NULL default '1', PRIMARY KEY (`id`), KEY `id_version` (`id_version`) -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9"); @@ -946,7 +946,7 @@ drop table t1,t2; # # Bug #1078 # -create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) type=innodb; +create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb; select * from t1; --error 1031 replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12"); @@ -956,9 +956,9 @@ replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text select * from t1; drop table t1; -create table t1 (a int, b varchar(200), c text not null) checksum=1 type=myisam; -create table t2 (a int, b varchar(200), c text not null) checksum=0 type=innodb; -create table t3 (a int, b varchar(200), c text not null) checksum=1 type=innodb; +create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam; +create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb; +create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb; insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); insert t2 select * from t1; insert t3 select * from t1; diff --git a/mysql-test/t/innodb_cache.test b/mysql-test/t/innodb_cache.test index 8a08c19703d..8568fce7d97 100644 --- a/mysql-test/t/innodb_cache.test +++ b/mysql-test/t/innodb_cache.test @@ -11,7 +11,7 @@ drop table if exists t1,t2,t3; # flush status; set autocommit=0; -create table t1 (a int not null) type=innodb; +create table t1 (a int not null) engine=innodb; insert into t1 values (1),(2),(3); select * from t1; show status like "Qcache_queries_in_cache"; @@ -19,15 +19,15 @@ drop table t1; commit; set autocommit=1; begin; -create table t1 (a int not null) type=innodb; +create table t1 (a int not null) engine=innodb; insert into t1 values (1),(2),(3); select * from t1; show status like "Qcache_queries_in_cache"; drop table t1; commit; -create table t1 (a int not null) type=innodb; -create table t2 (a int not null) type=innodb; -create table t3 (a int not null) type=innodb; +create table t1 (a int not null) engine=innodb; +create table t2 (a int not null) engine=innodb; +create table t3 (a int not null) engine=innodb; insert into t1 values (1),(2); insert into t2 values (1),(2); insert into t3 values (1),(2); @@ -54,7 +54,7 @@ commit; show status like "Qcache_queries_in_cache"; drop table if exists t1; -CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB; +CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB; select count(*) from t1; insert into t1 (id) values (0); select count(*) from t1; diff --git a/mysql-test/t/innodb_handler.test b/mysql-test/t/innodb_handler.test index cf6ac9870ce..e8c486caf66 100644 --- a/mysql-test/t/innodb_handler.test +++ b/mysql-test/t/innodb_handler.test @@ -8,7 +8,7 @@ drop table if exists t1,t2; --enable_warnings -create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb; +create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb; insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), (14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"), @@ -71,12 +71,12 @@ handler t2 close; handler t1 open as t2; handler t2 read first; -alter table t1 type=innodb; +alter table t1 engine=innodb; --error 1109 handler t2 read first; drop table t1; -CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) TYPE=InnoDB; +CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2); HANDLER t1 OPEN; HANDLER t1 READ `primary` = (1, 1000); diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 4effed9b6de..e39e470cf31 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -35,7 +35,7 @@ CREATE TABLE `t1` ( KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE `t2` ( `numeropost` bigint(20) unsigned NOT NULL default '0', @@ -51,7 +51,7 @@ CREATE TABLE `t2` ( KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES diff --git a/mysql-test/t/isam.test b/mysql-test/t/isam.test index e35ed0dfd4a..f77d29fd20f 100644 --- a/mysql-test/t/isam.test +++ b/mysql-test/t/isam.test @@ -8,7 +8,7 @@ drop table if exists t1,t2; # Test possible problem with rows that are about 65535 bytes long # -create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) type=isam; +create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) engine=isam; let $1=100; disable_query_log; @@ -28,7 +28,7 @@ drop table t1; # Test of auto_increment; The test for BDB tables is in bdb.test # -create table t1 (a int not null auto_increment,b int, primary key (a)) type=isam; +create table t1 (a int not null auto_increment,b int, primary key (a)) engine=isam; insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4); delete from t1 where a=4 or a=2; insert into t1 values (NULL,4),(NULL,5),(6,6); @@ -46,13 +46,13 @@ drop table t1; # Test of some CREATE TABLE's that should fail # --error 1121 -create table t1 (a int,b text, index(a)) type=isam; +create table t1 (a int,b text, index(a)) engine=isam; --error 1073 -create table t1 (a int,b text, index(b)) type=isam; +create table t1 (a int,b text, index(b)) engine=isam; --error 1075 -create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam; +create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=isam; --error 1121 -create table t1 (ordid int(8), unique (ordid)) type=isam; +create table t1 (ordid int(8), unique (ordid)) engine=isam; drop table if exists t1; # @@ -61,7 +61,7 @@ drop table if exists t1; create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); -create table t2 type=isam select * from t1; +create table t2 engine=isam select * from t1; optimize table t1; check table t1,t2; repair table t1,t2; diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 8cef925cc24..bba5cdeee58 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -126,13 +126,13 @@ CREATE TABLE t1 ( a int(11) NOT NULL, b int(11) NOT NULL, PRIMARY KEY (a,b) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3); CREATE TABLE t2 ( a int(11) default NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (2),(3); SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AND b<=3; DROP TABLE t1, t2; @@ -235,13 +235,13 @@ CREATE TABLE t1 ( max_value double default NULL, t3_id int(11) default NULL, item_id int(11) default NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (12,5,'Percent','Cost',-1,0,-1,-1),(14,4,'Percent','Cost',-1,0,-1,-1),(18,5,'Percent','Cost',-1,0,-1,-1),(19,4,'Percent','Cost',-1,0,-1,-1),(20,5,'Percent','Cost',100,-1,22,291),(21,5,'Percent','Cost',100,-1,18,291),(22,1,'Percent','Cost',100,-1,6,291),(23,1,'Percent','Cost',100,-1,21,291),(24,1,'Percent','Cost',100,-1,9,291),(25,1,'Percent','Cost',100,-1,4,291),(26,1,'Percent','Cost',100,-1,20,291),(27,4,'Percent','Cost',100,-1,7,202),(28,1,'Percent','Cost',50,-1,-1,137),(29,2,'Percent','Cost',100,-1,4,354),(30,2,'Percent','Cost',100,-1,9,137),(93,2,'Cost','Cost',-1,10000000,-1,-1); CREATE TABLE t2 ( id int(10) unsigned NOT NULL auto_increment, name varchar(255) default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5'); select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2; drop table t1,t2; @@ -256,7 +256,7 @@ CREATE TABLE t1 ( rate_code varchar(10) default NULL, UNIQUE KEY site_emp (siteid,emp_id), KEY siteid (siteid) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust'); CREATE TABLE t2 ( siteid varchar(25) NOT NULL default '', @@ -264,7 +264,7 @@ CREATE TABLE t2 ( base_rate float NOT NULL default '0', PRIMARY KEY (siteid,rate_code), FULLTEXT KEY rate_code (rate_code) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES ('rivercats','cust',20); SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats'; SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith'; diff --git a/mysql-test/t/join_crash.test b/mysql-test/t/join_crash.test index ada6e56e664..2d2222ad67a 100644 --- a/mysql-test/t/join_crash.test +++ b/mysql-test/t/join_crash.test @@ -17,7 +17,7 @@ CREATE TABLE t1 ( comments mediumtext, PRIMARY KEY (project_id), UNIQUE KEY project (client_ptr,project_name) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; INSERT INTO t1 VALUES (1,0,'Rejected Time',1,NULL,NULL,NULL,NULL); INSERT INTO t1 VALUES (209,0,'MDGRAD Proposal/Investigation',97,NULL,NULL,NULL,''); @@ -40,7 +40,7 @@ CREATE TABLE t2 ( PRIMARY KEY (period_id), KEY period_index (period_type,period_key), KEY date_index (start_date,end_date) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; INSERT INTO t2 VALUES (1,'user_table',98,'2000-01-01 00:00:00',NULL,NULL); INSERT INTO t2 VALUES (2,'user_table',99,'2000-01-01 00:00:00',NULL,NULL); @@ -68,7 +68,7 @@ CREATE TABLE t3 ( adjustment float(10,2) default NULL, PRIMARY KEY (budget_id), UNIQUE KEY po (project_ptr,po_number) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; CREATE TABLE t4 ( client_id int(11) NOT NULL auto_increment, @@ -78,7 +78,7 @@ CREATE TABLE t4 ( comments mediumtext, PRIMARY KEY (client_id), UNIQUE KEY client_name (client_name) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; INSERT INTO t4 VALUES (1,0,'CPS',NULL,NULL); diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index a63defff540..d048208a8ff 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -10,7 +10,7 @@ CREATE TABLE t1 ( grp int(11) default NULL, a bigint(20) unsigned default NULL, c char(10) NOT NULL default '' -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,''); create table t2 (id int, a bigint unsigned not null, c char(10), d int, primary key (a)); insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7); diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test index 3b4cd7358cc..109cbb91e2f 100644 --- a/mysql-test/t/key.test +++ b/mysql-test/t/key.test @@ -158,7 +158,7 @@ CREATE TABLE t1 ( a tinytext NOT NULL, b tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (a(32),b) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('a',1),('a',2); SELECT * FROM t1 WHERE a='a' AND b=2; SELECT * FROM t1 WHERE a='a' AND b in (2); diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test index 0868cf2c4b1..69c453bf60a 100644 --- a/mysql-test/t/lock.test +++ b/mysql-test/t/lock.test @@ -5,7 +5,7 @@ --disable_warnings drop table if exists t1,t2; --enable_warnings -CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) TYPE=MyISAM; +CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) ENGINE=MyISAM; insert into t1 (id,id2) values (1,1),(1,2),(1,3); LOCK TABLE t1 WRITE; select dummy1,count(distinct id) from t1 group by dummy1; @@ -33,12 +33,12 @@ CREATE TABLE t1 ( index1 smallint(6) default NULL, nr smallint(6) default NULL, KEY index1(index1) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE t2 ( nr smallint(6) default NULL, name varchar(20) default NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'item1'); INSERT INTO t2 VALUES (2,'item2'); diff --git a/mysql-test/t/lock_tables_lost_commit.test b/mysql-test/t/lock_tables_lost_commit.test index d8301017801..22b666cbc86 100644 --- a/mysql-test/t/lock_tables_lost_commit.test +++ b/mysql-test/t/lock_tables_lost_commit.test @@ -6,7 +6,7 @@ connect (con2,localhost,root,,); connection con1; --disable_warnings drop table if exists t1; -create table t1(a int) type=innodb; +create table t1(a int) engine=innodb; --enable_warnings lock tables t1 write; insert into t1 values(10); diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index c3bffa4f2fb..1f61e200613 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -11,7 +11,7 @@ create table t1 (a int not null primary key auto_increment, message char(20)); create table t2 (a int not null primary key auto_increment, message char(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2"); -create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(t1,t2); +create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(t1,t2); select * from t3; select * from t3 order by a desc; drop table t3; @@ -26,7 +26,7 @@ insert into t2 select NULL,message from t1; insert into t1 select NULL,message from t2; insert into t2 select NULL,message from t1; insert into t1 select NULL,message from t2; -create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2); +create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,test.t2); explain select * from t3 where a < 10; explain select * from t3 where a > 10 and a < 20; select * from t3 where a = 10; @@ -46,7 +46,7 @@ select * from t3 where a < 10; show create table t3; # The following should give errors -create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2); +create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2); --error 1016 select * from t4; --error 1016 @@ -57,18 +57,18 @@ alter table t4 add column c int; # create database mysqltest; create table mysqltest.t6 (a int not null primary key auto_increment, message char(20)); -create table t5 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,mysqltest.t6); +create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6); show create table t5; -alter table t5 type=myisam; +alter table t5 engine=myisam; drop table t5, mysqltest.t6; drop database mysqltest; # Because of windows, it's important that we drop the merge tables first! drop table t4,t3,t1,t2; -create table t1 (c char(10)) type=myisam; -create table t2 (c char(10)) type=myisam; -create table t3 (c char(10)) union=(t1,t2) type=merge; +create table t1 (c char(10)) engine=myisam; +create table t2 (c char(10)) engine=myisam; +create table t3 (c char(10)) union=(t1,t2) engine=merge; insert into t1 (c) values ('test1'); insert into t1 (c) values ('test1'); insert into t1 (c) values ('test1'); @@ -89,7 +89,7 @@ drop table t3,t2,t1; CREATE TABLE t1 (incr int not null, othr int not null, primary key(incr)); CREATE TABLE t2 (incr int not null, othr int not null, primary key(incr)); CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr)) -TYPE=MERGE UNION=(t1,t2); +ENGINE=MERGE UNION=(t1,t2); SELECT * from t3; @@ -103,14 +103,14 @@ alter table t3 UNION=(t1); select count(*) from t3; alter table t3 UNION=(t1,t2); select count(*) from t3; -alter table t3 TYPE=MYISAM; +alter table t3 ENGINE=MYISAM; select count(*) from t3; # Test that ALTER TABLE rembers the old UNION drop table t3; CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr)) -TYPE=MERGE UNION=(t1,t2); +ENGINE=MERGE UNION=(t1,t2); show create table t3; alter table t3 drop primary key; show create table t3; @@ -120,7 +120,7 @@ drop table t3,t2,t1; # # Test table without unions # -create table t1 (a int not null, key(a)) type=merge; +create table t1 (a int not null, key(a)) engine=merge; select * from t1; drop table t1; @@ -130,7 +130,7 @@ drop table t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); -create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2); +create table t3 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2); insert into t1 values (1,2),(2,1),(0,0),(4,4),(5,5),(6,6); insert into t2 values (1,1),(2,2),(0,0),(4,4),(5,5),(6,6); flush tables; @@ -145,9 +145,9 @@ drop table t3,t1,t2; create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO; -create table t4 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=NO; -create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; -create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; +create table t4 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=NO; +create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; +create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; show create table t3; show create table t4; show create table t5; @@ -192,11 +192,11 @@ insert into t1 values (99,NULL); select * from t4 where a+0 > 90; drop table t6, t5, t4, t3, t2, t1; -CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; +CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1), (2,1); -CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; +CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,2), (2,2); -CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); +CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) ENGINE=MRG_MyISAM UNION=(t1,t2); select max(b) from t3 where a = 2; select max(b) from t1 where a = 2; drop table t3,t1,t2; @@ -208,13 +208,13 @@ create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); insert into t2 values (2); -create temporary table t3 (a int not null) TYPE=MERGE UNION=(t1,t2); +create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2); select * from t3; create temporary table t4 (a int not null); create temporary table t5 (a int not null); insert into t4 values (1); insert into t5 values (2); -create temporary table t6 (a int not null) TYPE=MERGE UNION=(t4,t5); +create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5); select * from t6; drop table t6, t3, t1, t2, t4, t5; @@ -228,7 +228,7 @@ CREATE TABLE t1 ( fileset_root_id tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (fileset_id,file_code), KEY files (fileset_id,fileset_root_id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (2, '0000000111', 1), (2, '0000000112', 1), (2, '0000000113', 1), (2, '0000000114', 1), (2, '0000000115', 1), (2, '0000000116', 1), (2, '0000000117', 1), (2, '0000000118', 1), (2, '0000000119', 1), (2, '0000000120', 1); @@ -238,7 +238,7 @@ CREATE TABLE t2 ( fileset_root_id tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (fileset_id,file_code), KEY files (fileset_id,fileset_root_id) -) TYPE=MRG_MyISAM UNION=(t1); +) ENGINE=MRG_MyISAM UNION=(t1); EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; @@ -256,7 +256,7 @@ DROP TABLE t2, t1; create table t1 (x int, y int, index xy(x, y)); create table t2 (x int, y int, index xy(x, y)); -create table t3 (x int, y int, index xy(x, y)) type=merge union=(t1,t2); +create table t3 (x int, y int, index xy(x, y)) engine=merge union=(t1,t2); insert into t1 values(1, 2); insert into t2 values(1, 3); select * from t3 where x = 1 and y < 5 order by y; diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 26f7cbf22a0..9c576b080ca 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -15,8 +15,8 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; -create table t1 (a int) type=innodb; -create table t2 (a int) type=myisam; +create table t1 (a int) engine=innodb; +create table t2 (a int) engine=myisam; reset master; @@ -118,7 +118,7 @@ show binlog events from 79; # Check that things work like before this BEGIN/ROLLBACK code was added, # when t2 is INNODB -alter table t2 type=INNODB; +alter table t2 engine=INNODB; delete from t1; delete from t2; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index b3c742e0b30..115007d9e63 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -85,19 +85,19 @@ CREATE TABLE t1 ( id int(11) NOT NULL default '0', name varchar(10) default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'aaa'),(2,'aaa'),(3,'aaa'); CREATE TABLE t2 ( id int(11) NOT NULL default '0', name varchar(10) default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (2,'bbb'),(3,'bbb'),(4,'bbb'); CREATE TABLE t3 ( id int(11) NOT NULL default '0', mydate datetime default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t3 VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'2002-05-12 00:00:00'),(6,'2002-06-22 00:00:00'),(7,'2002-07-22 00:00:00'); delete t1,t2,t3 from t1,t2,t3 where to_days(now())-to_days(t3.mydate)>=30 and t3.id=t1.id and t3.id=t2.id; @@ -109,7 +109,7 @@ CREATE TABLE IF NOT EXISTS `t1` ( `tst` text, `tst1` text, PRIMARY KEY (`id`) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE IF NOT EXISTS `t2` ( `ID` int(11) NOT NULL auto_increment, @@ -119,7 +119,7 @@ CREATE TABLE IF NOT EXISTS `t2` ( PRIMARY KEY (`ID`), KEY `IX_ParId_t2` (`ParId`), FOREIGN KEY (`ParId`) REFERENCES `t1` (`id`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1(tst,tst1) VALUES("MySQL","MySQL AB"), ("MSSQL","Microsoft"), ("ORACLE","ORACLE"); @@ -223,11 +223,11 @@ select * from t1; select * from t2; drop table t1,t2; -CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); -CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'); -CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM; INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; @@ -260,7 +260,7 @@ select * from t1; select * from t2; drop table t1,t2; -CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) TYPE=MyISAM; +CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) ENGINE=MyISAM; INSERT INTO t3 VALUES ('A',1,1,22,3.2,'R','R','BASE2',0.24,NULL); create table t1 (A varchar(1)); insert into t1 values ("A") ,("B"),("C"),("D"); diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 5dceb2b4598..85e5c7a7751 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -15,7 +15,7 @@ SET SQL_WARNINGS=1; CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); INSERT INTO t1 VALUES ('DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'); @@ -68,7 +68,7 @@ drop table t1; # Test of how ORDER BY works when doing it on the whole table # -create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=myisam; +create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam; insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); explain select * from t1 order by a; explain select * from t1 order by b; @@ -324,7 +324,7 @@ CREATE TABLE `t1` ( KEY `poster_login` (`poster_login`), KEY `topic_id` (`topic_id`), FULLTEXT KEY `post_text` (`post_text`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'); @@ -402,7 +402,7 @@ drop table t1; # Test RTREE index # --error 1235 -CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) TYPE=MyISAM; +CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM; # INSERT INTO t1 VALUES (1,1),(1,1); # DELETE FROM rt WHERE a<1; # DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 5fa8f8a7651..c11ed78253b 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -45,7 +45,7 @@ DROP TABLE t1; # # Testing of IFNULL # -create table t1 (a int, b int) type=myisam; +create table t1 (a int, b int) engine=myisam; insert into t1 values(20,null); select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on t2.b=t3.a; diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test index 7d9500e90dd..9b346a181bf 100644 --- a/mysql-test/t/null_key.test +++ b/mysql-test/t/null_key.test @@ -5,7 +5,7 @@ drop table if exists t1,t2; --enable_warnings -create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam; +create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam; insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); explain select * from t1 where a is null; explain select * from t1 where a is null and b = 2; @@ -92,13 +92,13 @@ CREATE TABLE t1 ( uniq_id int(10) unsigned default NULL, PRIMARY KEY (id), UNIQUE KEY idx1 (uniq_id) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE t2 ( id int(10) unsigned NOT NULL auto_increment, uniq_id int(10) unsigned default NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); @@ -136,13 +136,13 @@ CREATE TABLE `t1` ( `product_id` char(32) NOT NULL default '', `product_type` int(11) NOT NULL default '0', PRIMARY KEY (`order_id`,`product_id`,`product_type`) -) TYPE=MyISAM; +) ENGINE=MyISAM; CREATE TABLE `t2` ( `order_id` char(32) NOT NULL default '', `product_id` char(32) NOT NULL default '', `product_type` int(11) NOT NULL default '0', PRIMARY KEY (`order_id`,`product_id`,`product_type`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (order_id, product_id, product_type) VALUES ('3d7ce39b5d4b3e3d22aaafe9b633de51',1206029, 3), ('3d7ce39b5d4b3e3d22aaafe9b633de51',5880836, 3), diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index ca4143fa1c9..bb72c5278f9 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -199,7 +199,7 @@ CREATE TABLE t1 ( info text NOT NULL, ipnr varchar(30) NOT NULL default '', PRIMARY KEY (member_id) -) TYPE=MyISAM PACK_KEYS=1; +) ENGINE=MyISAM PACK_KEYS=1; insert into t1 (member_id) values (1),(2),(3); select member_id, nickname, voornaam FROM t1 @@ -261,7 +261,7 @@ CREATE TABLE t1 ( cid smallint(5) unsigned NOT NULL default '0', PRIMARY KEY (gid), KEY component_id (cid) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (103853,108),(103867,108),(103962,108),(104505,108),(104619,108),(104620,108); ALTER TABLE t1 add skr int(10) not null; @@ -272,13 +272,13 @@ CREATE TABLE t2 ( PRIMARY KEY (gid), KEY uid (uid), KEY status_id (sid) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES (103853,250,5),(103867,27,5),(103962,27,5),(104505,117,5),(104619,75,5),(104620,15,5); CREATE TABLE t3 ( uid smallint(6) NOT NULL auto_increment, PRIMARY KEY (uid) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t3 VALUES (1),(15),(27),(75),(117),(250); ALTER TABLE t3 add skr int(10) not null; diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index a944df01051..a7b81d565e6 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -22,7 +22,7 @@ #select load_file("/tmp/select-test.not-exist"); #drop table t1; #drop table if exists t; -#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', i int(11), v varchar(200), b blob, KEY t (t)) TYPE=MyISAM; +#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', i int(11), v varchar(200), b blob, KEY t (t)) ENGINE=MyISAM; #INSERT INTO t VALUES ('2002-12-20 12:01:20','',1,"aaa","bbb"); #select * from t into outfile "check"; #drop table if exists t; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 14cbf4c906d..c93d616b379 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -45,7 +45,7 @@ create table t1 (a int not null); insert into t1 values (1),(2),(3); create table t2 (a int not null); insert into t2 values (4),(5),(6); -create table t3 (a int not null) type=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; +create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; # insert select * from t3; select * from t3; diff --git a/mysql-test/t/query_cache_merge.test b/mysql-test/t/query_cache_merge.test index 02e316932a3..fef3f18df60 100644 --- a/mysql-test/t/query_cache_merge.test +++ b/mysql-test/t/query_cache_merge.test @@ -25,7 +25,7 @@ while ($1) } --enable_warnings -create table t00 (a int) type=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST; +create table t00 (a int) engine=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST; enable_query_log; select count(*) from t00; select count(*) from t00; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index b1b846221e7..f01d8d4eacf 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -128,7 +128,7 @@ CREATE TABLE t1 ( KEY IdxArt (art), KEY IdxKnr (KNR), KEY IdxArtnr (ARTNR) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'), ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'), @@ -214,7 +214,7 @@ CREATE TABLE t1 ( b int(11) default NULL, KEY a (a), KEY b (b) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES diff --git a/mysql-test/t/repair_part1.test b/mysql-test/t/repair_part1.test index 2657f91cd02..e82edb64713 100644 --- a/mysql-test/t/repair_part1.test +++ b/mysql-test/t/repair_part1.test @@ -8,7 +8,7 @@ drop table if exists t1; create table t1 SELECT 1,"table 1"; repair table t1 use_frm; -alter table t1 TYPE=HEAP; +alter table t1 ENGINE=HEAP; repair table t1 use_frm; drop table t1; @@ -19,4 +19,4 @@ repair table t1 use_frm; # Create test table for repair2 # The following must be last in this file -create table t1 type=myisam SELECT 1,"table 1"; +create table t1 engine=myisam SELECT 1,"table 1"; diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test index 2afce2fcc84..8429d80a4ef 100644 --- a/mysql-test/t/replace.test +++ b/mysql-test/t/replace.test @@ -12,14 +12,14 @@ CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (gesuchnr,benutzer_id) -) type=ISAM; +) engine=ISAM; replace into t1 (gesuchnr,benutzer_id) values (2,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); -alter table t1 type=myisam; +alter table t1 engine=myisam; replace into t1 (gesuchnr,benutzer_id) values (1,1); -alter table t1 type=heap; +alter table t1 engine=heap; replace into t1 (gesuchnr,benutzer_id) values (1,1); drop table t1; diff --git a/mysql-test/t/rollback.test b/mysql-test/t/rollback.test index 1673f1648d3..87f59417d90 100644 --- a/mysql-test/t/rollback.test +++ b/mysql-test/t/rollback.test @@ -6,7 +6,7 @@ drop table if exists t1; --enable_warnings -create table t1 (n int not null primary key) type=myisam; +create table t1 (n int not null primary key) engine=myisam; begin work; insert into t1 values (4); insert into t1 values (5); diff --git a/mysql-test/t/rpl000006.test b/mysql-test/t/rpl000006.test index c6438062bb7..898ef309f50 100644 --- a/mysql-test/t/rpl000006.test +++ b/mysql-test/t/rpl000006.test @@ -30,7 +30,7 @@ set SQL_LOG_BIN=0; CREATE TABLE t1 ( a int not null -) TYPE=MyISAM MAX_ROWS=4000 CHECKSUM=1; +) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1; INSERT INTO t1 VALUES (1); save_master_pos; connection slave; diff --git a/mysql-test/t/rpl_flush_tables.test b/mysql-test/t/rpl_flush_tables.test index 67720343e83..b98235fbed8 100644 --- a/mysql-test/t/rpl_flush_tables.test +++ b/mysql-test/t/rpl_flush_tables.test @@ -8,7 +8,7 @@ source include/master-slave.inc; create table t1 (a int); insert into t1 values (10); create table t2 (a int); -create table t3 (a int) type=merge union(t1); +create table t3 (a int) engine=merge union(t1); create table t4 (a int); # We force the slave to open t3 (because we want to try confusing him) with this : insert into t4 select * from t3; diff --git a/mysql-test/t/rpl_insert_id.test b/mysql-test/t/rpl_insert_id.test index b2b92dec7aa..8244c323a0d 100644 --- a/mysql-test/t/rpl_insert_id.test +++ b/mysql-test/t/rpl_insert_id.test @@ -23,8 +23,8 @@ connection master; drop table t1; drop table t2; --disable_warnings -create table t1(a int auto_increment, key(a)) type=innodb; -create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) type=innodb; +create table t1(a int auto_increment, key(a)) engine=innodb; +create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb; --enable_warnings SET FOREIGN_KEY_CHECKS=0; insert into t1 values (10); diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test index 7a572740b3a..0e198d23517 100644 --- a/mysql-test/t/rpl_relayrotate.test +++ b/mysql-test/t/rpl_relayrotate.test @@ -15,7 +15,7 @@ connection slave; stop slave; connection master; --disable_warnings -create table t1 (a int) type=innodb; +create table t1 (a int) engine=innodb; --enable_warnings let $1=8000; disable_query_log; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index b817544bfb9..446c8768146 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1381,7 +1381,7 @@ INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1009,"gems",447,2374 INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1010,"clinker",512,786542,76234234); --enable_query_log -create temporary table tmp type = myisam select * from t3; +create temporary table tmp engine = myisam select * from t3; insert into t3 select * from tmp; insert into tmp select * from t3; @@ -1498,7 +1498,7 @@ create table t4 ( companyname char(30) NOT NULL default '', PRIMARY KEY (companynr), UNIQUE KEY companyname(companyname) -) TYPE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames'; +) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames'; --disable_query_log INSERT INTO t4 (companynr, companyname) VALUES (29,'company 1'); @@ -1767,9 +1767,9 @@ DROP TABLE t1; # Test of bug with SUM(CASE...) # -CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) TYPE=MyISAM; +CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM; INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL); -CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) TYPE=MyISAM; +CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35); SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'NULL' AND b.sampletime < 'NULL' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; DROP TABLE t1,t2; @@ -1836,9 +1836,9 @@ select * from t1 natural join (t1 as t2 left join t1 as t3 using (a)); select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1; drop table t1; -CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM; +CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM; INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522); -CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM; +CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM; INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522); select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5; drop table t1,t2; diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test index e8be902606c..f787cec6533 100644 --- a/mysql-test/t/select_found.test +++ b/mysql-test/t/select_found.test @@ -81,7 +81,7 @@ CREATE TABLE `t1` ( `maxnumrep` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`numeropost`), KEY `maxnumrep` (`maxnumrep`) -) TYPE=MyISAM ROW_FORMAT=FIXED; +) ENGINE=MyISAM ROW_FORMAT=FIXED; INSERT INTO t1 (titre,maxnumrep) VALUES ('test1','1'),('test2','2'),('test3','3'); SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost IN (1,2) ORDER BY maxnumrep DESC LIMIT 0, 1; diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 633826186be..4ab39e3ccbc 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -73,7 +73,7 @@ insert into t1 values (1); show open tables; drop table t1; -create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed; +create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed; show create table t1; alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0; show create table t1; @@ -112,7 +112,7 @@ type_blob blob, type_medium_blob mediumblob, type_long_blob longblob, index(type_short) -) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1; +) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1; # Not tested above: RAID_# UNION INSERT_METHOD DATA DIRECTORY INDEX DIRECTORY show create table t1; diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test index d96fd030207..95e83b4b9e2 100644 --- a/mysql-test/t/sql_mode.test +++ b/mysql-test/t/sql_mode.test @@ -8,7 +8,7 @@ CREATE TABLE `t1` ( `email` varchar(60) character set latin2 NOT NULL default '', PRIMARY KEY (a), UNIQUE KEY `email` USING BTREE (`email`) -) TYPE=HEAP CHARSET=latin1 ROW_FORMAT DYNAMIC; +) ENGINE=HEAP CHARSET=latin1 ROW_FORMAT DYNAMIC; set @@sql_mode=""; show variables like 'sql_mode'; show create table t1; diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index 30edcc79d9e..7be494bd0e7 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -17,7 +17,7 @@ SET SQL_LOG_BIN=0; drop table if exists t1; --enable_warnings -create table t1(n int) type=myisam; +create table t1(n int) engine=myisam; insert into t1 values(1); connection con2; lock tables t1 read; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index e53679b444e..95e4f022f2d 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -152,7 +152,7 @@ CREATE TABLE `t8` ( `email` varchar(60) character set latin1 NOT NULL default '', PRIMARY KEY (`pseudo`), UNIQUE KEY `email` (`email`) -) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); @@ -177,7 +177,7 @@ CREATE TABLE `t1` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', PRIMARY KEY (`pseudo`,`date`,`topic`), KEY `topic` (`topic`) -) TYPE=MyISAM ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM ROW_FORMAT=DYNAMIC; INSERT INTO t1 (topic,date,pseudo) VALUES ('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; @@ -196,7 +196,7 @@ CREATE TABLE `t1` ( `maxnumrep` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`numeropost`), UNIQUE KEY `maxnumrep` (`maxnumrep`) -) TYPE=MyISAM ROW_FORMAT=FIXED; +) ENGINE=MyISAM ROW_FORMAT=FIXED; INSERT INTO t1 (numeropost,maxnumrep) VALUES (40143,1),(43506,2); @@ -206,7 +206,7 @@ CREATE TABLE `t2` ( `date` date NOT NULL default '0000-00-00', `pseudo` varchar(35) NOT NULL default '', PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`) - ) TYPE=MyISAM ROW_FORMAT=DYNAMIC; + ) ENGINE=MyISAM ROW_FORMAT=DYNAMIC; INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce'); select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1); @@ -239,7 +239,7 @@ CREATE TABLE `t1` ( `maxnumrep` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`numeropost`), UNIQUE KEY `maxnumrep` (`maxnumrep`) -) TYPE=MyISAM ROW_FORMAT=FIXED; +) ENGINE=MyISAM ROW_FORMAT=FIXED; INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1); -- error 1241 @@ -268,7 +268,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`numeropost`,`numreponse`), UNIQUE KEY `numreponse` (`numreponse`), KEY `pseudo` (`pseudo`,`numeropost`) -) TYPE=MyISAM; +) ENGINE=MyISAM; -- error 1246 SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; -- error 1054 @@ -392,7 +392,7 @@ drop table t1, t2, t3; -- error 1096 SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *); -CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t2 VALUES (1),(2); SELECT * FROM t2 WHERE id IN (SELECT 1); EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1); @@ -407,7 +407,7 @@ INSERT INTO t2 VALUES ((SELECT * FROM t2)); -- error 1093 INSERT INTO t2 VALUES ((SELECT id FROM t2)); SELECT * FROM t2; -CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 values (1),(1); -- error 1241 UPDATE t2 SET id=(SELECT * FROM t1); @@ -541,7 +541,7 @@ insert into t2 values (1,2),(1,3); select * from t1 where row(a,b) in (select a,b from t2); drop table t1, t2; -CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES (1); -- error 1111 UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); @@ -563,7 +563,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`), KEY `pseudo` (`pseudo`,`date`,`topic`), KEY `topic` (`topic`) -) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; CREATE TABLE `t2` ( `mot` varchar(30) character set latin1 NOT NULL default '', @@ -573,14 +573,14 @@ CREATE TABLE `t2` ( PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`), KEY `pseudo` (`pseudo`,`date`,`topic`), KEY `topic` (`topic`) -) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC; CREATE TABLE `t3` ( `numeropost` mediumint(8) unsigned NOT NULL auto_increment, `maxnumrep` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`numeropost`), UNIQUE KEY `maxnumrep` (`maxnumrep`) -) TYPE=MyISAM CHARSET=latin1; +) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test'); INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test'); @@ -634,7 +634,7 @@ CREATE TABLE t1 ( District char(20) NOT NULL default '', Population int(11) NOT NULL default '0', PRIMARY KEY (ID) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (130,'Sydney','AUS','New South Wales',3276207); INSERT INTO t1 VALUES (131,'Melbourne','AUS','Victoria',2865329); @@ -657,7 +657,7 @@ CREATE TABLE t2 ( Capital int(11) default NULL, Code2 char(2) NOT NULL default '', PRIMARY KEY (Code) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU'); INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ'); @@ -674,7 +674,7 @@ CREATE TABLE `t1` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `pseudo` (`pseudo`), -) TYPE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC; INSERT INTO t1 (pseudo) VALUES ('test'); SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); @@ -686,7 +686,7 @@ drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', PRIMARY KEY (`i`) -) TYPE=MyISAM CHARSET=latin1; +) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES (1); -- error 1111 @@ -702,12 +702,12 @@ drop table t1; # CREATE TABLE t1 ( id int(11) default NULL -) TYPE=MyISAM CHARSET=latin1; +) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3); CREATE TABLE t2 ( id int(11) default NULL, name varchar(15) default NULL -) TYPE=MyISAM CHARSET=latin1; +) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita'); update t1, t2 set t2.name='lenka' where t2.id in (select id from t1); @@ -739,7 +739,7 @@ CREATE TABLE t1 ( UNIQUE KEY t1_PK (ID,SUB_ID), KEY t1_FK (REF_ID,REF_SUB), KEY t1_REFID (REF_ID) -) TYPE=MyISAM CHARSET=cp1251; +) ENGINE=MyISAM CHARSET=cp1251; INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL); SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2); DROP TABLE t1; @@ -777,7 +777,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`), UNIQUE KEY `pseudo` (`pseudo`), -) TYPE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC; INSERT INTO t1 (id,pseudo,email) VALUES (1,'test','test'),(2,'test1','test1'); SELECT pseudo as a, pseudo as b FROM t1 GROUP BY (SELECT a) ORDER BY (SELECT id*1); drop table if exists t1; @@ -933,13 +933,13 @@ drop table t2, t3; # correct used_tables() # -CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) TYPE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; +CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); -CREATE TABLE `t2` (`db_id` int(11) NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` smallint(6) NOT NULL default '0',`secondary_uid` smallint(6) NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`),FULLTEXT KEY `name` (`name`)) TYPE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2147483647; +CREATE TABLE `t2` (`db_id` int(11) NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` smallint(6) NOT NULL default '0',`secondary_uid` smallint(6) NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`),FULLTEXT KEY `name` (`name`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2147483647; INSERT INTO `t2` (`db_id`, `name`, `primary_uid`, `secondary_uid`) VALUES (18, 'Not Set 1', 0, 0),(19, 'Valid', 1, 2),(20, 'Valid 2', 1, 2),(21, 'Should Not Return', 1, 2),(26, 'Not Set 2', 0, 0),(-1, 'ALL DB\'S', 0, 0); -CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(11) NOT NULL default '0',`taskid` int(11) NOT NULL default '0',`mon` tinyint(4) NOT NULL default '1',`tues` tinyint(4) NOT NULL default '1',`wed` tinyint(4) NOT NULL default '1',`thur` tinyint(4) NOT NULL default '1',`fri` tinyint(4) NOT NULL default '1',`sat` tinyint(4) NOT NULL default '0',`sun` tinyint(4) NOT NULL default '0',`how_often` smallint(6) NOT NULL default '1',`userid` smallint(6) NOT NULL default '0',`active` tinyint(4) NOT NULL default '1',PRIMARY KEY (`taskgenid`)) TYPE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2 ; +CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(11) NOT NULL default '0',`taskid` int(11) NOT NULL default '0',`mon` tinyint(4) NOT NULL default '1',`tues` tinyint(4) NOT NULL default '1',`wed` tinyint(4) NOT NULL default '1',`thur` tinyint(4) NOT NULL default '1',`fri` tinyint(4) NOT NULL default '1',`sat` tinyint(4) NOT NULL default '0',`sun` tinyint(4) NOT NULL default '0',`how_often` smallint(6) NOT NULL default '1',`userid` smallint(6) NOT NULL default '0',`active` tinyint(4) NOT NULL default '1',PRIMARY KEY (`taskgenid`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2 ; INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1); -CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') TYPE=MyISAM CHARSET=latin1; +CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status'); select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; SELECT dbid, name FROM t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND ((date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')) AND t4.task_id = taskid; @@ -948,9 +948,9 @@ drop table t1,t2,t3,t4; # # cardinality check # -CREATE TABLE t1 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t1 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES (1),(5); -CREATE TABLE t2 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t2 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t2 VALUES (2),(6); -- error 1240 select * from t1 where (1,2,6) in (select * from t2); @@ -980,9 +980,9 @@ drop table t1; # # filesort in subquery (restoring join_tab) # -CREATE TABLE t1 (number char(11) NOT NULL default '') TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874'); -CREATE TABLE t2 (code char(5) NOT NULL default '',UNIQUE KEY code (code)) TYPE=MyISAM CHARSET=latin1; +CREATE TABLE t2 (code char(5) NOT NULL default '',UNIQUE KEY code (code)) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t2 VALUES ('1'),('1226'),('1245'),('1862'),('18623'),('1874'),('1967'),('6'); select c.number as phone,(select p.code from t2 p where c.number like concat(p.code, '%') order by length(p.code) desc limit 1) as code from t1 c; drop table t1, t2; diff --git a/mysql-test/t/subselect2.test b/mysql-test/t/subselect2.test index 151e285e6d4..2d42320334a 100644 --- a/mysql-test/t/subselect2.test +++ b/mysql-test/t/subselect2.test @@ -22,7 +22,7 @@ DOCID VARCHAR(32)BINARY NOT NULL , ORIGINATOR INTEGER , PRIMARY KEY ( DOCID ) -) TYPE=InnoDB +) ENGINE=InnoDB ; CREATE TABLE t2 @@ -48,7 +48,7 @@ DOCID VARCHAR(32)BINARY NOT NULL , ORIGINATOR INTEGER , PRIMARY KEY ( DOCID ) -) TYPE=InnoDB +) ENGINE=InnoDB ; CREATE INDEX DDOCTYPEID_IDX ON t2 (DOCTYPEID); CREATE INDEX DFOLDERID_IDX ON t2 (FOLDERID); @@ -68,7 +68,7 @@ FOLDERID VARCHAR(32)BINARY NOT NULL , ORIGINATOR INTEGER , PRIMARY KEY ( FOLDERID ) -) TYPE=InnoDB; +) ENGINE=InnoDB; CREATE INDEX FFOLDERID_IDX ON t3 (FOLDERID); CREATE INDEX CMFLDRPARNT_IDX ON t3 (PARENTID); @@ -84,7 +84,7 @@ DOCTYPEID VARCHAR(32)BINARY NOT NULL , ORIGINATOR INTEGER , PRIMARY KEY ( DOCTYPEID ) -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t2 VALUES("c373e9f59cf15a6c3e57444553544200", "c373e9f59cf15a6c3e57444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-06 07:48:42", NULL, NULL, NULL, "2003-06-06 07:48:42", "2003-06-06 07:48:42", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-06 07:48:42", "admin", "0", NULL); diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test index 5e274ecbd5c..9eb35ffc0fd 100644 --- a/mysql-test/t/subselect_innodb.test +++ b/mysql-test/t/subselect_innodb.test @@ -23,7 +23,7 @@ FOLDERID VARCHAR(32)BINARY NOT NULL , ORIGINATOR INTEGER , PRIMARY KEY ( FOLDERID ) -) TYPE=InnoDB; +) ENGINE=InnoDB; CREATE INDEX FFOLDERID_IDX ON t1 (FOLDERID); CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID); INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1"); @@ -35,9 +35,9 @@ drop table t1; # # UNION unlocking test # -create table t1 (a int) type=innodb; -create table t2 (a int) type=innodb; -create table t3 (a int) type=innodb; +create table t1 (a int) engine=innodb; +create table t2 (a int) engine=innodb; +create table t3 (a int) engine=innodb; insert into t1 values (1),(2),(3),(4); insert into t2 values (10),(20),(30),(40); insert into t3 values (1),(2),(10),(50); @@ -48,12 +48,12 @@ drop table t1,t2,t3; CREATE TABLE t1 ( processor_id INTEGER NOT NULL, PRIMARY KEY (processor_id) -) TYPE=InnoDB; +) ENGINE=InnoDB; CREATE TABLE t3 ( yod_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, login_processor INTEGER UNSIGNED , PRIMARY KEY (yod_id) -) TYPE=InnoDB; +) ENGINE=InnoDB; CREATE TABLE t2 ( processor_id INTEGER NOT NULL, yod_id BIGINT UNSIGNED NOT NULL, @@ -62,7 +62,7 @@ CREATE TABLE t2 ( INDEX (yod_id), FOREIGN KEY (processor_id) REFERENCES t1(processor_id), FOREIGN KEY (yod_id) REFERENCES t3(yod_id) -) TYPE=InnoDB; +) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t3 VALUES (1,1),(2,2),(3,3); INSERT INTO t2 VALUES (1,1),(2,2),(3,3); diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index f618c342936..716eed7abc0 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -41,7 +41,7 @@ drop table t2; # disable_query_log; -eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run"; +eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run"; enable_query_log; insert into t9 select * from t1; @@ -66,23 +66,23 @@ drop table t1; disable_query_log; --error 1103,1103 -create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp"; +create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp"; # Check that we cannot link over a table from another database. create database mysqltest; --error 1,1 -create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist"; +create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist"; --error 1103,1103 -create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path"; +create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path"; --error 1,1 -eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="$MYSQL_TEST_DIR/var/run"; +eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="$MYSQL_TEST_DIR/var/run"; --error 1,1 -eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp"; +eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp"; enable_query_log; # Check moving table t9 from default database to mysqltest; diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 03b6fa35bfa..2181d3eb74c 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -16,8 +16,8 @@ select * from t2; CREATE TABLE t2 (x int not null, y int not null); alter table t2 rename t1; select * from t1; -create TEMPORARY TABLE t2 type=heap select * from t1; -create TEMPORARY TABLE IF NOT EXISTS t2 (a int) type=heap; +create TEMPORARY TABLE t2 engine=heap select * from t1; +create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap; # This should give errors !$1050 CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null); @@ -78,7 +78,7 @@ drop table t1; CREATE TABLE t1 ( d datetime default NULL -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'); diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index d2611973101..7cedbc087e4 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -57,7 +57,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`numfacture`), KEY `date` (`date`), KEY `expedition` (`expedition`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (expedition) VALUES ('0001-00-00 00:00:00'); SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test index 6c0f162dc86..60aa8dcfcf2 100644 --- a/mysql-test/t/type_set.test +++ b/mysql-test/t/type_set.test @@ -12,5 +12,5 @@ drop table t1; create table t1 (a set (' ','a','b ') not null default 'b '); show create table t1; drop table t1; -CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) TYPE=MyISAM CHARSET=utf8; +CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) ENGINE=MyISAM CHARSET=utf8; DROP TABLE t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index a5cb1ce6b6e..6138bba5a31 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -97,7 +97,7 @@ CREATE TABLE t1 ( `same` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`pseudo1`), KEY `pseudo` (`pseudo`) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 (pseudo,pseudo1,same) VALUES ('joce', 'testtt', 1),('joce', 'tsestset', 1),('dekad', 'joce', 1); SELECT pseudo FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo FROM t1 WHERE pseudo='joce'; SELECT pseudo1 FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo1 FROM t1 WHERE pseudo='joce'; @@ -252,9 +252,9 @@ drop table t1,t2; # # Test for another bug with UNION and LEFT JOIN # -CREATE TABLE t1 ( id int(3) unsigned default '0') TYPE=MyISAM; +CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM; INSERT INTO t1 (id) VALUES("1"); -CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) TYPE=MyISAM; +CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) ENGINE=MyISAM; INSERT INTO t2 (id, id_master, text1, text2) VALUES("1", "1", "foo1", "bar1"); INSERT INTO t2 (id, id_master, text1, text2) VALUES("2", "1", diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 485af981fb4..8e50fee56fd 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -71,7 +71,7 @@ CREATE TABLE t1 ( KEY k3 (parent), KEY k4 (assignment), KEY ticket (ticket) -) TYPE=MyISAM; +) ENGINE=MyISAM; INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','',''); @@ -107,7 +107,7 @@ CREATE TABLE t1 ( `nom_option` char(40) NOT NULL default '', `valid` tinyint(1) NOT NULL default '0', KEY `id_param` (`id_param`,`nom_option`) - ) TYPE=MyISAM; + ) ENGINE=MyISAM; INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1); diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 050449f0f5b..a94380db221 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -80,6 +80,14 @@ select @@warning_count; # Test for handler type # drop table t1; -create table t1 (id int) type=isam; -alter table t1 type=isam; +create table t1 (id int) engine=isam; +alter table t1 engine=isam; drop table t1; + +# +# Test for deprecated TYPE= syntax +# +create table t1 (id int) type=heap; +alter table t1 type=myisam; +drop table t1; + diff --git a/sql/lex.h b/sql/lex.h index 9dd3ede7f44..a7c8735e193 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -49,30 +49,30 @@ static SYMBOL symbols[] = { { "<=>", SYM(EQUAL_SYM),0,0}, { "ACTION", SYM(ACTION),0,0}, { "ADD", SYM(ADD),0,0}, + { "AFTER", SYM(AFTER_SYM),0,0}, + { "AGAINST", SYM(AGAINST),0,0}, { "AGGREGATE", SYM(AGGREGATE_SYM),0,0}, { "ALL", SYM(ALL),0,0}, { "ALTER", SYM(ALTER),0,0}, - { "AFTER", SYM(AFTER_SYM),0,0}, - { "AGAINST", SYM(AGAINST),0,0}, { "ANALYZE", SYM(ANALYZE_SYM),0,0}, { "AND", SYM(AND),0,0}, { "ANY", SYM(ANY_SYM),0,0}, { "AS", SYM(AS),0,0}, { "ASC", SYM(ASC),0,0}, { "ASCII", SYM(ASCII_SYM),0,0}, + { "AUTO_INCREMENT", SYM(AUTO_INC),0,0}, { "AVG", SYM(AVG_SYM),0,0}, { "AVG_ROW_LENGTH", SYM(AVG_ROW_LENGTH),0,0}, - { "AUTO_INCREMENT", SYM(AUTO_INC),0,0}, { "BACKUP", SYM(BACKUP_SYM),0,0}, + { "BDB", SYM(BERKELEY_DB_SYM),0,0}, { "BEFORE", SYM(BEFORE_SYM),0,0}, { "BEGIN", SYM(BEGIN_SYM),0,0}, { "BERKELEYDB", SYM(BERKELEY_DB_SYM),0,0}, - { "BDB", SYM(BERKELEY_DB_SYM),0,0}, { "BETWEEN", SYM(BETWEEN_SYM),0,0}, { "BIGINT", SYM(BIGINT),0,0}, - { "BIT", SYM(BIT_SYM),0,0}, { "BINARY", SYM(BINARY),0,0}, { "BINLOG", SYM(BINLOG_SYM),0,0}, + { "BIT", SYM(BIT_SYM),0,0}, { "BLOB", SYM(BLOB_SYM),0,0}, { "BOOL", SYM(BOOL_SYM),0,0}, { "BOOLEAN", SYM(BOOLEAN_SYM),0,0}, @@ -83,11 +83,11 @@ static SYMBOL symbols[] = { { "CACHE", SYM(CACHE_SYM),0,0}, { "CASCADE", SYM(CASCADE),0,0}, { "CASE", SYM(CASE_SYM),0,0}, + { "CHANGE", SYM(CHANGE),0,0}, + { "CHANGED", SYM(CHANGED),0,0}, { "CHAR", SYM(CHAR_SYM),0,0}, { "CHARACTER", SYM(CHAR_SYM),0,0}, { "CHARSET", SYM(CHARSET),0,0}, - { "CHANGE", SYM(CHANGE),0,0}, - { "CHANGED", SYM(CHANGED),0,0}, { "CHECK", SYM(CHECK_SYM),0,0}, { "CHECKSUM", SYM(CHECKSUM_SYM),0,0}, { "CIPHER", SYM(CIPHER_SYM),0,0}, @@ -121,13 +121,13 @@ static SYMBOL symbols[] = { { "DAY_SECOND", SYM(DAY_SECOND_SYM),0,0}, { "DEC", SYM(DECIMAL_SYM),0,0}, { "DECIMAL", SYM(DECIMAL_SYM),0,0}, - { "DES_KEY_FILE", SYM(DES_KEY_FILE),0,0}, { "DEFAULT", SYM(DEFAULT),0,0}, { "DELAYED", SYM(DELAYED_SYM),0,0}, { "DELAY_KEY_WRITE", SYM(DELAY_KEY_WRITE_SYM),0,0}, { "DELETE", SYM(DELETE_SYM),0,0}, { "DESC", SYM(DESC),0,0}, { "DESCRIBE", SYM(DESCRIBE),0,0}, + { "DES_KEY_FILE", SYM(DES_KEY_FILE),0,0}, { "DIRECTORY", SYM(DIRECTORY_SYM),0,0}, { "DISABLE", SYM(DISABLE_SYM),0,0}, { "DISCARD", SYM(DISCARD),0,0}, @@ -136,25 +136,27 @@ static SYMBOL symbols[] = { { "DIV", SYM(DIV_SYM),0,0}, { "DO", SYM(DO_SYM),0,0}, { "DOUBLE", SYM(DOUBLE_SYM),0,0}, - { "DUAL", SYM(DUAL_SYM),0,0}, { "DROP", SYM(DROP),0,0}, + { "DUAL", SYM(DUAL_SYM),0,0}, { "DUMPFILE", SYM(DUMPFILE),0,0}, - { "DYNAMIC", SYM(DYNAMIC_SYM),0,0}, { "DUPLICATE", SYM(DUPLICATE_SYM),0,0}, - { "ERRORS", SYM(ERRORS),0,0}, - { "END", SYM(END),0,0}, + { "DYNAMIC", SYM(DYNAMIC_SYM),0,0}, { "ELSE", SYM(ELSE),0,0}, - { "ESCAPE", SYM(ESCAPE_SYM),0,0}, - { "ESCAPED", SYM(ESCAPED),0,0}, { "ENABLE", SYM(ENABLE_SYM),0,0}, { "ENCLOSED", SYM(ENCLOSED),0,0}, + { "END", SYM(END),0,0}, + { "ENGINE", SYM(ENGINE_SYM),0,0}, { "ENUM", SYM(ENUM),0,0}, + { "ERRORS", SYM(ERRORS),0,0}, + { "ESCAPE", SYM(ESCAPE_SYM),0,0}, + { "ESCAPED", SYM(ESCAPED),0,0}, { "EVENTS", SYM(EVENTS_SYM),0,0}, { "EXECUTE", SYM(EXECUTE_SYM),0,0}, - { "EXPLAIN", SYM(DESCRIBE),0,0}, { "EXISTS", SYM(EXISTS),0,0}, { "EXPANSION", SYM(EXPANSION_SYM),0,0}, + { "EXPLAIN", SYM(DESCRIBE),0,0}, { "EXTENDED", SYM(EXTENDED_SYM),0,0}, + { "FALSE", SYM(FALSE_SYM),0,0}, { "FAST", SYM(FAST_SYM),0,0}, { "FIELDS", SYM(COLUMNS),0,0}, { "FILE", SYM(FILE_SYM),0,0}, @@ -164,15 +166,10 @@ static SYMBOL symbols[] = { { "FLOAT4", SYM(FLOAT_SYM),0,0}, { "FLOAT8", SYM(DOUBLE_SYM),0,0}, { "FLUSH", SYM(FLUSH_SYM),0,0}, - { "FALSE", SYM(FALSE_SYM),0,0}, - { "FOREIGN", SYM(FOREIGN),0,0}, - { "FORCE", SYM(FORCE_SYM),0,0}, - { "RAID_TYPE", SYM(RAID_TYPE),0,0}, - { "RAID_CHUNKS", SYM(RAID_CHUNKS),0,0}, - { "RAID_CHUNKSIZE", SYM(RAID_CHUNKSIZE),0,0}, - { "ROW_FORMAT", SYM(ROW_FORMAT_SYM),0,0}, - { "FROM", SYM(FROM),0,0}, { "FOR", SYM(FOR_SYM),0,0}, + { "FORCE", SYM(FORCE_SYM),0,0}, + { "FOREIGN", SYM(FOREIGN),0,0}, + { "FROM", SYM(FROM),0,0}, { "FULL", SYM(FULL),0,0}, { "FULLTEXT", SYM(FULLTEXT_SYM),0,0}, { "FUNCTION", SYM(UDF_SYM),0,0}, @@ -183,18 +180,20 @@ static SYMBOL symbols[] = { { "GRANT", SYM(GRANT),0,0}, { "GRANTS", SYM(GRANTS),0,0}, { "GROUP", SYM(GROUP),0,0}, - { "HAVING", SYM(HAVING),0,0}, { "HANDLER", SYM(HANDLER_SYM),0,0}, { "HASH", SYM(HASH_SYM),0,0}, + { "HAVING", SYM(HAVING),0,0}, { "HELP", SYM(HELP_SYM),0,0}, { "HIGH_PRIORITY", SYM(HIGH_PRIORITY),0,0}, + { "HOSTS", SYM(HOSTS_SYM),0,0}, { "HOUR", SYM(HOUR_SYM),0,0}, { "HOUR_MICROSECOND", SYM(HOUR_MICROSECOND_SYM),0,0}, { "HOUR_MINUTE", SYM(HOUR_MINUTE_SYM),0,0}, { "HOUR_SECOND", SYM(HOUR_SECOND_SYM),0,0}, - { "HOSTS", SYM(HOSTS_SYM),0,0}, { "IDENTIFIED", SYM(IDENTIFIED_SYM),0,0}, + { "IF", SYM(IF),0,0}, { "IGNORE", SYM(IGNORE_SYM),0,0}, + { "IMPORT", SYM(IMPORT),0,0}, { "IN", SYM(IN_SYM),0,0}, { "INDEX", SYM(INDEX),0,0}, { "INDEXES", SYM(INDEXES),0,0}, @@ -202,20 +201,18 @@ static SYMBOL symbols[] = { { "INNER", SYM(INNER_SYM),0,0}, { "INNOBASE", SYM(INNOBASE_SYM),0,0}, { "INNODB", SYM(INNOBASE_SYM),0,0}, - { "IMPORT", SYM(IMPORT),0,0}, { "INSERT", SYM(INSERT),0,0}, { "INSERT_METHOD", SYM(INSERT_METHOD),0,0}, { "INT", SYM(INT_SYM),0,0}, - { "INTEGER", SYM(INT_SYM),0,0}, - { "INTERVAL", SYM(INTERVAL_SYM),0,0}, { "INT1", SYM(TINYINT),0,0}, { "INT2", SYM(SMALLINT),0,0}, { "INT3", SYM(MEDIUMINT),0,0}, { "INT4", SYM(INT_SYM),0,0}, { "INT8", SYM(BIGINT),0,0}, + { "INTEGER", SYM(INT_SYM),0,0}, + { "INTERVAL", SYM(INTERVAL_SYM),0,0}, { "INTO", SYM(INTO),0,0}, { "IO_THREAD", SYM(RELAY_THREAD),0,0}, - { "IF", SYM(IF),0,0}, { "IS", SYM(IS),0,0}, { "ISOLATION", SYM(ISOLATION),0,0}, { "ISSUER", SYM(ISSUER_SYM),0,0}, @@ -229,9 +226,9 @@ static SYMBOL symbols[] = { { "LEFT", SYM(LEFT),0,0}, { "LEVEL", SYM(LEVEL_SYM),0,0}, { "LIKE", SYM(LIKE),0,0}, + { "LIMIT", SYM(LIMIT),0,0}, { "LINES", SYM(LINES),0,0}, { "LINESTRING", SYM(LINESTRING),0,0}, - { "LIMIT", SYM(LIMIT),0,0}, { "LOAD", SYM(LOAD),0,0}, { "LOCAL", SYM(LOCAL_SYM),0,0}, { "LOCALTIME", SYM(NOW_SYM),0,0}, @@ -258,21 +255,21 @@ static SYMBOL symbols[] = { { "MASTER_SSL_CIPHER",SYM(MASTER_SSL_CIPHER_SYM),0,0}, { "MASTER_SSL_KEY", SYM(MASTER_SSL_KEY_SYM),0,0}, { "MASTER_USER", SYM(MASTER_USER_SYM),0,0}, - { "MAX_ROWS", SYM(MAX_ROWS),0,0}, - { "MAX_QUERIES_PER_HOUR", SYM(MAX_QUERIES_PER_HOUR), 0,0}, - { "MAX_UPDATES_PER_HOUR", SYM(MAX_UPDATES_PER_HOUR), 0,0}, - { "MAX_CONNECTIONS_PER_HOUR", SYM(MAX_CONNECTIONS_PER_HOUR), 0,0}, { "MATCH", SYM(MATCH),0,0}, - { "MEDIUMBLOB", SYM(MEDIUMBLOB),0,0}, - { "MEDIUMTEXT", SYM(MEDIUMTEXT),0,0}, - { "MEDIUMINT", SYM(MEDIUMINT),0,0}, + { "MAX_CONNECTIONS_PER_HOUR", SYM(MAX_CONNECTIONS_PER_HOUR), 0,0}, + { "MAX_QUERIES_PER_HOUR", SYM(MAX_QUERIES_PER_HOUR), 0,0}, + { "MAX_ROWS", SYM(MAX_ROWS),0,0}, + { "MAX_UPDATES_PER_HOUR", SYM(MAX_UPDATES_PER_HOUR), 0,0}, { "MEDIUM", SYM(MEDIUM_SYM),0,0}, + { "MEDIUMBLOB", SYM(MEDIUMBLOB),0,0}, + { "MEDIUMINT", SYM(MEDIUMINT),0,0}, + { "MEDIUMTEXT", SYM(MEDIUMTEXT),0,0}, { "MICROSECOND", SYM(MICROSECOND_SYM),0,0}, { "MIDDLEINT", SYM(MEDIUMINT),0,0}, /* For powerbuilder */ - { "MIN_ROWS", SYM(MIN_ROWS),0,0}, { "MINUTE", SYM(MINUTE_SYM),0,0}, { "MINUTE_MICROSECOND", SYM(MINUTE_MICROSECOND_SYM),0,0}, { "MINUTE_SECOND", SYM(MINUTE_SECOND_SYM),0,0}, + { "MIN_ROWS", SYM(MIN_ROWS),0,0}, { "MOD", SYM(MOD_SYM),0,0}, { "MODE", SYM(MODE_SYM),0,0}, { "MODIFY", SYM(MODIFY_SYM),0,0}, @@ -281,14 +278,15 @@ static SYMBOL symbols[] = { { "MULTIPOINT", SYM(MULTIPOINT),0,0}, { "MULTIPOLYGON", SYM(MULTIPOLYGON),0,0}, { "NAMES", SYM(NAMES_SYM),0,0}, - { "NATURAL", SYM(NATURAL),0,0}, { "NATIONAL", SYM(NATIONAL_SYM),0,0}, - { "NEXT", SYM(NEXT_SYM),0,0}, - { "NEW", SYM(NEW_SYM),0,0}, + { "NATURAL", SYM(NATURAL),0,0}, { "NCHAR", SYM(NCHAR_SYM),0,0}, + { "NEW", SYM(NEW_SYM),0,0}, + { "NEXT", SYM(NEXT_SYM),0,0}, { "NO", SYM(NO_SYM),0,0}, { "NONE", SYM(NONE_SYM),0,0}, { "NOT", SYM(NOT),0,0}, + { "NO_WRITE_TO_BINLOG", SYM(NO_WRITE_TO_BINLOG),0,0}, { "NULL", SYM(NULL_SYM),0,0}, { "NUMERIC", SYM(NUMERIC_SYM),0,0}, { "NVARCHAR", SYM(NVARCHAR_SYM),0,0}, @@ -308,33 +306,35 @@ static SYMBOL symbols[] = { { "PASSWORD", SYM(PASSWORD),0,0}, { "POINT", SYM(POINT_SYM),0,0}, { "POLYGON", SYM(POLYGON),0,0}, - { "PURGE", SYM(PURGE),0,0}, { "PRECISION", SYM(PRECISION),0,0}, { "PREV", SYM(PREV_SYM),0,0}, { "PRIMARY", SYM(PRIMARY_SYM),0,0}, + { "PRIVILEGES", SYM(PRIVILEGES),0,0}, { "PROCEDURE", SYM(PROCEDURE),0,0}, { "PROCESS" , SYM(PROCESS),0,0}, { "PROCESSLIST", SYM(PROCESSLIST_SYM),0,0}, - { "PRIVILEGES", SYM(PRIVILEGES),0,0}, + { "PURGE", SYM(PURGE),0,0}, { "QUERY", SYM(QUERY_SYM),0,0}, { "QUICK", SYM(QUICK),0,0}, { "RAID0", SYM(RAID_0_SYM),0,0}, + { "RAID_CHUNKS", SYM(RAID_CHUNKS),0,0}, + { "RAID_CHUNKSIZE", SYM(RAID_CHUNKSIZE),0,0}, + { "RAID_TYPE", SYM(RAID_TYPE),0,0}, { "READ", SYM(READ_SYM),0,0}, { "REAL", SYM(REAL),0,0}, { "REFERENCES", SYM(REFERENCES),0,0}, + { "REGEXP", SYM(REGEXP),0,0}, { "RELAY_LOG_FILE", SYM(RELAY_LOG_FILE_SYM),0,0}, { "RELAY_LOG_POS", SYM(RELAY_LOG_POS_SYM),0,0}, { "RELAY_THREAD", SYM(RELAY_THREAD),0,0}, { "RELOAD", SYM(RELOAD),0,0}, - { "REGEXP", SYM(REGEXP),0,0}, { "RENAME", SYM(RENAME),0,0}, { "REPAIR", SYM(REPAIR),0,0}, + { "REPEATABLE", SYM(REPEATABLE_SYM),0,0}, { "REPLACE", SYM(REPLACE),0,0}, { "REPLICATION", SYM(REPLICATION),0,0}, - { "REPEATABLE", SYM(REPEATABLE_SYM),0,0}, { "REQUIRE", SYM(REQUIRE_SYM),0,0}, { "RESET", SYM(RESET_SYM),0,0}, - { "USER_RESOURCES", SYM(RESOURCES),0,0}, { "RESTORE", SYM(RESTORE_SYM),0,0}, { "RESTRICT", SYM(RESTRICT),0,0}, { "RETURNS", SYM(UDF_RETURNS_SYM),0,0}, @@ -345,25 +345,27 @@ static SYMBOL symbols[] = { { "ROLLUP", SYM(ROLLUP_SYM),0,0}, { "ROW", SYM(ROW_SYM),0,0}, { "ROWS", SYM(ROWS_SYM),0,0}, + { "ROW_FORMAT", SYM(ROW_FORMAT_SYM),0,0}, { "RTREE", SYM(RTREE_SYM),0,0}, { "SAVEPOINT", SYM(SAVEPOINT_SYM),0,0}, { "SECOND", SYM(SECOND_SYM),0,0}, { "SECOND_MICROSECOND", SYM(SECOND_MICROSECOND_SYM),0,0}, - { "SEPARATOR", SYM(SEPARATOR_SYM),0,0}, { "SELECT", SYM(SELECT_SYM),0,0}, + { "SEPARATOR", SYM(SEPARATOR_SYM),0,0}, { "SERIAL", SYM(SERIAL_SYM),0,0}, { "SERIALIZABLE", SYM(SERIALIZABLE_SYM),0,0}, { "SESSION", SYM(SESSION_SYM),0,0}, { "SET", SYM(SET),0,0}, - { "SIGNED", SYM(SIGNED_SYM),0,0}, - { "SIMPLE", SYM(SIMPLE_SYM),0,0}, { "SHARE", SYM(SHARE_SYM),0,0}, { "SHOW", SYM(SHOW),0,0}, { "SHUTDOWN", SYM(SHUTDOWN),0,0}, + { "SIGNED", SYM(SIGNED_SYM),0,0}, + { "SIMPLE", SYM(SIMPLE_SYM),0,0}, { "SLAVE", SYM(SLAVE),0,0}, { "SMALLINT", SYM(SMALLINT),0,0}, { "SOME", SYM(ANY_SYM),0,0}, { "SONAME", SYM(UDF_SONAME_SYM),0,0}, + { "SOUNDS", SYM(SOUNDS_SYM),0,0}, { "SPATIAL", SYM(SPATIAL_SYM),0,0}, { "SQL_BIG_RESULT", SYM(SQL_BIG_RESULT),0,0}, { "SQL_BUFFER_RESULT", SYM(SQL_BUFFER_RESULT),0,0}, @@ -372,14 +374,13 @@ static SYMBOL symbols[] = { { "SQL_NO_CACHE", SYM(SQL_NO_CACHE_SYM), 0, 0}, { "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0}, { "SQL_THREAD", SYM(SQL_THREAD),0,0}, - { "SOUNDS", SYM(SOUNDS_SYM),0,0}, { "SSL", SYM(SSL_SYM),0,0}, - { "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0}, { "START", SYM(START_SYM),0,0}, { "STARTING", SYM(STARTING),0,0}, { "STATUS", SYM(STATUS_SYM),0,0}, - { "STRING", SYM(STRING_SYM),0,0}, { "STOP", SYM(STOP_SYM),0,0}, + { "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0}, + { "STRING", SYM(STRING_SYM),0,0}, { "STRIPED", SYM(RAID_STRIPED_SYM),0,0}, { "SUBJECT", SYM(SUBJECT_SYM),0,0}, { "SUPER", SYM(SUPER_SYM),0,0}, @@ -393,13 +394,13 @@ static SYMBOL symbols[] = { { "TIME", SYM(TIME_SYM),0,0}, { "TIMESTAMP", SYM(TIMESTAMP),0,0}, { "TINYBLOB", SYM(TINYBLOB),0,0}, - { "TINYTEXT", SYM(TINYTEXT),0,0}, { "TINYINT", SYM(TINYINT),0,0}, + { "TINYTEXT", SYM(TINYTEXT),0,0}, + { "TO", SYM(TO_SYM),0,0}, { "TRAILING", SYM(TRAILING),0,0}, { "TRANSACTION", SYM(TRANSACTION_SYM),0,0}, - { "TRUNCATE", SYM(TRUNCATE_SYM),0,0}, { "TRUE", SYM(TRUE_SYM),0,0}, - { "TO", SYM(TO_SYM),0,0}, + { "TRUNCATE", SYM(TRUNCATE_SYM),0,0}, { "TYPE", SYM(TYPE_SYM),0,0}, { "TYPES", SYM(TYPES_SYM),0,0}, { "UNCOMMITTED", SYM(UNCOMMITTED_SYM),0,0}, @@ -408,32 +409,32 @@ static SYMBOL symbols[] = { { "UNIQUE", SYM(UNIQUE_SYM),0,0}, { "UNLOCK", SYM(UNLOCK_SYM),0,0}, { "UNSIGNED", SYM(UNSIGNED),0,0}, - { "USE", SYM(USE_SYM),0,0}, - { "USE_FRM", SYM(USE_FRM),0,0}, - { "USER", SYM(USER),0,0}, { "UNTIL", SYM(UNTIL_SYM),0,0}, + { "UPDATE", SYM(UPDATE_SYM),0,0}, + { "USAGE", SYM(USAGE),0,0}, + { "USE", SYM(USE_SYM),0,0}, + { "USER", SYM(USER),0,0}, + { "USER_RESOURCES", SYM(RESOURCES),0,0}, + { "USE_FRM", SYM(USE_FRM),0,0}, { "USING", SYM(USING),0,0}, { "UTC_DATE", SYM(UTC_DATE_SYM),0,0}, { "UTC_TIME", SYM(UTC_TIME_SYM),0,0}, { "UTC_TIMESTAMP", SYM(UTC_TIMESTAMP_SYM),0,0}, - { "UPDATE", SYM(UPDATE_SYM),0,0}, - { "USAGE", SYM(USAGE),0,0}, { "VALUE", SYM(VALUE_SYM),0,0}, { "VALUES", SYM(VALUES),0,0}, + { "VARBINARY", SYM(VARBINARY),0,0}, { "VARCHAR", SYM(VARCHAR),0,0}, { "VARCHARACTER", SYM(VARCHAR),0,0}, { "VARIABLES", SYM(VARIABLES),0,0}, { "VARYING", SYM(VARYING),0,0}, - { "VARBINARY", SYM(VARBINARY),0,0}, { "WARNINGS", SYM(WARNINGS),0,0}, + { "WHEN", SYM(WHEN_SYM),0,0}, + { "WHERE", SYM(WHERE),0,0}, { "WITH", SYM(WITH),0,0}, { "WORK", SYM(WORK_SYM),0,0}, { "WRITE", SYM(WRITE_SYM),0,0}, - { "WHEN", SYM(WHEN_SYM),0,0}, - { "WHERE", SYM(WHERE),0,0}, - { "NO_WRITE_TO_BINLOG", SYM(NO_WRITE_TO_BINLOG),0,0}, - { "XOR", SYM(XOR),0,0}, { "X509", SYM(X509_SYM),0,0}, + { "XOR", SYM(XOR),0,0}, { "YEAR", SYM(YEAR_SYM),0,0}, { "YEAR_MONTH", SYM(YEAR_MONTH_SYM),0,0}, { "ZEROFILL", SYM(ZEROFILL),0,0}, diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index a77e6e4333b..d6a0c51bdff 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -298,3 +298,4 @@ character-set=latin2 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 1e04ef7340b..1d889e6258e 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -292,3 +292,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index e9b0ac12e29..4798ea55b42 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -300,3 +300,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 233f57cec28..920ec433da0 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -289,3 +289,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index fa6201f9097..0c9b5c96308 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -294,3 +294,4 @@ character-set=latin7 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index dbc4cfeae5e..a9d3f9b049a 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -289,3 +289,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 1fa25990fc9..74f50289d86 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -301,3 +301,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 4d8a6d44099..5dfd1173467 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -289,3 +289,4 @@ character-set=greek "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 3a6e309435c..d454c51caba 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -291,3 +291,4 @@ character-set=latin2 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index fcc3379e138..18715b4930b 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -289,3 +289,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index c4bd5dab028..b034c8f657f 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -291,3 +291,4 @@ character-set=ujis "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 14112e5b6bd..df15d77c075 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -289,3 +289,4 @@ character-set=euckr "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 9b0274965a7..b46a52ae2de 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -291,3 +291,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 906e4702cab..3727e49d2ad 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -291,3 +291,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index c9229d0c522..1cb5b384e4b 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -293,3 +293,4 @@ character-set=latin2 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 9ff6325f935..ad845aac932 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -290,3 +290,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 34dd64daa2d..519f86e284c 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -293,3 +293,4 @@ character-set=latin2 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 6f22d1b87fd..ae186929898 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -291,3 +291,4 @@ character-set=koi8r "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index 98308190587..0719b88bec0 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -284,3 +284,4 @@ character-set=cp1250 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 5decce35dfd..cb5957fb892 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -297,3 +297,4 @@ character-set=latin2 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 00f31d351df..0e95efff5aa 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -291,3 +291,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index a53b6e4df3a..5edf41e0202 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -289,3 +289,4 @@ character-set=latin1 "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index e3a496831a2..8dbc2b582c9 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -294,3 +294,4 @@ character-set=koi8u "Unknown key cache '%-.100s'", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "Unknown table engine '%s'", +"'%s' is deprecated. Use '%s' instead.", diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ac193736be5..2ef7262f45c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1217,7 +1217,7 @@ store_create_info(THD *thd, TABLE *table, String *packet) packet->append("\n)", 2); if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode) { - packet->append(" TYPE=", 6); + packet->append(" ENGINE=", 8); packet->append(file->table_type()); if (table->table_charset && diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0d22df1be0f..0aa7e4c2738 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -42,6 +42,11 @@ int yylex(void *yylval, void *yythd); #define yyoverflow(A,B,C,D,E,F) if (my_yyoverflow((B),(D),(int*) (F))) { yyerror((char*) (A)); return 2; } +#define WARN_DEPRECATED(A,B) \ + push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN, \ + ER_WARN_DEPRECATED_SYNTAX, \ + ER(ER_WARN_DEPRECATED_SYNTAX), (A), (B)); + inline Item *or_or_concat(THD *thd, Item* A, Item* B) { return (thd->variables.sql_mode & MODE_PIPES_AS_CONCAT ? @@ -467,6 +472,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token ELSE %token ELT_FUNC %token ENCODE_SYM +%token ENGINE_SYM %token ENCRYPT %token EXPORT_SET %token EXTRACT_SYM @@ -1067,7 +1073,8 @@ create_table_options: | create_table_option ',' create_table_options; create_table_option: - TYPE_SYM opt_equal table_types { Lex->create_info.db_type= $3; } + ENGINE_SYM opt_equal table_types { Lex->create_info.db_type= $3; } + | TYPE_SYM opt_equal table_types { Lex->create_info.db_type= $3; WARN_DEPRECATED("TYPE=database_engine","ENGINE=database_engine"); } | MAX_ROWS opt_equal ulonglong_num { Lex->create_info.max_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MAX_ROWS;} | MIN_ROWS opt_equal ulonglong_num { Lex->create_info.min_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MIN_ROWS;} | AVG_ROW_LENGTH opt_equal ULONG_NUM { Lex->create_info.avg_row_length=$3; Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH;} @@ -3963,6 +3970,9 @@ show_param: lex->select_lex.db= $3; lex->select_lex.options= 0; } + | ENGINE_SYM table_types + { Lex->create_info.db_type= $2; } + show_engine_param | opt_full COLUMNS from_or_in table_ident opt_db wild { Lex->sql_command= SQLCOM_SHOW_FIELDS; @@ -4028,7 +4038,7 @@ show_param: | STATUS_SYM wild { Lex->sql_command= SQLCOM_SHOW_STATUS; } | INNOBASE_SYM STATUS_SYM - { Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;} + { Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS; WARN_DEPRECATED("SHOW INNODB STATUS", "SHOW ENGINE INNODB STATUS"); } | opt_full PROCESSLIST_SYM { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;} | opt_var_type VARIABLES wild @@ -4042,9 +4052,9 @@ show_param: | COLLATION_SYM wild { Lex->sql_command= SQLCOM_SHOW_COLLATIONS; } | BERKELEY_DB_SYM LOGS_SYM - { Lex->sql_command= SQLCOM_SHOW_LOGS; } + { Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW BDB LOGS", "SHOW ENGINE BDB LOGS"); } | LOGS_SYM - { Lex->sql_command= SQLCOM_SHOW_LOGS; } + { Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW LOGS", "SHOW ENGINE BDB LOGS"); } | GRANTS FOR_SYM user { LEX *lex=Lex; @@ -4073,6 +4083,30 @@ show_param: Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; }; +show_engine_param: + STATUS_SYM + { + switch (Lex->create_info.db_type) { + case DB_TYPE_INNODB: + Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS; + break; + default: + net_printf(YYTHD, ER_NOT_SUPPORTED_YET, "STATUS"); + YYABORT; + } + } + | LOGS_SYM + { + switch (Lex->create_info.db_type) { + case DB_TYPE_BERKELEY_DB: + Lex->sql_command = SQLCOM_SHOW_LOGS; + break; + default: + net_printf(YYTHD, ER_NOT_SUPPORTED_YET, "LOGS"); + YYABORT; + } + }; + master_or_binary: MASTER_SYM | BINARY; @@ -4617,6 +4651,7 @@ keyword: | DYNAMIC_SYM {} | END {} | ENUM {} + | ENGINE_SYM {} | ERRORS {} | ESCAPE_SYM {} | EVENTS_SYM {} From 4de973336f4fed6786da07f9c1a053330d2d1254 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 10 Dec 2003 15:27:33 +0400 Subject: [PATCH 15/40] changed usc2 -> koi8r to don't depend on extra-charset option. --- mysql-test/r/mysqldump.result | 8 ++++---- mysql-test/t/mysqldump.test | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index f5d98143f9e..ff1bee2923d 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -62,8 +62,8 @@ INSERT INTO t1 VALUES ("1\""), ("\"2"); DROP TABLE t1; -CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET ucs2; -INSERT INTO t1 VALUES (_ucs2 x'05D005D505DC05D9'); +CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r; +INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'); -- MySQL dump 10.2 -- -- Host: localhost Database: test @@ -82,7 +82,7 @@ INSERT INTO t1 VALUES (_ucs2 x'05D005D505DC05D9'); DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a varchar(255) default NULL -) TYPE=MyISAM DEFAULT CHARSET=ucs2; +) ENGINE=MyISAM DEFAULT CHARSET=koi8r; -- -- Dumping data for table `t1` @@ -91,7 +91,7 @@ CREATE TABLE t1 ( /*!40000 ALTER TABLE t1 DISABLE KEYS */; LOCK TABLES t1 WRITE; -INSERT INTO t1 VALUES ('×ולי'); +INSERT INTO t1 VALUES ('абцде'); UNLOCK TABLES; /*!40000 ALTER TABLE t1 ENABLE KEYS */; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 2004d5122f1..582fae0da36 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -27,7 +27,7 @@ DROP TABLE t1; # Bug #1994 # -CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET ucs2; -INSERT INTO t1 VALUES (_ucs2 x'05D005D505DC05D9'); +CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r; +INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'); --exec $MYSQL_DUMP test t1 DROP TABLE t1; From 3702a1dbc43e10565e1381bd4b52ea90d0dff4ea Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 10 Dec 2003 19:05:37 +0100 Subject: [PATCH 16/40] WL#1363: Update the mysql.proc table and add new fields. Also made the parsing and handling of SP characteristics more general and extendable, and added a few ch:istics. Docs/sp-imp-spec.txt: Updated spec with new schema. Docs/sp-implemented.txt: Added info about ALTER and SHOW. mysql-test/r/sp.result: Minor change in SHOW FUNCTION|PROCEDURE STATUS output. scripts/mysql_create_system_tables.sh: New mysql.proc schema. scripts/mysql_fix_privilege_tables.sql: New mysql.proc schema. sql/lex.h: New lex words for SP characteristics. sql/sp.cc: New mysql.proc schema. Also made the characteristics handling slightly more extendable. sql/sp.h: Made the characteristics handling slightly more extendable. sql/sp_head.cc: Made the characteristics handling slightly more extendable. sql/sp_head.h: Made the characteristics handling slightly more extendable. sql/sql_lex.h: Made the characteristics handling slightly more extendable. sql/sql_parse.cc: Made the characteristics handling slightly more extendable. sql/sql_yacc.yy: Made the characteristics handling slightly more extendable and made the parsing of characteristics more general, and added a few new dito. (LANGUAGE SQL, and [NOT] DETERMINISTIC for starters). --- Docs/sp-imp-spec.txt | 42 ++++++++++ Docs/sp-implemented.txt | 53 ++++++------ mysql-test/r/sp.result | 22 ++--- scripts/mysql_create_system_tables.sh | 50 +++++++++--- scripts/mysql_fix_privilege_tables.sql | 46 ++++++++--- sql/lex.h | 2 + sql/sp.cc | 103 ++++++++++++++---------- sql/sp.h | 8 +- sql/sp_head.cc | 6 +- sql/sp_head.h | 29 ++----- sql/sql_lex.h | 9 ++- sql/sql_parse.cc | 6 +- sql/sql_yacc.yy | 107 +++++++++++++++++-------- 13 files changed, 309 insertions(+), 174 deletions(-) diff --git a/Docs/sp-imp-spec.txt b/Docs/sp-imp-spec.txt index 6fee125fbea..b93416df2f7 100644 --- a/Docs/sp-imp-spec.txt +++ b/Docs/sp-imp-spec.txt @@ -1052,4 +1052,46 @@ /* Remove an SP from cache */ void sp_cache_remove(sp_cache **cp, sp_head *sp); + + - The mysql.proc schema: + + CREATE TABLE proc ( + schema char(64) binary DEFAULT '' NOT NULL, + name char(64) binary DEFAULT '' NOT NULL, + type enum('FUNCTION','PROCEDURE') NOT NULL, + specific_name char(64) binary DEFAULT '' NOT NULL, + language enum('SQL') DEFAULT 'SQL' NOT NULL, + sql_data_access enum('CONTAINS_SQL') DEFAULT 'CONTAINS_SQL' NOT NULL, + is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, + definition blob DEFAULT '' NOT NULL, + security_type enum('INVOKER','DEFINER') DEFAULT 'INVOKER' NOT NULL, + definer char(77) binary DEFAULT '' NOT NULL, + created timestamp, + modified timestamp, + sql_mode set( + 'REAL_AS_FLOAT', + 'PIPES_AS_CONCAT', + 'ANSI_QUOTES', + 'IGNORE_SPACE', + 'NOT_USED', + 'ONLY_FULL_GROUP_BY', + 'NO_UNSIGNED_SUBTRACTION', + 'NO_DIR_IN_CREATE', + 'POSTGRESQL', + 'ORACLE', + 'MSSQL', + 'DB2', + 'MAXDB', + 'NO_KEY_OPTIONS', + 'NO_TABLE_OPTIONS', + 'NO_FIELD_OPTIONS', + 'MYSQL323', + 'MYSQL40', + 'ANSI', + 'NO_AUTO_VALUE_ON_ZERO' + ) DEFAULT 0 NOT NULL, + comment char(64) binary DEFAULT '' NOT NULL, + PRIMARY KEY (schema,name,type) + ) comment='Stored Procedures'; + -- diff --git a/Docs/sp-implemented.txt b/Docs/sp-implemented.txt index c9112d75e43..e64b2476c31 100644 --- a/Docs/sp-implemented.txt +++ b/Docs/sp-implemented.txt @@ -1,9 +1,10 @@ -Stored Procedures implemented 2003-09-16: +Stored Procedures implemented 2003-12-10: Summary of Not Yet Implemented: - - SQL queries (like SELECT, INSERT, UPDATE etc) in FUNCTION bodies + - SQL statements using table (like SELECT, INSERT, UPDATE etc) + in FUNCTIONs - External languages - Access control - Routine characteristics (mostly used for external languages) @@ -25,18 +26,28 @@ Summary of what's implemented: - Prepared SP caching - CONDITIONs and HANDLERs - Simple read-only CURSORs. + - SHOW DECLARE PROCEDURE/FUNCTION and SHOW PROCEDURE/FUNCTION STATUS + List of what's implemented: - - CREATE PROCEDURE|FUNCTION name ( args ) body - No routine characteristics yet. + - CREATE PROCEDURE|FUNCTION name ( args ) characteristics body + where characteristics is: + LANGUAGE SQL | + [NOT] DETERMINISTIC | + SQL SECURITY [DEFINER|INVOKER] | + COMMENT string + However the DETERMINISTIC setting is not currently used. - - ALTER PROCEDURE|FUNCTION name ... - Is parsed, but a no-op (as there are no characteristics implemented yet). - CASCADE/RESTRICT is not implemented (and CASCADE probably will not be). + - ALTER PROCEDURE|FUNCTION name characteristics + CASCADE/RESTRICT is not implemented. + characteristics is: + COMMENT string | + SQL SECURITY [DEFINER|INVOKER] | + NAME newname - DROP PROCEDURE|FUNCTION [IF EXISTS] name - CASCADE/RESTRICT is not implemented (and CASCADE probably will not be). + CASCADE/RESTRICT is not implemented. - CALL name (args) OUT and INOUT parameters are only supported for local variables, and @@ -92,23 +103,9 @@ List of what's implemented: (The additional syntax will be added for completeness, but for the most part unsupported with the current underlying cursor mechanism.) -Closed questions: - - - What is the expected result when creating a procedure with a name that - already exists? An error or overwrite? - Answer: Error - - - Do PROCEDUREs and FUNCTIONs share namespace or not? I think not, but the - we need to flag the type in the mysql.proc table and the name alone is - not a unique key any more, or, we have separate tables. - (Unfortunately, mysql.func is already taken. Use "sfunc" and maybe even - rename "proc" into "sproc" while we still can, for consistency?) - Answer: Same tables, with an additional key-field for the type. - - -Open questions/issues: - - - SQL-99 variables and parameters are typed. For the present we don't do - any type checking, since this is the way MySQL works. I still don't know - if we should keep it this way, or implement type checking. Possibly we - should have optional, uset-settable, type checking. + - SHOW procedures and functions + SHOW DECLARE PROCEDURE|FUNCTION + returns the definition of a routine. + SHOW PROCEDURE|FUNCTION STATUS [LIKE ] + returns characteristics of routines, like the name, type, creator, + creation and modification dates, etc. diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index b8581674e5a..722d8f3773b 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -852,12 +852,12 @@ n f 20 2432902008176640000 drop table fac; show function status like '%f%'; -Name Type Creator Modified Created Suid Comment -fac function root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 Y +Name Type Definer Modified Created Security_type Comment +fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER drop procedure ifac; drop function fac; show function status like '%f%'; -Name Type Creator Modified Created Suid Comment +Name Type Definer Modified Created Security_type Comment drop table if exists primes; create table primes ( i int unsigned not null primary key, @@ -945,9 +945,9 @@ end if; end loop; end show procedure status like '%p%'; -Name Type Creator Modified Created Suid Comment -ip procedure root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 Y -opp procedure root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 Y +Name Type Definer Modified Created Security_type Comment +ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER +opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER call ip(200); select * from primes where i=45 or i=100 or i=199; i p @@ -958,7 +958,7 @@ drop table primes; drop procedure opp; drop procedure ip; show procedure status like '%p%'; -Name Type Creator Modified Created Suid Comment +Name Type Definer Modified Created Security_type Comment drop table if exists fib; create table fib ( f bigint unsigned not null ); insert into fib values (1), (1); @@ -1008,8 +1008,8 @@ create procedure bar(x char(16), y int) comment "111111111111" sql security invoker insert into test.t1 values (x, y); show procedure status like 'bar'; -Name Type Creator Modified Created Suid Comment -bar procedure root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 N 111111111111 +Name Type Definer Modified Created Security_type Comment +bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 alter procedure bar name bar2 comment "2222222222" sql security definer; alter procedure bar2 name bar comment "3333333333"; alter procedure bar; @@ -1019,8 +1019,8 @@ bar create procedure bar(x char(16), y int) comment "111111111111" sql security invoker insert into test.t1 values (x, y) show procedure status like 'bar'; -Name Type Creator Modified Created Suid Comment -bar procedure root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 Y 3333333333 +Name Type Definer Modified Created Security_type Comment +bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333 drop procedure bar; drop table t1; drop table t2; diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index c702a97f93d..7ae6773c1cf 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -289,19 +289,45 @@ fi if test ! -f $mdata/proc.frm then c_p="$c_p CREATE TABLE proc (" - c_p="$c_p name char(64) binary DEFAULT '' NOT NULL," - c_p="$c_p type enum('function','procedure') NOT NULL," - c_p="$c_p body blob DEFAULT '' NOT NULL," - c_p="$c_p creator char(77) binary DEFAULT '' NOT NULL," - c_p="$c_p modified timestamp," - c_p="$c_p created timestamp," - c_p="$c_p suid enum ('N', 'Y') DEFAULT 'Y' NOT NULL," - c_p="$c_p comment char(64) binary DEFAULT '' NOT NULL," - c_p="$c_p PRIMARY KEY (name,type)" - c_p="$c_p )" - c_p="$c_p comment='Stored Procedures';" + c_p="$c_p schema char(64) binary DEFAULT '' NOT NULL," + c_p="$c_p name char(64) binary DEFAULT '' NOT NULL," + c_p="$c_p type enum('FUNCTION','PROCEDURE') NOT NULL," + c_p="$c_p specific_name char(64) binary DEFAULT '' NOT NULL," + c_p="$c_p language enum('SQL') DEFAULT 'SQL' NOT NULL," + c_p="$c_p sql_data_access enum('CONTAINS_SQL') DEFAULT 'CONTAINS_SQL' NOT NULL," + c_p="$c_p is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL," + c_p="$c_p definition blob DEFAULT '' NOT NULL," + c_p="$c_p security_type enum('INVOKER','DEFINER') DEFAULT 'INVOKER' NOT NULL," + c_p="$c_p definer char(77) binary DEFAULT '' NOT NULL," + c_p="$c_p created timestamp," + c_p="$c_p modified timestamp," + c_p="$c_p sql_mode set(" + c_p="$c_p 'REAL_AS_FLOAT'," + c_p="$c_p 'PIPES_AS_CONCAT'," + c_p="$c_p 'ANSI_QUOTES'," + c_p="$c_p 'IGNORE_SPACE'," + c_p="$c_p 'NOT_USED'," + c_p="$c_p 'ONLY_FULL_GROUP_BY'," + c_p="$c_p 'NO_UNSIGNED_SUBTRACTION'," + c_p="$c_p 'NO_DIR_IN_CREATE'," + c_p="$c_p 'POSTGRESQL'," + c_p="$c_p 'ORACLE'," + c_p="$c_p 'MSSQL'," + c_p="$c_p 'DB2'," + c_p="$c_p 'MAXDB'," + c_p="$c_p 'NO_KEY_OPTIONS'," + c_p="$c_p 'NO_TABLE_OPTIONS'," + c_p="$c_p 'NO_FIELD_OPTIONS'," + c_p="$c_p 'MYSQL323'," + c_p="$c_p 'MYSQL40'," + c_p="$c_p 'ANSI'," + c_p="$c_p 'NO_AUTO_VALUE_ON_ZERO'" + c_p="$c_p ) DEFAULT 0 NOT NULL," + c_p="$c_p comment char(64) binary DEFAULT '' NOT NULL," + c_p="$c_p PRIMARY KEY (schema,name,type)" + c_p="$c_p ) comment='Stored Procedures';" fi - + cat << END_OF_DATA use mysql; $c_d diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index 4b571722bac..e342e08ea9d 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -140,14 +140,40 @@ unique index (name) # CREATE TABLE IF NOT EXISTS proc ( - name char(64) binary DEFAULT '' NOT NULL, - type enum('function','procedure') NOT NULL, - body blob DEFAULT '' NOT NULL, - creator char(77) binary DEFAULT '' NOT NULL, - modified timestamp, - created timestamp, - suid enum ('N', 'Y') DEFAULT 'Y' NOT NULL, - comment char(64) binary DEFAULT '' NOT NULL, - PRIMARY KEY (name,type) + schema char(64) binary DEFAULT '' NOT NULL, + name char(64) binary DEFAULT '' NOT NULL, + type enum('FUNCTION','PROCEDURE') NOT NULL, + specific_name char(64) binary DEFAULT '' NOT NULL, + language enum('SQL') DEFAULT 'SQL' NOT NULL, + sql_data_access enum('CONTAINS_SQL') DEFAULT 'CONTAINS_SQL' NOT NULL, + is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, + definition blob DEFAULT '' NOT NULL, + security_type enum('INVOKER','DEFINER') DEFAULT 'INVOKER' NOT NULL, + definer char(77) binary DEFAULT '' NOT NULL, + created timestamp, + modified timestamp, + sql_mode set( + 'REAL_AS_FLOAT', + 'PIPES_AS_CONCAT', + 'ANSI_QUOTES', + 'IGNORE_SPACE', + 'NOT_USED', + 'ONLY_FULL_GROUP_BY', + 'NO_UNSIGNED_SUBTRACTION', + 'NO_DIR_IN_CREATE', + 'POSTGRESQL', + 'ORACLE', + 'MSSQL', + 'DB2', + 'MAXDB', + 'NO_KEY_OPTIONS', + 'NO_TABLE_OPTIONS', + 'NO_FIELD_OPTIONS', + 'MYSQL323', + 'MYSQL40', + 'ANSI', + 'NO_AUTO_VALUE_ON_ZERO' + ) DEFAULT 0 NOT NULL, + comment char(64) binary DEFAULT '' NOT NULL, + PRIMARY KEY (schema,name,type) ) comment='Stored Procedures'; - diff --git a/sql/lex.h b/sql/lex.h index 9334b7e22cf..9dba8268e59 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -136,6 +136,7 @@ static SYMBOL symbols[] = { { "DELETE", SYM(DELETE_SYM),0,0}, { "DESC", SYM(DESC),0,0}, { "DESCRIBE", SYM(DESCRIBE),0,0}, + { "DETERMINISTIC", SYM(DETERMINISTIC_SYM),0,0}, { "DIRECTORY", SYM(DIRECTORY_SYM),0,0}, { "DISABLE", SYM(DISABLE_SYM),0,0}, { "DISCARD", SYM(DISCARD),0,0}, @@ -240,6 +241,7 @@ static SYMBOL symbols[] = { { "KEY", SYM(KEY_SYM),0,0}, { "KEYS", SYM(KEYS),0,0}, { "KILL", SYM(KILL_SYM),0,0}, + { "LANGUAGE", SYM(LANGUAGE_SYM),0,0}, { "LAST", SYM(LAST_SYM),0,0}, { "LEADING", SYM(LEADING),0,0}, { "LEAVE", SYM(LEAVE_SYM),0,0}, diff --git a/sql/sp.cc b/sql/sp.cc index b725614dfb8..d33114d50fd 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -26,15 +26,21 @@ * */ -#define MYSQL_PROC_FIELD_NAME 0 -#define MYSQL_PROC_FIELD_TYPE 1 -#define MYSQL_PROC_FIELD_DEFINITION 2 -#define MYSQL_PROC_FIELD_CREATOR 3 -#define MYSQL_PROC_FIELD_MODIFIED 4 -#define MYSQL_PROC_FIELD_CREATED 5 -#define MYSQL_PROC_FIELD_SUID 6 -#define MYSQL_PROC_FIELD_COMMENT 7 -#define MYSQL_PROC_FIELD_COUNT 8 +#define MYSQL_PROC_FIELD_SCHEMA 0 +#define MYSQL_PROC_FIELD_NAME 1 +#define MYSQL_PROC_FIELD_TYPE 2 +#define MYSQL_PROC_FIELD_SPECIFIC_NAME 3 +#define MYSQL_PROC_FIELD_LANGUAGE 4 +#define MYSQL_PROC_FIELD_ACCESS 5 +#define MYSQL_PROC_FIELD_DETERMINISTIC 6 +#define MYSQL_PROC_FIELD_DEFINITION 7 +#define MYSQL_PROC_FIELD_SECURITY_TYPE 8 +#define MYSQL_PROC_FIELD_DEFINER 9 +#define MYSQL_PROC_FIELD_CREATED 10 +#define MYSQL_PROC_FIELD_MODIFIED 11 +#define MYSQL_PROC_FIELD_SQL_MODE 12 +#define MYSQL_PROC_FIELD_COMMENT 13 +#define MYSQL_PROC_FIELD_COUNT 14 /* *opened=true means we opened ourselves */ static int @@ -44,17 +50,18 @@ db_find_routine_aux(THD *thd, int type, char *name, uint namelen, DBUG_ENTER("db_find_routine_aux"); DBUG_PRINT("enter", ("type: %d name: %*s", type, namelen, name)); TABLE *table; - byte key[65]; // We know name is 64 and the enum is 1 byte + byte key[64+64+1]; // schema, name, type uint keylen; int ret; // Put the key together + memset(key, (int)' ', 64); // QQ Empty schema for now keylen= namelen; - if (keylen > sizeof(key)-1) - keylen= sizeof(key)-1; - memcpy(key, name, keylen); - memset(key+keylen, (int)' ', sizeof(key)-1 - keylen); // Pad with space - key[sizeof(key)-1]= type; + if (keylen > 64) + keylen= 64; + memcpy(key+64, name, keylen); + memset(key+64+keylen, (int)' ', 64-keylen); // Pad with space + key[128]= type; keylen= sizeof(key); for (table= thd->open_tables ; table ; table= table->next) @@ -128,7 +135,7 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) // Get additional information if ((creator= get_field(&thd->mem_root, - table->field[MYSQL_PROC_FIELD_CREATOR])) == NULL) + table->field[MYSQL_PROC_FIELD_DEFINER])) == NULL) { ret= SP_GET_FIELD_FAILED; goto done; @@ -138,7 +145,7 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) created= table->field[MYSQL_PROC_FIELD_CREATED]->val_int(); if ((ptr= get_field(&thd->mem_root, - table->field[MYSQL_PROC_FIELD_SUID])) == NULL) + table->field[MYSQL_PROC_FIELD_SECURITY_TYPE])) == NULL) { ret= SP_GET_FIELD_FAILED; goto done; @@ -180,9 +187,9 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) else { *sphp= thd->lex->sphead; - (*sphp)->sp_set_info((char *) creator, (uint) strlen(creator), - created, modified, suid, - ptr, length); + (*sphp)->set_info((char *) creator, (uint) strlen(creator), + created, modified, suid, + ptr, length); } thd->lex->sql_command= oldcmd; } @@ -196,7 +203,7 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) static int db_create_routine(THD *thd, int type, char *name, uint namelen, char *def, uint deflen, - char *comment, uint commentlen, bool suid) + st_sp_chistics *chistics) { DBUG_ENTER("db_create_routine"); DBUG_PRINT("enter", ("type: %d name: %*s def: %*s", type, namelen, name, deflen, def)); @@ -224,17 +231,24 @@ db_create_routine(THD *thd, int type, table->field[MYSQL_PROC_FIELD_NAME]->store(name, namelen, system_charset_info); table->field[MYSQL_PROC_FIELD_TYPE]->store((longlong)type); + table->field[MYSQL_PROC_FIELD_SPECIFIC_NAME]->store(name, namelen, + system_charset_info); table->field[MYSQL_PROC_FIELD_DEFINITION]->store(def, deflen, system_charset_info); - table->field[MYSQL_PROC_FIELD_CREATOR]->store(creator, + table->field[MYSQL_PROC_FIELD_DEFINER]->store(creator, (uint)strlen(creator), system_charset_info); ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_CREATED])->set_time(); - if (!suid) - table->field[MYSQL_PROC_FIELD_SUID]->store((longlong) 1); - if (comment) - table->field[MYSQL_PROC_FIELD_COMMENT]->store(comment, commentlen, - system_charset_info); + if (chistics->suid != IS_DEFAULT_SUID) + table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]->store( + (longlong)chistics->suid); + table->field[MYSQL_PROC_FIELD_SQL_MODE]->store( + (longlong)thd->variables.sql_mode); + if (chistics->comment.str) + table->field[MYSQL_PROC_FIELD_COMMENT]->store( + chistics->comment.str, + chistics->comment.length, + system_charset_info); if (table->file->write_row(table->record[0])) ret= SP_WRITE_ROW_FAILED; @@ -271,7 +285,7 @@ db_drop_routine(THD *thd, int type, char *name, uint namelen) static int db_update_routine(THD *thd, int type, char *name, uint namelen, char *newname, uint newnamelen, - char *comment, uint commentlen, enum suid_behaviour suid) + st_sp_chistics *chistics) { DBUG_ENTER("db_update_routine"); DBUG_PRINT("enter", ("type: %d name: %*s", type, namelen, name)); @@ -284,15 +298,15 @@ db_update_routine(THD *thd, int type, char *name, uint namelen, { store_record(table,record[1]); ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_MODIFIED])->set_time(); - if (suid) - table->field[MYSQL_PROC_FIELD_SUID]->store((longlong) suid); + if (chistics->suid) + table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]->store((longlong)chistics->suid); if (newname) table->field[MYSQL_PROC_FIELD_NAME]->store(newname, newnamelen, system_charset_info); - if (comment) - table->field[MYSQL_PROC_FIELD_COMMENT]->store(comment, - commentlen, + if (chistics->comment.str) + table->field[MYSQL_PROC_FIELD_COMMENT]->store(chistics->comment.str, + chistics->comment.length, system_charset_info); if ((table->file->update_row(table->record[1],table->record[0]))) ret= SP_WRITE_ROW_FAILED; @@ -314,10 +328,10 @@ static struct st_used_field init_fields[]= { { "Name", NAME_LEN, MYSQL_TYPE_STRING, 0}, { "Type", 9, MYSQL_TYPE_STRING, 0}, - { "Creator", 77, MYSQL_TYPE_STRING, 0}, + { "Definer", 77, MYSQL_TYPE_STRING, 0}, { "Modified", 0, MYSQL_TYPE_TIMESTAMP, 0}, { "Created", 0, MYSQL_TYPE_TIMESTAMP, 0}, - { "Suid", 1, MYSQL_TYPE_STRING, 0}, + { "Security_type", 1, MYSQL_TYPE_STRING, 0}, { "Comment", NAME_LEN, MYSQL_TYPE_STRING, 0}, { 0, 0, MYSQL_TYPE_STRING, 0} }; @@ -347,6 +361,8 @@ print_field_values(THD *thd, TABLE *table, case MYSQL_TYPE_TIMESTAMP: { TIME tmp_time; + + bzero((char *)&tmp_time, sizeof(tmp_time)); ((Field_timestamp *) used_field->field)->get_time(&tmp_time); protocol->store(&tmp_time); } @@ -354,6 +370,7 @@ print_field_values(THD *thd, TABLE *table, default: { String *tmp_string1= new String(); + get_field(&thd->mem_root, used_field->field, tmp_string1); protocol->store(tmp_string1); } @@ -490,14 +507,14 @@ sp_find_procedure(THD *thd, LEX_STRING *name) int sp_create_procedure(THD *thd, char *name, uint namelen, char *def, uint deflen, - char *comment, uint commentlen, bool suid) + st_sp_chistics *chistics) { DBUG_ENTER("sp_create_procedure"); DBUG_PRINT("enter", ("name: %*s def: %*s", namelen, name, deflen, def)); int ret; ret= db_create_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen, def, deflen, - comment, commentlen, suid); + chistics); DBUG_RETURN(ret); } @@ -521,7 +538,7 @@ sp_drop_procedure(THD *thd, char *name, uint namelen) int sp_update_procedure(THD *thd, char *name, uint namelen, char *newname, uint newnamelen, - char *comment, uint commentlen, enum suid_behaviour suid) + st_sp_chistics *chistics) { DBUG_ENTER("sp_update_procedure"); DBUG_PRINT("enter", ("name: %*s", namelen, name)); @@ -533,7 +550,7 @@ sp_update_procedure(THD *thd, char *name, uint namelen, delete sp; ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen, newname, newnamelen, - comment, commentlen, suid); + chistics); DBUG_RETURN(ret); } @@ -585,14 +602,14 @@ sp_find_function(THD *thd, LEX_STRING *name) int sp_create_function(THD *thd, char *name, uint namelen, char *def, uint deflen, - char *comment, uint commentlen, bool suid) + st_sp_chistics *chistics) { DBUG_ENTER("sp_create_function"); DBUG_PRINT("enter", ("name: %*s def: %*s", namelen, name, deflen, def)); int ret; ret= db_create_routine(thd, TYPE_ENUM_FUNCTION, name, namelen, def, deflen, - comment, commentlen, suid); + chistics); DBUG_RETURN(ret); } @@ -616,7 +633,7 @@ sp_drop_function(THD *thd, char *name, uint namelen) int sp_update_function(THD *thd, char *name, uint namelen, char *newname, uint newnamelen, - char *comment, uint commentlen, enum suid_behaviour suid) + st_sp_chistics *chistics) { DBUG_ENTER("sp_update_procedure"); DBUG_PRINT("enter", ("name: %*s", namelen, name)); @@ -628,7 +645,7 @@ sp_update_function(THD *thd, char *name, uint namelen, delete sp; ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, namelen, newname, newnamelen, - comment, commentlen, suid); + chistics); DBUG_RETURN(ret); } diff --git a/sql/sp.h b/sql/sp.h index f957dd3c692..9bce886336d 100644 --- a/sql/sp.h +++ b/sql/sp.h @@ -33,7 +33,7 @@ sp_find_procedure(THD *thd, LEX_STRING *name); int sp_create_procedure(THD *thd, char *name, uint namelen, char *def, uint deflen, - char *comment, uint commentlen, bool suid); + st_sp_chistics *chistics); int sp_drop_procedure(THD *thd, char *name, uint namelen); @@ -42,7 +42,7 @@ sp_drop_procedure(THD *thd, char *name, uint namelen); int sp_update_procedure(THD *thd, char *name, uint namelen, char *newname, uint newnamelen, - char *comment, uint commentlen, enum suid_behaviour suid); + st_sp_chistics *chistics); int sp_show_create_procedure(THD *thd, LEX_STRING *name); @@ -55,7 +55,7 @@ sp_find_function(THD *thd, LEX_STRING *name); int sp_create_function(THD *thd, char *name, uint namelen, char *def, uint deflen, - char *comment, uint commentlen, bool suid); + st_sp_chistics *chistics); int sp_drop_function(THD *thd, char *name, uint namelen); @@ -63,7 +63,7 @@ sp_drop_function(THD *thd, char *name, uint namelen); int sp_update_function(THD *thd, char *name, uint namelen, char *newname, uint newnamelen, - char *comment, uint commentlen, enum suid_behaviour suid); + st_sp_chistics *chistics); int sp_show_create_function(THD *thd, LEX_STRING *name); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 78829896324..39669c5b86f 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -190,14 +190,12 @@ sp_head::create(THD *thd) ret= sp_create_function(thd, m_name.str, m_name.length, m_defstr.str, m_defstr.length, - m_comment.str, m_comment.length, - m_suid); + m_chistics); else ret= sp_create_procedure(thd, m_name.str, m_name.length, m_defstr.str, m_defstr.length, - m_comment.str, m_comment.length, - m_suid); + m_chistics); DBUG_RETURN(ret); } diff --git a/sql/sp_head.h b/sql/sp_head.h index 2a8f8a1e017..0f0c618ffb4 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -50,6 +50,7 @@ public: my_bool m_simple_case; // TRUE if parsing simple case, FALSE otherwise my_bool m_multi_results; // TRUE if a procedure with SELECT(s) uint m_old_cmq; // Old CLIENT_MULTI_QUERIES value + st_sp_chistics *m_chistics; #if NOT_USED_NOW // QQ We're not using this at the moment. List m_calls; // Called procedures. @@ -68,20 +69,6 @@ public: void init(LEX_STRING *name, LEX *lex); - void - init_options(LEX_STRING *comment, enum suid_behaviour suid) - { - m_comment.length= 0; - m_comment.str= 0; - if (comment) - { - m_comment.length= comment->length; - m_comment.str= comment->str; - } - m_suid= suid ? suid - 1 : 1; - } - - int create(THD *thd); @@ -154,17 +141,17 @@ public: return sp_map_result_type(m_returns); } - void sp_set_info(char *creator, uint creatorlen, - longlong created, longlong modified, - bool suid, char *comment, uint commentlen) + void set_info(char *creator, uint creatorlen, + longlong created, longlong modified, + bool suid, char *comment, uint commentlen) { m_creator= creator; m_creatorlen= creatorlen; m_created= created; m_modified= modified; - m_comment.length= commentlen; - m_comment.str= comment; - m_suid= suid; + m_chistics->comment.length= commentlen; + m_chistics->comment.str= comment; + m_chistics->suid= (suid ? IS_SUID : IS_NOT_SUID); } inline void reset_thd_mem_root(THD *thd) @@ -195,12 +182,10 @@ private: LEX_STRING m_name; LEX_STRING m_defstr; - LEX_STRING m_comment; char *m_creator; uint m_creatorlen; longlong m_created; longlong m_modified; - bool m_suid; sp_pcontext *m_pcont; // Parse context List m_lex; // Temp. store for the other lex diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 4199bb18548..181db61013f 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -517,6 +517,13 @@ public: typedef class st_select_lex SELECT_LEX; +struct st_sp_chistics +{ + LEX_STRING comment; + enum suid_behaviour suid; + bool detistic; +}; + /* The state of the lex parsing. This is saved in the THD struct */ typedef struct st_lex @@ -583,7 +590,6 @@ typedef struct st_lex enum enum_enable_or_disable alter_keys_onoff; enum enum_var_type option_type; enum tablespace_op_type tablespace_op; - enum suid_behaviour suid; uint uint_geom_type; uint grant, grant_tot_col, which_columns; uint fk_delete_opt, fk_update_opt, fk_match_option; @@ -598,6 +604,7 @@ typedef struct st_lex bool sp_lex_in_use; /* Keep track on lex usage in SPs for error handling */ sp_pcontext *spcont; HASH spfuns; /* Called functions */ + st_sp_chistics sp_chistics; st_lex() { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c8d5ebe0743..08a11d7c729 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3558,12 +3558,10 @@ mysql_execute_command(THD *thd) } if (lex->sql_command == SQLCOM_ALTER_PROCEDURE) res= sp_update_procedure(thd, lex->udf.name.str, lex->udf.name.length, - lex->name, newname_len, lex->comment->str, - lex->comment->length, lex->suid); + lex->name, newname_len, &lex->sp_chistics); else res= sp_update_function(thd, lex->udf.name.str, lex->udf.name.length, - lex->name, newname_len, lex->comment->str, - lex->comment->length, lex->suid); + lex->name, newname_len, &lex->sp_chistics); switch (res) { case SP_OK: diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a9035b18c23..369880486f9 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -139,6 +139,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token CUBE_SYM %token DEFINER_SYM %token DELETE_SYM +%token DETERMINISTIC_SYM %token DUAL_SYM %token DO_SYM %token DROP @@ -283,6 +284,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token LEAVES %token LEVEL_SYM %token LEX_HOSTNAME +%token LANGUAGE_SYM %token LIKE %token LINES %token LOCAL_SYM @@ -630,7 +632,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); 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 - SP_FUNC ident_or_spfunc sp_opt_label sp_comment sp_newname + SP_FUNC ident_or_spfunc sp_opt_label %type opt_table_alias @@ -761,6 +763,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); subselect_end select_var_list select_var_list_init help opt_len opt_extended_describe statement sp_suid + sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic sp_a_chistic END_OF_INPUT %type call sp_proc_stmts sp_proc_stmt @@ -1051,11 +1054,16 @@ create: } '(' sp_pdparam_list ')' { - Lex->spcont->set_params(); + LEX *lex= Lex; + + lex->spcont->set_params(); + bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); } - sp_comment sp_suid + sp_c_chistics { - Lex->sphead->init_options(&$9, Lex->suid); + LEX *lex= Lex; + + lex->sphead->m_chistics= &lex->sp_chistics; } sp_proc_stmt { @@ -1113,17 +1121,22 @@ create_function_tail: } RETURNS_SYM type { - Lex->sphead->m_returns= (enum enum_field_types)$7; + LEX *lex= Lex; + + lex->sphead->m_returns= (enum enum_field_types)$7; + bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); } - sp_comment sp_suid + sp_c_chistics { - Lex->sphead->init_options(&$9, Lex->suid); - } + LEX *lex= Lex; + + lex->sphead->m_chistics= &lex->sp_chistics; + } sp_proc_stmt { LEX *lex= Lex; - lex->sql_command = SQLCOM_CREATE_SPFUNCTION; + lex->sql_command= SQLCOM_CREATE_SPFUNCTION; /* Restore flag if it was cleared above */ if (lex->sphead->m_old_cmq) YYTHD->client_capabilities |= CLIENT_MULTI_QUERIES; @@ -1131,21 +1144,45 @@ create_function_tail: } ; -sp_comment: - /* Empty */ { $$.str= 0; $$.length= 0; } - | COMMENT_SYM TEXT_STRING_sys { $$= $2; } +sp_a_chistics: + /* Empty */ {} + | sp_a_chistics sp_a_chistic {} ; -sp_newname: - /* Empty */ { $$.str= 0; $$.length= 0; } - | NAME_SYM ident { $$= $2; } +sp_c_chistics: + /* Empty */ {} + | sp_c_chistics sp_c_chistic {} ; +/* Characteristics for both create and alter */ +sp_chistic: + COMMENT_SYM TEXT_STRING_sys { Lex->sp_chistics.comment= $2; } + | sp_suid { } + ; + +/* Alter characteristics */ +sp_a_chistic: + sp_chistic { } + | NAME_SYM ident { Lex->name= $2.str; } + ; + +/* Create characteristics */ +sp_c_chistic: + sp_chistic { } + | LANGUAGE_SYM SQL_SYM { } + | DETERMINISTIC_SYM { Lex->sp_chistics.detistic= TRUE; } + | NOT DETERMINISTIC_SYM { Lex->sp_chistics.detistic= FALSE; } + ; sp_suid: - /* Empty */ { Lex->suid= IS_DEFAULT_SUID; } - | SQL_SYM SECURITY_SYM DEFINER_SYM { Lex->suid= IS_SUID; } - | SQL_SYM SECURITY_SYM INVOKER_SYM { Lex->suid= IS_NOT_SUID; } + SQL_SYM SECURITY_SYM DEFINER_SYM + { + Lex->sp_chistics.suid= IS_SUID; + } + | SQL_SYM SECURITY_SYM INVOKER_SYM + { + Lex->sp_chistics.suid= IS_NOT_SUID; + } ; call: @@ -2648,36 +2685,35 @@ alter: lex->sql_command=SQLCOM_ALTER_DB; lex->name=$3.str; } - | ALTER PROCEDURE ident sp_newname sp_comment sp_suid - opt_restrict + | ALTER PROCEDURE ident + { + LEX *lex= Lex; + + bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); + Lex->name= 0; + } + sp_a_chistics { THD *thd= YYTHD; LEX *lex=Lex; lex->sql_command= SQLCOM_ALTER_PROCEDURE; lex->udf.name= $3; - lex->name= $4.str; - /* $5 is a yacc/bison internal struct, so we can't keep - the pointer to it for use outside the parser. */ - lex->comment= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING)); - lex->comment->str= $5.str; - lex->comment->length= $5.length; } - | ALTER FUNCTION_SYM ident sp_newname sp_comment sp_suid - opt_restrict + | ALTER FUNCTION_SYM ident + { + LEX *lex= Lex; + + bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); + lex->name= 0; + } + sp_a_chistics { THD *thd= YYTHD; LEX *lex=Lex; lex->sql_command= SQLCOM_ALTER_FUNCTION; lex->udf.name= $3; - lex->name= $4.str; - /* $5 is a yacc/bison internal struct, so we can't keep - the pointer to it for use outside the parser. */ - lex->comment= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING)); - lex->comment= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING)); - lex->comment->str= $5.str; - lex->comment->length= $5.length; } ; @@ -5775,6 +5811,7 @@ keyword: | INNOBASE_SYM {} | INSERT_METHOD {} | RELAY_THREAD {} + | LANGUAGE_SYM {} | LAST_SYM {} | LEAVES {} | LEVEL_SYM {} From 8086aa3542394a747aa39c29a061a93a8c1a5d65 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 11 Dec 2003 00:28:25 +0000 Subject: [PATCH 17/40] Fix for Bug #2075 - negative default values not accepted for integer columns Allow numeric literals have a sign sql/sql_yacc.yy: Bug#2075 - Numeric literals need to handle sign. mysql-test/r/create.result: New test for Bug #2075 mysql-test/t/create.test: New test for Bug #2075 --- mysql-test/r/create.result | 11 +++++++++++ mysql-test/t/create.test | 10 ++++++++++ sql/sql_yacc.yy | 19 ++++++++++++++----- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 5df29fee298..40569388456 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -423,6 +423,17 @@ strnull varchar(10) YES NULL intg int(11) YES NULL rel double YES NULL drop table t1, t2; +create table t1(name varchar(10), age smallint default -1); +describe t1; +Field Type Null Key Default Extra +name varchar(10) YES NULL +age smallint(6) YES -1 +create table t2(name varchar(10), age smallint default - 1); +describe t2; +Field Type Null Key Default Extra +name varchar(10) YES NULL +age smallint(6) YES -1 +drop table t1, t2; create database test_$1; use test_$1; select database(); diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 32565c0e20b..e50d5f41af3 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -330,6 +330,16 @@ create table t2 select default(str) as str, default(strnull) as strnull, default describe t2; drop table t1, t2; +# +# Bug #2075 +# + +create table t1(name varchar(10), age smallint default -1); +describe t1; +create table t2(name varchar(10), age smallint default - 1); +describe t2; +drop table t1, t2; + # # Bug #1209 # diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0aa7e4c2738..e1262561ea8 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -627,6 +627,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); using_list expr_or_default set_expr_or_default interval_expr param_marker singlerow_subselect singlerow_subselect_init exists_subselect exists_subselect_init + NUM_literal %type expr_list udf_expr_list when_list ident_list ident_list_arg @@ -4409,11 +4410,8 @@ param_marker: literal: text_literal { $$ = $1; } - | NUM { $$ = new Item_int($1.str, (longlong) strtol($1.str, NULL, 10),$1.length); } - | LONG_NUM { $$ = new Item_int($1.str, (longlong) strtoll($1.str,NULL,10), $1.length); } - | ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); } - | REAL_NUM { $$ = new Item_real($1.str, $1.length); } - | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } + | opt_plus NUM_literal { $$ = $2; } + | '-' NUM_literal { $$ = new Item_func_neg($2); } | NULL_SYM { $$ = new Item_null(); Lex->next_state=MY_LEX_OPERATOR_OR_IDENT;} | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);} @@ -4429,6 +4427,17 @@ literal: | TIME_SYM text_literal { $$ = $2; } | TIMESTAMP text_literal { $$ = $2; }; +opt_plus: + | '+' ; + +NUM_literal: + NUM { $$ = new Item_int($1.str, (longlong) strtol($1.str, NULL, 10),$1.length); } + | LONG_NUM { $$ = new Item_int($1.str, (longlong) strtoll($1.str,NULL,10), $1.length); } + | ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); } + | REAL_NUM { $$ = new Item_real($1.str, $1.length); } + | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } + ; + /********************************************************************** ** Createing different items. **********************************************************************/ From 5fb80a0439ba44905343538cc6c978bd099374c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 11 Dec 2003 12:02:26 +0100 Subject: [PATCH 18/40] mysqldump version updated --- client/mysqldump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index cdb0a62d4cc..5c3fa44e30b 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -37,7 +37,7 @@ ** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov */ -#define DUMP_VERSION "10.2" +#define DUMP_VERSION "10.3" #include #include From b5627bb00c8c60caefd428e70bfddfc7f03a5667 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 11 Dec 2003 12:23:50 +0100 Subject: [PATCH 19/40] WL#1364: Store some environmental values with SPs and use at invokation sql_mode is stored and used with SPs. sql_select_limit is always unlimited in SPs. mysql-test/r/sp.result: Test case for mode settings. mysql-test/t/sp.test: Test case for mode settings. sql/sp.cc: Store the sql_mode with the SP and reset it on retrieval. sql_select_limit is always maximum (default) in an SP, regardless of the setting at the time of create or call. --- mysql-test/r/sp.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/sp.test | 35 +++++++++++++++++++++++++++++++++++ sql/sp.cc | 10 ++++++++++ 3 files changed, 73 insertions(+) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 722d8f3773b..e0d72a77832 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -691,6 +691,34 @@ delete from t1; delete from t2; drop table t3; drop procedure cur2; +insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3); +set @@sql_mode = 'ANSI'; +create procedure modes(out c1 int, out c2 int) +begin +declare done int default 0; +declare x int; +declare continue handler for sqlstate '02000' set done = 1; +declare c cursor for select data from t1; +select 1 || 2 into c1; +set c2 = 0; +open c; +repeat +fetch c into x; +if not done then +set c2 = c2 + 1; +end if; +until done end repeat; +close c; +end; +set @@sql_mode = ''; +set sql_select_limit = 1; +call modes(@c1, @c2); +set sql_select_limit = default; +select @c1, @c2; +@c1 @c2 +12 3 +delete from t1; +drop procedure modes; create procedure bug822(a_id char(16), a_data int) begin declare n int; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 3c4c850ba79..933fe828440 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -816,6 +816,41 @@ drop table t3| drop procedure cur2| +# Check mode settings +insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)| + +set @@sql_mode = 'ANSI'| +delimiter $| +create procedure modes(out c1 int, out c2 int) +begin + declare done int default 0; + declare x int; + declare continue handler for sqlstate '02000' set done = 1; + declare c cursor for select data from t1; + + select 1 || 2 into c1; + set c2 = 0; + open c; + repeat + fetch c into x; + if not done then + set c2 = c2 + 1; + end if; + until done end repeat; + close c; +end$ +delimiter |$ +set @@sql_mode = ''| + +set sql_select_limit = 1| +call modes(@c1, @c2)| +set sql_select_limit = default| + +select @c1, @c2| +delete from t1| +drop procedure modes| + + # # Test cases for old bugs # diff --git a/sql/sp.cc b/sql/sp.cc index d33114d50fd..42b0ba001a6 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -115,6 +115,7 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) uint length; char buff[65]; String str(buff, sizeof(buff), &my_charset_bin); + ulong sql_mode; ret= db_find_routine_aux(thd, type, name, namelen, TL_READ, &table, &opened); if (ret != SP_OK) @@ -153,6 +154,8 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) if (ptr[0] == 'N') suid= 0; + sql_mode= table->field[MYSQL_PROC_FIELD_SQL_MODE]->val_int(); + table->field[MYSQL_PROC_FIELD_COMMENT]->val_str(&str, &str); ptr= 0; @@ -168,6 +171,11 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) { LEX *oldlex= thd->lex; enum enum_sql_command oldcmd= thd->lex->sql_command; + ulong old_sql_mode= thd->variables.sql_mode; + ha_rows select_limit= thd->variables.select_limit; + + thd->variables.sql_mode= sql_mode; + thd->variables.select_limit= HA_POS_ERROR; lex_start(thd, (uchar*)defstr, strlen(defstr)); if (yyparse(thd) || thd->is_fatal_error || thd->lex->sphead == NULL) @@ -192,6 +200,8 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) ptr, length); } thd->lex->sql_command= oldcmd; + thd->variables.sql_mode= old_sql_mode; + thd->variables.select_limit= select_limit; } done: From 18ebd6344003dda25b70fc3921e34867179d3c15 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 11 Dec 2003 16:05:51 +0000 Subject: [PATCH 20/40] Bug#2075 - fix reduce/reduce sql/sql_yacc.yy: Fix reduce/reduce introduced when fixing Bug#2075 --- sql/sql_yacc.yy | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e1262561ea8..3e013d89992 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -627,7 +627,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); using_list expr_or_default set_expr_or_default interval_expr param_marker singlerow_subselect singlerow_subselect_init exists_subselect exists_subselect_init - NUM_literal + signed_literal NUM_literal %type expr_list udf_expr_list when_list ident_list ident_list_arg @@ -1437,7 +1437,7 @@ opt_attribute_list: attribute: NULL_SYM { Lex->type&= ~ NOT_NULL_FLAG; } | NOT NULL_SYM { Lex->type|= NOT_NULL_FLAG; } - | DEFAULT literal { Lex->default_value=$2; } + | DEFAULT signed_literal { Lex->default_value=$2; } | AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; } | SERIAL_SYM DEFAULT VALUE_SYM { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG; } @@ -1749,7 +1749,7 @@ alter_list_item: } | DISABLE_SYM KEYS { Lex->alter_keys_onoff=DISABLE; } | ENABLE_SYM KEYS { Lex->alter_keys_onoff=ENABLE; } - | ALTER opt_column field_ident SET DEFAULT literal + | ALTER opt_column field_ident SET DEFAULT signed_literal { LEX *lex=Lex; lex->alter_list.push_back(new Alter_column($3.str,$6)); @@ -4408,10 +4408,16 @@ param_marker: } ; +signed_literal: + literal { $$ = $1; } + | '+' NUM_literal { $$ = $2; } + | '-' NUM_literal { $$ = new Item_func_neg($2); } + ; + + literal: text_literal { $$ = $1; } - | opt_plus NUM_literal { $$ = $2; } - | '-' NUM_literal { $$ = new Item_func_neg($2); } + | NUM_literal { $$ = $1; } | NULL_SYM { $$ = new Item_null(); Lex->next_state=MY_LEX_OPERATOR_OR_IDENT;} | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);} @@ -4427,9 +4433,6 @@ literal: | TIME_SYM text_literal { $$ = $2; } | TIMESTAMP text_literal { $$ = $2; }; -opt_plus: - | '+' ; - NUM_literal: NUM { $$ = new Item_int($1.str, (longlong) strtol($1.str, NULL, 10),$1.length); } | LONG_NUM { $$ = new Item_int($1.str, (longlong) strtoll($1.str,NULL,10), $1.length); } From cabd28c68c68c2d673b778d43bd3fdbabb0a8968 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 12 Dec 2003 14:05:29 +0100 Subject: [PATCH 21/40] In order to make ALTER PROCEDURE|FUNCTION work correctly, and in general to make characteristics (and SHOW) work right, we had to separate the old definition blob in the mysql.proc table into separate fields for parameters, return type, and body, and handle the characteristics (like SQL SECURITY) separately... and then reassemble the CREATE string for parsing, of course. This is rather ugly, mostly the parser bit. (Hopefully that will be better with the new parser.) Docs/sp-imp-spec.txt: Separated the definitions string of the procedure into different columns in the mysql.proc schema. mysql-test/r/sp.result: New characteristics tests. mysql-test/t/sp.test: New characteristics tests. scripts/mysql_create_system_tables.sh: Separated the definitions string of the procedure into different columns in the mysql.proc schema. scripts/mysql_fix_privilege_tables.sql: Separated the definitions string of the procedure into different columns in the mysql.proc schema. sql/sp.cc: Separated the definitions string of the procedure into different columns. Rewrote much of the code related this (have a assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp.h: Changed prototypes. sql/sp_head.cc: Rewrote much of the code related to the new mysql.proc schema with separate definition fields (have to assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp_head.h: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. sql/sql_yacc.yy: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. This is ugly and messy; hopefully there's a more elegant way to do this when the new parser is installed. --- Docs/sp-imp-spec.txt | 11 +- mysql-test/r/sp.result | 49 +++++- mysql-test/t/sp.test | 30 ++++ scripts/mysql_create_system_tables.sh | 6 +- scripts/mysql_fix_privilege_tables.sql | 6 +- sql/sp.cc | 223 +++++++++++++++++-------- sql/sp.h | 6 +- sql/sp_head.cc | 57 +++++-- sql/sp_head.h | 33 ++-- sql/sql_yacc.yy | 39 ++++- 10 files changed, 340 insertions(+), 120 deletions(-) diff --git a/Docs/sp-imp-spec.txt b/Docs/sp-imp-spec.txt index b93416df2f7..ee9bc7a0e4f 100644 --- a/Docs/sp-imp-spec.txt +++ b/Docs/sp-imp-spec.txt @@ -1063,8 +1063,10 @@ language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, - definition blob DEFAULT '' NOT NULL, - security_type enum('INVOKER','DEFINER') DEFAULT 'INVOKER' NOT NULL, + security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, + param_list blob DEFAULT '' NOT NULL, + returns char(64) DEFAULT '' NOT NULL, + body blob DEFAULT '' NOT NULL, definer char(77) binary DEFAULT '' NOT NULL, created timestamp, modified timestamp, @@ -1093,5 +1095,6 @@ comment char(64) binary DEFAULT '' NOT NULL, PRIMARY KEY (schema,name,type) ) comment='Stored Procedures'; - --- + + -- + \ No newline at end of file diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index e0d72a77832..851d56ba458 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -691,6 +691,43 @@ delete from t1; delete from t2; drop table t3; drop procedure cur2; +create procedure chistics() +language sql +not deterministic +sql security definer +comment 'Characteristics procedure test' + insert into t1 values ("chistics", 1); +call chistics(); +select * from t1; +id data +chistics 1 +delete from t1; +alter procedure chistics sql security invoker name chistics2; +show create procedure chistics2; +Procedure Create Procedure +chistics2 CREATE PROCEDURE chistics2() + SQL SECURITY INVOKER + COMMENT 'Characteristics procedure test' +insert into t1 values ("chistics", 1) +drop procedure chistics2; +create function chistics() returns int +language sql +deterministic +sql security invoker +comment 'Characteristics procedure test' + return 42; +select chistics(); +chistics() +42 +alter function chistics name chistics2 comment 'Characteristics function test'; +show create function chistics2; +Function Create Function +chistics2 CREATE FUNCTION chistics2() RETURNS int + DETERMINISTIC + SQL SECURITY INVOKER + COMMENT 'Characteristics function test' +return 42 +drop function chistics2; insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3); set @@sql_mode = 'ANSI'; create procedure modes(out c1 int, out c2 int) @@ -881,7 +918,7 @@ n f drop table fac; show function status like '%f%'; Name Type Definer Modified Created Security_type Comment -fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER +fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER drop procedure ifac; drop function fac; show function status like '%f%'; @@ -946,7 +983,7 @@ end while; end; show create procedure opp; Procedure Create Procedure -opp create procedure opp(n bigint unsigned, out pp bool) +opp CREATE PROCEDURE opp(n bigint unsigned, out pp bool) begin declare r double; declare b, s bigint unsigned default 0; @@ -974,8 +1011,8 @@ end loop; end show procedure status like '%p%'; Name Type Definer Modified Created Security_type Comment -ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER -opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER +ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER call ip(200); select * from primes where i=45 or i=100 or i=199; i p @@ -1043,8 +1080,8 @@ alter procedure bar2 name bar comment "3333333333"; alter procedure bar; show create procedure bar; Procedure Create Procedure -bar create procedure bar(x char(16), y int) -comment "111111111111" sql security invoker +bar CREATE PROCEDURE bar(x char(16), y int) + COMMENT '3333333333' insert into test.t1 values (x, y) show procedure status like 'bar'; Name Type Definer Modified Created Security_type Comment diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 933fe828440..3681d9a9517 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -816,6 +816,36 @@ drop table t3| drop procedure cur2| +# The few characteristics we parse +create procedure chistics() + language sql + not deterministic + sql security definer + comment 'Characteristics procedure test' + insert into t1 values ("chistics", 1)| + +# Call it, just to make sure. +call chistics()| +select * from t1| +delete from t1| +alter procedure chistics sql security invoker name chistics2| +show create procedure chistics2| +drop procedure chistics2| + +create function chistics() returns int + language sql + deterministic + sql security invoker + comment 'Characteristics procedure test' + return 42| + +# Call it, just to make sure. +select chistics()| +alter function chistics name chistics2 comment 'Characteristics function test'| +show create function chistics2| +drop function chistics2| + + # Check mode settings insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)| diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index 7ae6773c1cf..57198abd53a 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -296,8 +296,10 @@ then c_p="$c_p language enum('SQL') DEFAULT 'SQL' NOT NULL," c_p="$c_p sql_data_access enum('CONTAINS_SQL') DEFAULT 'CONTAINS_SQL' NOT NULL," c_p="$c_p is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL," - c_p="$c_p definition blob DEFAULT '' NOT NULL," - c_p="$c_p security_type enum('INVOKER','DEFINER') DEFAULT 'INVOKER' NOT NULL," + c_p="$c_p security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL," + c_p="$c_p param_list blob DEFAULT '' NOT NULL," + c_p="$c_p returns char(64) DEFAULT '' NOT NULL," + c_p="$c_p body blob DEFAULT '' NOT NULL," c_p="$c_p definer char(77) binary DEFAULT '' NOT NULL," c_p="$c_p created timestamp," c_p="$c_p modified timestamp," diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index e342e08ea9d..788913fa38e 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -147,8 +147,10 @@ CREATE TABLE IF NOT EXISTS proc ( language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, - definition blob DEFAULT '' NOT NULL, - security_type enum('INVOKER','DEFINER') DEFAULT 'INVOKER' NOT NULL, + security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, + param_list blob DEFAULT '' NOT NULL, + returns char(64) DEFAULT '' NOT NULL, + body blob DEFAULT '' NOT NULL, definer char(77) binary DEFAULT '' NOT NULL, created timestamp, modified timestamp, diff --git a/sql/sp.cc b/sql/sp.cc index 42b0ba001a6..ded45102815 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -20,27 +20,41 @@ #include "sp_head.h" #include "sp_cache.h" +static char * +create_string(THD *thd, ulong *lenp, + int sp_type, + char *name, ulong namelen, + const char *params, ulong paramslen, + const char *returns, ulong returnslen, + const char *body, ulong bodylen, + st_sp_chistics *chistics); + /* * * DB storage of Stored PROCEDUREs and FUNCTIONs * */ -#define MYSQL_PROC_FIELD_SCHEMA 0 -#define MYSQL_PROC_FIELD_NAME 1 -#define MYSQL_PROC_FIELD_TYPE 2 -#define MYSQL_PROC_FIELD_SPECIFIC_NAME 3 -#define MYSQL_PROC_FIELD_LANGUAGE 4 -#define MYSQL_PROC_FIELD_ACCESS 5 -#define MYSQL_PROC_FIELD_DETERMINISTIC 6 -#define MYSQL_PROC_FIELD_DEFINITION 7 -#define MYSQL_PROC_FIELD_SECURITY_TYPE 8 -#define MYSQL_PROC_FIELD_DEFINER 9 -#define MYSQL_PROC_FIELD_CREATED 10 -#define MYSQL_PROC_FIELD_MODIFIED 11 -#define MYSQL_PROC_FIELD_SQL_MODE 12 -#define MYSQL_PROC_FIELD_COMMENT 13 -#define MYSQL_PROC_FIELD_COUNT 14 +enum +{ + MYSQL_PROC_FIELD_SCHEMA = 0, + MYSQL_PROC_FIELD_NAME, + MYSQL_PROC_FIELD_TYPE, + MYSQL_PROC_FIELD_SPECIFIC_NAME, + MYSQL_PROC_FIELD_LANGUAGE, + MYSQL_PROC_FIELD_ACCESS, + MYSQL_PROC_FIELD_DETERMINISTIC, + MYSQL_PROC_FIELD_SECURITY_TYPE, + MYSQL_PROC_FIELD_PARAM_LIST, + MYSQL_PROC_FIELD_RETURNS, + MYSQL_PROC_FIELD_BODY, + MYSQL_PROC_FIELD_DEFINER, + MYSQL_PROC_FIELD_CREATED, + MYSQL_PROC_FIELD_MODIFIED, + MYSQL_PROC_FIELD_SQL_MODE, + MYSQL_PROC_FIELD_COMMENT, + MYSQL_PROC_FIELD_COUNT +}; /* *opened=true means we opened ourselves */ static int @@ -104,13 +118,13 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) DBUG_PRINT("enter", ("type: %d name: %*s", type, namelen, name)); extern int yyparse(void *thd); TABLE *table; - const char *defstr; + const char *params, *returns, *body; int ret; bool opened; const char *creator; longlong created; longlong modified; - bool suid= 1; + st_sp_chistics *chistics; char *ptr; uint length; char buff[65]; @@ -127,8 +141,40 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) goto done; } - if ((defstr= get_field(&thd->mem_root, - table->field[MYSQL_PROC_FIELD_DEFINITION])) == NULL) + if ((ptr= get_field(&thd->mem_root, + table->field[MYSQL_PROC_FIELD_DETERMINISTIC])) == NULL) + { + ret= SP_GET_FIELD_FAILED; + goto done; + } + chistics= (st_sp_chistics *)thd->alloc(sizeof(st_sp_chistics)); + chistics->detistic= (ptr[0] == 'N' ? FALSE : TRUE); + + if ((ptr= get_field(&thd->mem_root, + table->field[MYSQL_PROC_FIELD_SECURITY_TYPE])) == NULL) + { + ret= SP_GET_FIELD_FAILED; + goto done; + } + chistics->suid= (ptr[0] == 'I' ? IS_NOT_SUID : IS_SUID); + + if ((params= get_field(&thd->mem_root, + table->field[MYSQL_PROC_FIELD_PARAM_LIST])) == NULL) + { + params= ""; + } + + if (type == TYPE_ENUM_PROCEDURE) + returns= ""; + else if ((returns= get_field(&thd->mem_root, + table->field[MYSQL_PROC_FIELD_RETURNS])) == NULL) + { + ret= SP_GET_FIELD_FAILED; + goto done; + } + + if ((body= get_field(&thd->mem_root, + table->field[MYSQL_PROC_FIELD_BODY])) == NULL) { ret= SP_GET_FIELD_FAILED; goto done; @@ -145,22 +191,15 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) modified= table->field[MYSQL_PROC_FIELD_MODIFIED]->val_int(); created= table->field[MYSQL_PROC_FIELD_CREATED]->val_int(); - if ((ptr= get_field(&thd->mem_root, - table->field[MYSQL_PROC_FIELD_SECURITY_TYPE])) == NULL) - { - ret= SP_GET_FIELD_FAILED; - goto done; - } - if (ptr[0] == 'N') - suid= 0; - sql_mode= table->field[MYSQL_PROC_FIELD_SQL_MODE]->val_int(); table->field[MYSQL_PROC_FIELD_COMMENT]->val_str(&str, &str); ptr= 0; if ((length= str.length())) - ptr= strmake_root(&thd->mem_root, str.ptr(), length); + ptr= thd->strmake(str.ptr(), length); + chistics->comment.str= ptr; + chistics->comment.length= length; if (opened) { @@ -169,6 +208,8 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) } { + char *defstr; + ulong deflen; LEX *oldlex= thd->lex; enum enum_sql_command oldcmd= thd->lex->sql_command; ulong old_sql_mode= thd->variables.sql_mode; @@ -177,7 +218,14 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) thd->variables.sql_mode= sql_mode; thd->variables.select_limit= HA_POS_ERROR; - lex_start(thd, (uchar*)defstr, strlen(defstr)); + defstr= create_string(thd, &deflen, + type, + name, namelen, + params, strlen(params), + returns, strlen(returns), + body, strlen(body), + chistics); + lex_start(thd, (uchar*)defstr, deflen); if (yyparse(thd) || thd->is_fatal_error || thd->lex->sphead == NULL) { LEX *newlex= thd->lex; @@ -196,8 +244,7 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) { *sphp= thd->lex->sphead; (*sphp)->set_info((char *) creator, (uint) strlen(creator), - created, modified, suid, - ptr, length); + created, modified, chistics); } thd->lex->sql_command= oldcmd; thd->variables.sql_mode= old_sql_mode; @@ -211,12 +258,10 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) } static int -db_create_routine(THD *thd, int type, - char *name, uint namelen, char *def, uint deflen, - st_sp_chistics *chistics) +db_create_routine(THD *thd, int type, sp_head *sp) { DBUG_ENTER("db_create_routine"); - DBUG_PRINT("enter", ("type: %d name: %*s def: %*s", type, namelen, name, deflen, def)); + DBUG_PRINT("enter", ("type: %d name: %*s",type,sp->m_name.length,sp->m_name.str)); int ret; TABLE *table; TABLE_LIST tables; @@ -238,27 +283,33 @@ db_create_routine(THD *thd, int type, ret= SP_GET_FIELD_FAILED; goto done; } - table->field[MYSQL_PROC_FIELD_NAME]->store(name, namelen, - system_charset_info); - table->field[MYSQL_PROC_FIELD_TYPE]->store((longlong)type); - table->field[MYSQL_PROC_FIELD_SPECIFIC_NAME]->store(name, namelen, - system_charset_info); - table->field[MYSQL_PROC_FIELD_DEFINITION]->store(def, deflen, - system_charset_info); - table->field[MYSQL_PROC_FIELD_DEFINER]->store(creator, - (uint)strlen(creator), - system_charset_info); + table->field[MYSQL_PROC_FIELD_NAME]-> + store(sp->m_name.str, sp->m_name.length, system_charset_info); + table->field[MYSQL_PROC_FIELD_TYPE]-> + store((longlong)type); + table->field[MYSQL_PROC_FIELD_SPECIFIC_NAME]-> + store(sp->m_name.str, sp->m_name.length, system_charset_info); + table->field[MYSQL_PROC_FIELD_DETERMINISTIC]-> + store((longlong)(sp->m_chistics->detistic ? 1 : 2)); + if (sp->m_chistics->suid != IS_DEFAULT_SUID) + table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]-> + store((longlong)sp->m_chistics->suid); + table->field[MYSQL_PROC_FIELD_PARAM_LIST]-> + store(sp->m_params.str, sp->m_params.length, system_charset_info); + if (sp->m_retstr.str) + table->field[MYSQL_PROC_FIELD_RETURNS]-> + store(sp->m_retstr.str, sp->m_retstr.length, system_charset_info); + table->field[MYSQL_PROC_FIELD_BODY]-> + store(sp->m_body.str, sp->m_body.length, system_charset_info); + table->field[MYSQL_PROC_FIELD_DEFINER]-> + store(creator, (uint)strlen(creator), system_charset_info); ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_CREATED])->set_time(); - if (chistics->suid != IS_DEFAULT_SUID) - table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]->store( - (longlong)chistics->suid); - table->field[MYSQL_PROC_FIELD_SQL_MODE]->store( - (longlong)thd->variables.sql_mode); - if (chistics->comment.str) - table->field[MYSQL_PROC_FIELD_COMMENT]->store( - chistics->comment.str, - chistics->comment.length, - system_charset_info); + table->field[MYSQL_PROC_FIELD_SQL_MODE]-> + store((longlong)thd->variables.sql_mode); + if (sp->m_chistics->comment.str) + table->field[MYSQL_PROC_FIELD_COMMENT]-> + store(sp->m_chistics->comment.str, sp->m_chistics->comment.length, + system_charset_info); if (table->file->write_row(table->record[0])) ret= SP_WRITE_ROW_FAILED; @@ -308,7 +359,7 @@ db_update_routine(THD *thd, int type, char *name, uint namelen, { store_record(table,record[1]); ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_MODIFIED])->set_time(); - if (chistics->suid) + if (chistics->suid != IS_DEFAULT_SUID) table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]->store((longlong)chistics->suid); if (newname) table->field[MYSQL_PROC_FIELD_NAME]->store(newname, @@ -516,15 +567,13 @@ sp_find_procedure(THD *thd, LEX_STRING *name) } int -sp_create_procedure(THD *thd, char *name, uint namelen, char *def, uint deflen, - st_sp_chistics *chistics) +sp_create_procedure(THD *thd, sp_head *sp) { DBUG_ENTER("sp_create_procedure"); - DBUG_PRINT("enter", ("name: %*s def: %*s", namelen, name, deflen, def)); + DBUG_PRINT("enter", ("name: %*s", sp->m_name.length, sp->m_name.str)); int ret; - ret= db_create_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen, def, deflen, - chistics); + ret= db_create_routine(thd, TYPE_ENUM_PROCEDURE, sp); DBUG_RETURN(ret); } @@ -611,15 +660,13 @@ sp_find_function(THD *thd, LEX_STRING *name) } int -sp_create_function(THD *thd, char *name, uint namelen, char *def, uint deflen, - st_sp_chistics *chistics) +sp_create_function(THD *thd, sp_head *sp) { DBUG_ENTER("sp_create_function"); - DBUG_PRINT("enter", ("name: %*s def: %*s", namelen, name, deflen, def)); + DBUG_PRINT("enter", ("name: %*s", sp->m_name.length, sp->m_name.str)); int ret; - ret= db_create_routine(thd, TYPE_ENUM_FUNCTION, name, namelen, def, deflen, - chistics); + ret= db_create_routine(thd, TYPE_ENUM_FUNCTION, sp); DBUG_RETURN(ret); } @@ -774,3 +821,45 @@ sp_cache_functions(THD *thd, LEX *lex) } return ret; } + +static char * +create_string(THD *thd, ulong *lenp, + int type, + char *name, ulong namelen, + const char *params, ulong paramslen, + const char *returns, ulong returnslen, + const char *body, ulong bodylen, + st_sp_chistics *chistics) +{ + char *buf, *ptr; + ulong buflen, pos; + + buflen= 100 + namelen + paramslen + returnslen + bodylen + + chistics->comment.length; + ptr= buf= thd->alloc(buflen); + if (type == TYPE_ENUM_FUNCTION) + { + ptr+= my_sprintf(buf, + (buf, (char *) + "CREATE FUNCTION %s(%s) RETURNS %s\n", + name, params, returns)); + } + else + { + ptr+= my_sprintf(buf, + (buf, (char *) + "CREATE PROCEDURE %s(%s)\n", + name, params)); + } + if (chistics->detistic) + ptr+= my_sprintf(ptr, (ptr, (char *)" DETERMINISTIC\n")); + if (chistics->suid == IS_NOT_SUID) + ptr+= my_sprintf(ptr, (ptr, (char *)" SQL SECURITY INVOKER\n")); + if (chistics->comment.str) + ptr+= my_sprintf(ptr, (ptr, (char *)" COMMENT '%*s'\n", + chistics->comment.length, + chistics->comment.str)); + strcpy(ptr, body); + *lenp= (ptr-buf)+bodylen; + return buf; +} diff --git a/sql/sp.h b/sql/sp.h index 9bce886336d..b9f29138de2 100644 --- a/sql/sp.h +++ b/sql/sp.h @@ -32,8 +32,7 @@ sp_head * sp_find_procedure(THD *thd, LEX_STRING *name); int -sp_create_procedure(THD *thd, char *name, uint namelen, char *def, uint deflen, - st_sp_chistics *chistics); +sp_create_procedure(THD *thd, sp_head *sp); int sp_drop_procedure(THD *thd, char *name, uint namelen); @@ -54,8 +53,7 @@ sp_head * sp_find_function(THD *thd, LEX_STRING *name); int -sp_create_function(THD *thd, char *name, uint namelen, char *def, uint deflen, - st_sp_chistics *chistics); +sp_create_function(THD *thd, sp_head *sp); int sp_drop_function(THD *thd, char *name, uint namelen); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 39669c5b86f..cfaf08b7972 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -163,18 +163,51 @@ sp_head::sp_head() } void -sp_head::init(LEX_STRING *name, LEX *lex) +sp_head::init(LEX *lex) { DBUG_ENTER("sp_head::init"); - const char *dstr = (const char*)lex->buf; + + lex->spcont= m_pcont= new sp_pcontext(); + my_init_dynamic_array(&m_instr, sizeof(sp_instr *), 16, 8); + m_param_begin= m_param_end= m_returns_begin= m_returns_end= m_body_begin= 0; + m_name.str= m_params.str= m_retstr.str= m_body.str= m_defstr.str= 0; + m_name.length= m_params.length= m_retstr.length= m_body.length= + m_defstr.length= 0; + DBUG_VOID_RETURN; +} + +void +sp_head::init_strings(LEX_STRING *name, LEX *lex) +{ + DBUG_ENTER("sp_head::init_strings"); DBUG_PRINT("info", ("name: %*s", name->length, name->str)); m_name.length= name->length; m_name.str= lex->thd->strmake(name->str, name->length); + m_params.length= m_param_end- m_param_begin; + m_params.str= lex->thd->strmake((char *)m_param_begin, m_params.length); + if (m_returns_begin && m_returns_end) + { + /* QQ KLUDGE: We can't seem to cut out just the type in the parser + (without the RETURNS), so we'll have to do it here. :-( */ + char *p= (char *)m_returns_begin+strspn((char *)m_returns_begin,"\t\n\r "); + p+= strcspn(p, "\t\n\r "); + p+= strspn(p, "\t\n\r "); + if (p < (char *)m_returns_end) + m_returns_begin= (uchar *)p; + /* While we're at it, trim the end too. */ + p= (char *)m_returns_end-1; + while (p > (char *)m_returns_begin && + (*p == '\t' || *p == '\n' || *p == '\r' || *p == ' ')) + p-= 1; + m_returns_end= (uchar *)p+1; + m_retstr.length= m_returns_end - m_returns_begin; + m_retstr.str= lex->thd->strmake((char *)m_returns_begin, m_retstr.length); + } + m_body.length= lex->end_of_query - m_body_begin; + m_body.str= lex->thd->strmake((char *)m_body_begin, m_body.length); m_defstr.length= lex->end_of_query - lex->buf; - m_defstr.str= lex->thd->strmake(dstr, m_defstr.length); - lex->spcont= m_pcont= new sp_pcontext(); - my_init_dynamic_array(&m_instr, sizeof(sp_instr *), 16, 8); + m_defstr.str= lex->thd->strmake((char *)lex->buf, m_defstr.length); DBUG_VOID_RETURN; } @@ -184,18 +217,12 @@ sp_head::create(THD *thd) DBUG_ENTER("sp_head::create"); int ret; - DBUG_PRINT("info", ("type: %d name: %s def: %s", - m_type, m_name.str, m_defstr.str)); + DBUG_PRINT("info", ("type: %d name: %s params: %s body: %s", + m_type, m_name.str, m_params.str, m_body.str)); if (m_type == TYPE_ENUM_FUNCTION) - ret= sp_create_function(thd, - m_name.str, m_name.length, - m_defstr.str, m_defstr.length, - m_chistics); + ret= sp_create_function(thd, this); else - ret= sp_create_procedure(thd, - m_name.str, m_name.length, - m_defstr.str, m_defstr.length, - m_chistics); + ret= sp_create_procedure(thd, this); DBUG_RETURN(ret); } diff --git a/sql/sp_head.h b/sql/sp_head.h index 0f0c618ffb4..33c6bd4fe38 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -56,6 +56,18 @@ public: List m_calls; // Called procedures. List m_tables; // Used tables. #endif + LEX_STRING m_name; + LEX_STRING m_params; + LEX_STRING m_retstr; // For FUNCTIONs only + LEX_STRING m_body; + LEX_STRING m_defstr; + char *m_creator; + uint m_creatorlen; + longlong m_created; + longlong m_modified; + // Pointers set during parsing + uchar *m_param_begin, *m_param_end, *m_returns_begin, *m_returns_end, + *m_body_begin; static void * operator new(size_t size); @@ -67,7 +79,11 @@ public: // Initialize after we have reset mem_root void - init(LEX_STRING *name, LEX *lex); + init(LEX *lex); + + // Initialize strings after parsing header + void + init_strings(LEX_STRING *name, LEX *lex); int create(THD *thd); @@ -136,6 +152,8 @@ public: return m_name.str; } + char *create_string(THD *thd, ulong *lenp); + inline Item_result result() { return sp_map_result_type(m_returns); @@ -143,15 +161,13 @@ public: void set_info(char *creator, uint creatorlen, longlong created, longlong modified, - bool suid, char *comment, uint commentlen) + st_sp_chistics *chistics) { m_creator= creator; m_creatorlen= creatorlen; m_created= created; m_modified= modified; - m_chistics->comment.length= commentlen; - m_chistics->comment.str= comment; - m_chistics->suid= (suid ? IS_SUID : IS_NOT_SUID); + m_chistics= chistics; } inline void reset_thd_mem_root(THD *thd) @@ -180,13 +196,6 @@ private: Item *m_free_list; // Where the items go THD *m_thd; // Set if we have reset mem_root - LEX_STRING m_name; - LEX_STRING m_defstr; - char *m_creator; - uint m_creatorlen; - longlong m_created; - longlong m_modified; - sp_pcontext *m_pcont; // Parse context List m_lex; // Temp. store for the other lex DYNAMIC_ARRAY m_instr; // The "instructions" diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 369880486f9..cbafd69b9ac 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1040,7 +1040,7 @@ create: /* Order is important here: new - reset - init */ sp= new sp_head(); sp->reset_thd_mem_root(YYTHD); - sp->init(&$3, lex); + sp->init(lex); sp->m_type= TYPE_ENUM_PROCEDURE; lex->sphead= sp; @@ -1052,10 +1052,18 @@ create: sp->m_old_cmq= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES; YYTHD->client_capabilities &= (~CLIENT_MULTI_QUERIES); } - '(' sp_pdparam_list ')' + '(' { LEX *lex= Lex; + lex->sphead->m_param_begin= lex->tok_start+1; + } + sp_pdparam_list + ')' + { + LEX *lex= Lex; + + lex->sphead->m_param_end= lex->tok_start; lex->spcont->set_params(); bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); } @@ -1064,11 +1072,13 @@ create: LEX *lex= Lex; lex->sphead->m_chistics= &lex->sp_chistics; + lex->sphead->m_body_begin= lex->tok_start; } sp_proc_stmt { LEX *lex= Lex; + lex->sphead->init_strings(&$3, lex); lex->sql_command= SQLCOM_CREATE_PROCEDURE; /* Restore flag if it was cleared above */ if (lex->sphead->m_old_cmq) @@ -1103,7 +1113,7 @@ create_function_tail: /* Order is important here: new - reset - init */ sp= new sp_head(); sp->reset_thd_mem_root(YYTHD); - sp->init(&lex->udf.name, lex); + sp->init(lex); sp->m_type= TYPE_ENUM_FUNCTION; lex->sphead= sp; @@ -1114,16 +1124,25 @@ create_function_tail: */ sp->m_old_cmq= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES; YYTHD->client_capabilities &= ~CLIENT_MULTI_QUERIES; + lex->sphead->m_param_begin= lex->tok_start+1; } sp_fdparam_list ')' { - Lex->spcont->set_params(); + LEX *lex= Lex; + + lex->spcont->set_params(); + lex->sphead->m_param_end= lex->tok_start; } - RETURNS_SYM type + RETURNS_SYM + { + Lex->sphead->m_returns_begin= Lex->tok_start; + } + type { LEX *lex= Lex; - lex->sphead->m_returns= (enum enum_field_types)$7; + lex->sphead->m_returns_end= lex->tok_start; + lex->sphead->m_returns= (enum enum_field_types)$8; bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); } sp_c_chistics @@ -1131,16 +1150,19 @@ create_function_tail: LEX *lex= Lex; lex->sphead->m_chistics= &lex->sp_chistics; + lex->sphead->m_body_begin= lex->tok_start; } sp_proc_stmt { LEX *lex= Lex; + sp_head *sp= lex->sphead; lex->sql_command= SQLCOM_CREATE_SPFUNCTION; + sp->init_strings(&lex->udf.name, lex); /* Restore flag if it was cleared above */ - if (lex->sphead->m_old_cmq) + if (sp->m_old_cmq) YYTHD->client_capabilities |= CLIENT_MULTI_QUERIES; - lex->sphead->restore_thd_mem_root(YYTHD); + sp->restore_thd_mem_root(YYTHD); } ; @@ -5884,6 +5906,7 @@ keyword: | RESET_SYM {} | RESOURCES {} | RESTORE_SYM {} + | RETURNS_SYM {} | ROLLBACK_SYM {} | ROLLUP_SYM {} | ROWS_SYM {} From 8630ca9a098d21bfa65dd3769160c9b57844d3be Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 12 Dec 2003 14:12:38 +0100 Subject: [PATCH 22/40] Don't want host in the definer's column. --- mysql-test/r/sp.result | 10 +++++----- sql/sp.cc | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 851d56ba458..5c506e7bf14 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -918,7 +918,7 @@ n f drop table fac; show function status like '%f%'; Name Type Definer Modified Created Security_type Comment -fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +fac FUNCTION root 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER drop procedure ifac; drop function fac; show function status like '%f%'; @@ -1011,8 +1011,8 @@ end loop; end show procedure status like '%p%'; Name Type Definer Modified Created Security_type Comment -ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER -opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +ip PROCEDURE root 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +opp PROCEDURE root 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER call ip(200); select * from primes where i=45 or i=100 or i=199; i p @@ -1074,7 +1074,7 @@ comment "111111111111" sql security invoker insert into test.t1 values (x, y); show procedure status like 'bar'; Name Type Definer Modified Created Security_type Comment -bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 +bar PROCEDURE root 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 alter procedure bar name bar2 comment "2222222222" sql security definer; alter procedure bar2 name bar comment "3333333333"; alter procedure bar; @@ -1085,7 +1085,7 @@ bar CREATE PROCEDURE bar(x char(16), y int) insert into test.t1 values (x, y) show procedure status like 'bar'; Name Type Definer Modified Created Security_type Comment -bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333 +bar PROCEDURE root 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333 drop procedure bar; drop table t1; drop table t2; diff --git a/sql/sp.cc b/sql/sp.cc index ded45102815..bc7f0bf32d7 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -265,7 +265,6 @@ db_create_routine(THD *thd, int type, sp_head *sp) int ret; TABLE *table; TABLE_LIST tables; - char creator[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; memset(&tables, 0, sizeof(tables)); tables.db= (char*)"mysql"; @@ -276,7 +275,6 @@ db_create_routine(THD *thd, int type, sp_head *sp) else { restore_record(table, default_values); // Get default values for fields - strxmov(creator, thd->user, "@", thd->host_or_ip, NullS); if (table->fields != MYSQL_PROC_FIELD_COUNT) { @@ -302,7 +300,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) table->field[MYSQL_PROC_FIELD_BODY]-> store(sp->m_body.str, sp->m_body.length, system_charset_info); table->field[MYSQL_PROC_FIELD_DEFINER]-> - store(creator, (uint)strlen(creator), system_charset_info); + store(thd->user, (uint)strlen(thd->user), system_charset_info); ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_CREATED])->set_time(); table->field[MYSQL_PROC_FIELD_SQL_MODE]-> store((longlong)thd->variables.sql_mode); From 85a4e83e9ae38b19f1e3eda9162203ac45b32ee5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 13 Dec 2003 17:20:35 +0200 Subject: [PATCH 23/40] Already approved bug fix for #1561. Bug happens in INTERVAL function when number of compared arguments is 8 or more. --- mysql-test/r/func_set.result | 6 ++++++ mysql-test/t/func_set.test | 5 +++++ sql/item_cmpfunc.cc | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index 2a3631140b0..d51bc24112a 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -50,3 +50,9 @@ id elt(two.val,'one','two') 2 one 4 two drop table t1,t2; +SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); +INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56) +1 +SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77); +INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77) +1 diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index 7d24140c75d..7a7ad25f9c4 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -35,3 +35,8 @@ insert into t2 values (1,1),(2,1),(3,1),(4,2); select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; drop table t1,t2; + +# some more INTERVAL tests + +SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); +SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index db80428290a..2252c1a0e40 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -603,7 +603,7 @@ longlong Item_func_interval::val_int() if (intervals) { // Use binary search to find interval uint start,end; - start= 1; + start= 0; end= row->cols()-2; while (start != end) { From a6f85eeac15b520f34aed0782e10825b20a038cc Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 13 Dec 2003 16:40:52 +0100 Subject: [PATCH 24/40] WL#1365: Implement definer's rights execution of stored procedures. (Also put the hostpart back in the definer column.) mysql-test/r/sp-error.result: Moved error test from sp.test mysql-test/r/sp.result: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. mysql-test/t/sp-error.test: Moved error test from sp.test mysql-test/t/sp.test: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. sql/item_func.cc: (Maybe) switch security context before invoking a stored function. sql/sp.cc: Renamed creator into definer, for more consistent terminology, and put the hostpart back. sql/sp_head.cc: Some fixes in the way things are allocated, and moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sp_head.h: Moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sql_acl.cc: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_acl.h: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_parse.cc: (Maybe) switch security context before invoking a stored procedure. sql/sql_yacc.yy: Fixed typo. --- mysql-test/r/sp-error.result | 11 ++++ mysql-test/r/sp-security.result | 44 ++++++++++++++ mysql-test/r/sp.result | 21 ++----- mysql-test/t/sp-error.test | 21 +++++++ mysql-test/t/sp-security.test | 99 +++++++++++++++++++++++++++++++ mysql-test/t/sp.test | 20 ------- sql/item_func.cc | 10 +++- sql/sp.cc | 28 +++++---- sql/sp_head.cc | 102 ++++++++++++++++++++++++++++++-- sql/sp_head.h | 35 +++++++---- sql/sql_acl.cc | 60 +++++++++++++++++++ sql/sql_acl.h | 1 + sql/sql_parse.cc | 5 ++ sql/sql_yacc.yy | 2 +- 14 files changed, 392 insertions(+), 67 deletions(-) create mode 100644 mysql-test/r/sp-security.result create mode 100644 mysql-test/t/sp-security.test diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 22f6d37f8de..ac952549803 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -280,4 +280,15 @@ create function bug1654() returns int return (select sum(t.data) from test.t2 t); ERROR 0A000: Statements like SELECT, INSERT, UPDATE (and others) are not allowed in a FUNCTION +drop table if exists table_1; +create table t3 (column_1_0 int); +create procedure bug1653() +update t3 set column_1 = 0; +call bug1653(); +ERROR 42S22: Unknown column 'column_1' in 'field list' +drop table t3; +create table t3 (column_1 int); +call bug1653(); +drop procedure bug1653; +drop table t3; drop table t1; diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result new file mode 100644 index 00000000000..00e22ceebd4 --- /dev/null +++ b/mysql-test/r/sp-security.result @@ -0,0 +1,44 @@ +use test; +grant usage on *.* to dummy@localhost; +drop database if exists db1_secret; +create database db1_secret; +use db1_secret; +create table t1 ( u varchar(64), i int ); +create procedure stamp(i int) +insert into db1_secret.t1 values (user(), i); +show procedure status like 'stamp'; +Name Type Definer Modified Created Security_type Comment +stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +call stamp(1); +select * from t1; +u i +root@localhost 1 +call stamp(2); +select * from db1_secret.t1; +ERROR 42000: Access denied for user: 'dummy'@'localhost' to database 'db1_secret' +call stamp(3); +select * from db1_secret.t1; +ERROR 42000: Access denied for user: ''@'localhost' to database 'db1_secret' +select * from t1; +u i +root@localhost 1 +dummy@localhost 2 +anon@localhost 3 +alter procedure stamp sql security invoker; +show procedure status like 'stamp'; +Name Type Definer Modified Created Security_type Comment +stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER +call stamp(4); +select * from t1; +u i +root@localhost 1 +dummy@localhost 2 +anon@localhost 3 +root@localhost 4 +call stamp(5); +ERROR 42000: Access denied for user: 'dummy'@'localhost' to database 'db1_secret' +call stamp(6); +ERROR 42000: Access denied for user: ''@'localhost' to database 'db1_secret' +use test; +drop database db1_secret; +delete from mysql.user where user='dummy'; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 5c506e7bf14..05e6096f8ac 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -866,17 +866,6 @@ avg 0 4.4 delete from t1; delete from t2; drop procedure bug1874; -drop table if exists table_1; -create table t3 (column_1_0 int); -create procedure bug1653() -update t3 set column_1 = 0; -call bug1653(); -ERROR 42S22: Unknown column 'column_1' in 'field list' -drop table t3; -create table t3 (column_1 int); -call bug1653(); -drop procedure bug1653; -drop table t3; drop table if exists fac; create table fac (n int unsigned not null primary key, f bigint unsigned); create procedure ifac(n int unsigned) @@ -918,7 +907,7 @@ n f drop table fac; show function status like '%f%'; Name Type Definer Modified Created Security_type Comment -fac FUNCTION root 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER drop procedure ifac; drop function fac; show function status like '%f%'; @@ -1011,8 +1000,8 @@ end loop; end show procedure status like '%p%'; Name Type Definer Modified Created Security_type Comment -ip PROCEDURE root 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER -opp PROCEDURE root 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER call ip(200); select * from primes where i=45 or i=100 or i=199; i p @@ -1074,7 +1063,7 @@ comment "111111111111" sql security invoker insert into test.t1 values (x, y); show procedure status like 'bar'; Name Type Definer Modified Created Security_type Comment -bar PROCEDURE root 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 +bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 alter procedure bar name bar2 comment "2222222222" sql security definer; alter procedure bar2 name bar comment "3333333333"; alter procedure bar; @@ -1085,7 +1074,7 @@ bar CREATE PROCEDURE bar(x char(16), y int) insert into test.t1 values (x, y) show procedure status like 'bar'; Name Type Definer Modified Created Security_type Comment -bar PROCEDURE root 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333 +bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333 drop procedure bar; drop table t1; drop table t2; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 042e9baa47f..ab13559b860 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -379,6 +379,27 @@ create function bug1654() returns int return (select sum(t.data) from test.t2 t)| +# +# BUG#1653 +# +--disable_warnings +drop table if exists table_1| +--enable_warnings +create table t3 (column_1_0 int)| + +create procedure bug1653() + update t3 set column_1 = 0| + +--error 1054 +call bug1653()| +drop table t3| +create table t3 (column_1 int)| +call bug1653()| + +drop procedure bug1653| +drop table t3| + + drop table t1| delimiter ;| diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test new file mode 100644 index 00000000000..923438c8525 --- /dev/null +++ b/mysql-test/t/sp-security.test @@ -0,0 +1,99 @@ +# +# Testing SQL SECURITY of stored procedures +# + +connect (con1root,localhost,root,,); + +connection con1root; +use test; + +# Create dummy user with no particular access rights +grant usage on *.* to dummy@localhost; + +--disable_warnings +drop database if exists db1_secret; +--enable_warnings +# Create our secret database +create database db1_secret; + +use db1_secret; + +create table t1 ( u varchar(64), i int ); + +# Our test procedure +create procedure stamp(i int) + insert into db1_secret.t1 values (user(), i); +--replace_column 4 '0000-00-00 00:00:00' 5 '0000-00-00 00:00:00' +show procedure status like 'stamp'; + +# root can, of course +call stamp(1); +select * from t1; + +connect (con2dummy,localhost,dummy,,); +connect (con3anon,localhost,anon,,); + +# +# Dummy can +# +connection con2dummy; + +# This should work... +call stamp(2); + +# ...but not this +--error 1044 +select * from db1_secret.t1; + +# +# Anonymous can +# +connection con3anon; + +# This should work... +call stamp(3); + +# ...but not this +--error 1044 +select * from db1_secret.t1; + +# +# Check it out +# +connection con1root; +select * from t1; + +# +# Change to invoker's rights +# +alter procedure stamp sql security invoker; +--replace_column 4 '0000-00-00 00:00:00' 5 '0000-00-00 00:00:00' +show procedure status like 'stamp'; + +# root still can +call stamp(4); +select * from t1; + +# +# Dummy cannot +# +connection con2dummy; + +# This should not work +--error 1044 +call stamp(5); + +# +# Anonymous cannot +# +connection con3anon; + +# This should not work +--error 1044 +call stamp(6); + +# Clean up +connection con1root; +use test; +drop database db1_secret; +delete from mysql.user where user='dummy'; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 3681d9a9517..cda03e46e37 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -1013,26 +1013,6 @@ delete from t1| delete from t2| drop procedure bug1874| -# -# BUG#1653 -# ---disable_warnings -drop table if exists table_1| ---enable_warnings -create table t3 (column_1_0 int)| - -create procedure bug1653() - update t3 set column_1 = 0| - ---error 1054 -call bug1653()| -drop table t3| -create table t3 (column_1 int)| -call bug1653()| - -drop procedure bug1653| -drop table t3| - # # Some "real" examples diff --git a/sql/item_func.cc b/sql/item_func.cc index 10e405393a2..428ca5aa90e 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3069,13 +3069,21 @@ Item_func_sp::execute(Item **itp) { DBUG_ENTER("Item_func_sp::execute"); THD *thd= current_thd; + st_sp_security_context save_ctx; + int res; if (! m_sp) m_sp= sp_find_function(thd, &m_name); if (! m_sp) DBUG_RETURN(-1); - DBUG_RETURN(m_sp->execute_function(thd, args, arg_count, itp)); + sp_change_security_context(thd, m_sp, &save_ctx); + + res= m_sp->execute_function(thd, args, arg_count, itp); + + sp_restore_security_context(thd, m_sp, &save_ctx); + + DBUG_RETURN(res); } enum enum_field_types diff --git a/sql/sp.cc b/sql/sp.cc index bc7f0bf32d7..10eb9c0c6f0 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -121,10 +121,10 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) const char *params, *returns, *body; int ret; bool opened; - const char *creator; + const char *definer; longlong created; longlong modified; - st_sp_chistics *chistics; + st_sp_chistics chistics; char *ptr; uint length; char buff[65]; @@ -147,8 +147,8 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) ret= SP_GET_FIELD_FAILED; goto done; } - chistics= (st_sp_chistics *)thd->alloc(sizeof(st_sp_chistics)); - chistics->detistic= (ptr[0] == 'N' ? FALSE : TRUE); + bzero((char *)&chistics, sizeof(chistics)); + chistics.detistic= (ptr[0] == 'N' ? FALSE : TRUE); if ((ptr= get_field(&thd->mem_root, table->field[MYSQL_PROC_FIELD_SECURITY_TYPE])) == NULL) @@ -156,7 +156,7 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) ret= SP_GET_FIELD_FAILED; goto done; } - chistics->suid= (ptr[0] == 'I' ? IS_NOT_SUID : IS_SUID); + chistics.suid= (ptr[0] == 'I' ? IS_NOT_SUID : IS_SUID); if ((params= get_field(&thd->mem_root, table->field[MYSQL_PROC_FIELD_PARAM_LIST])) == NULL) @@ -181,7 +181,7 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) } // Get additional information - if ((creator= get_field(&thd->mem_root, + if ((definer= get_field(&thd->mem_root, table->field[MYSQL_PROC_FIELD_DEFINER])) == NULL) { ret= SP_GET_FIELD_FAILED; @@ -198,8 +198,8 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) ptr= 0; if ((length= str.length())) ptr= thd->strmake(str.ptr(), length); - chistics->comment.str= ptr; - chistics->comment.length= length; + chistics.comment.str= ptr; + chistics.comment.length= length; if (opened) { @@ -224,7 +224,7 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) params, strlen(params), returns, strlen(returns), body, strlen(body), - chistics); + &chistics); lex_start(thd, (uchar*)defstr, deflen); if (yyparse(thd) || thd->is_fatal_error || thd->lex->sphead == NULL) { @@ -243,8 +243,8 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) else { *sphp= thd->lex->sphead; - (*sphp)->set_info((char *) creator, (uint) strlen(creator), - created, modified, chistics); + (*sphp)->set_info((char *)definer, (uint)strlen(definer), + created, modified, &chistics); } thd->lex->sql_command= oldcmd; thd->variables.sql_mode= old_sql_mode; @@ -265,6 +265,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) int ret; TABLE *table; TABLE_LIST tables; + char definer[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; memset(&tables, 0, sizeof(tables)); tables.db= (char*)"mysql"; @@ -275,6 +276,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) else { restore_record(table, default_values); // Get default values for fields + strxmov(definer, thd->priv_user, "@", thd->priv_host, NullS); if (table->fields != MYSQL_PROC_FIELD_COUNT) { @@ -300,7 +302,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) table->field[MYSQL_PROC_FIELD_BODY]-> store(sp->m_body.str, sp->m_body.length, system_charset_info); table->field[MYSQL_PROC_FIELD_DEFINER]-> - store(thd->user, (uint)strlen(thd->user), system_charset_info); + store(definer, (uint)strlen(definer), system_charset_info); ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_CREATED])->set_time(); table->field[MYSQL_PROC_FIELD_SQL_MODE]-> store((longlong)thd->variables.sql_mode); @@ -853,7 +855,7 @@ create_string(THD *thd, ulong *lenp, ptr+= my_sprintf(ptr, (ptr, (char *)" DETERMINISTIC\n")); if (chistics->suid == IS_NOT_SUID) ptr+= my_sprintf(ptr, (ptr, (char *)" SQL SECURITY INVOKER\n")); - if (chistics->comment.str) + if (chistics->comment.length) ptr+= my_sprintf(ptr, (ptr, (char *)" COMMENT '%*s'\n", chistics->comment.length, chistics->comment.str)); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index cfaf08b7972..66c811c1e19 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -19,6 +19,7 @@ #endif #include "mysql_priv.h" +#include "sql_acl.h" #include "sp_head.h" #include "sp.h" #include "sp_pcontext.h" @@ -183,9 +184,10 @@ sp_head::init_strings(LEX_STRING *name, LEX *lex) DBUG_PRINT("info", ("name: %*s", name->length, name->str)); m_name.length= name->length; - m_name.str= lex->thd->strmake(name->str, name->length); + m_name.str= strmake_root(&m_mem_root, name->str, name->length); m_params.length= m_param_end- m_param_begin; - m_params.str= lex->thd->strmake((char *)m_param_begin, m_params.length); + m_params.str= strmake_root(&m_mem_root, + (char *)m_param_begin, m_params.length); if (m_returns_begin && m_returns_end) { /* QQ KLUDGE: We can't seem to cut out just the type in the parser @@ -202,12 +204,13 @@ sp_head::init_strings(LEX_STRING *name, LEX *lex) p-= 1; m_returns_end= (uchar *)p+1; m_retstr.length= m_returns_end - m_returns_begin; - m_retstr.str= lex->thd->strmake((char *)m_returns_begin, m_retstr.length); + m_retstr.str= strmake_root(&m_mem_root, + (char *)m_returns_begin, m_retstr.length); } m_body.length= lex->end_of_query - m_body_begin; - m_body.str= lex->thd->strmake((char *)m_body_begin, m_body.length); + m_body.str= strmake_root(&m_mem_root, (char *)m_body_begin, m_body.length); m_defstr.length= lex->end_of_query - lex->buf; - m_defstr.str= lex->thd->strmake((char *)lex->buf, m_defstr.length); + m_defstr.str= strmake_root(&m_mem_root, (char *)lex->buf, m_defstr.length); DBUG_VOID_RETURN; } @@ -664,6 +667,34 @@ sp_head::backpatch(sp_label_t *lab) } } +void +sp_head::set_info(char *definer, uint definerlen, + longlong created, longlong modified, + st_sp_chistics *chistics) +{ + char *p= strchr(definer, '@'); + uint len; + + if (! p) + p= definer; // Weird... + len= p-definer; + m_definer_user.str= strmake_root(&m_mem_root, definer, len); + m_definer_user.length= len; + len= definerlen-len-1; + m_definer_host.str= strmake_root(&m_mem_root, p+1, len); + m_definer_host.length= len; + m_created= created; + m_modified= modified; + m_chistics= (st_sp_chistics *)alloc_root(&m_mem_root, sizeof(st_sp_chistics)); + memcpy(m_chistics, chistics, sizeof(st_sp_chistics)); + if (m_chistics->comment.length == 0) + m_chistics->comment.str= 0; + else + m_chistics->comment.str= strmake_root(&m_mem_root, + m_chistics->comment.str, + m_chistics->comment.length); +} + int sp_head::show_create_procedure(THD *thd) { @@ -1041,3 +1072,64 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp) *nextp= m_ip+1; DBUG_RETURN(res); } + + +// +// Security context swapping +// + +void +sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp) +{ + ctxp->changed= (sp->m_chistics->suid != IS_NOT_SUID && + (strcmp(sp->m_definer_user.str, thd->priv_user) || + strcmp(sp->m_definer_host.str, thd->priv_host))); + + if (ctxp->changed) + { + ctxp->master_access= thd->master_access; + ctxp->db_access= thd->db_access; + ctxp->db= thd->db; + ctxp->db_length= thd->db_length; + ctxp->priv_user= thd->priv_user; + strncpy(ctxp->priv_host, thd->priv_host, sizeof(ctxp->priv_host)); + ctxp->user= thd->user; + ctxp->host= thd->host; + ctxp->ip= thd->ip; + + /* Change thise just to do the acl_getroot_no_password */ + thd->user= sp->m_definer_user.str; + thd->host= thd->ip = sp->m_definer_host.str; + + if (acl_getroot_no_password(thd)) + { // Failed, run as invoker for now + ctxp->changed= FALSE; + thd->master_access= ctxp->master_access; + thd->db_access= ctxp->db_access; + thd->db= ctxp->db; + thd->db_length= ctxp->db_length; + thd->priv_user= ctxp->priv_user; + strncpy(thd->priv_host, ctxp->priv_host, sizeof(thd->priv_host)); + } + + /* Restore these immiediately */ + thd->user= ctxp->user; + thd->host= ctxp->host; + thd->ip= ctxp->ip; + } +} + +void +sp_restore_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp) +{ + if (ctxp->changed) + { + ctxp->changed= FALSE; + thd->master_access= ctxp->master_access; + thd->db_access= ctxp->db_access; + thd->db= ctxp->db; + thd->db_length= ctxp->db_length; + thd->priv_user= ctxp->priv_user; + strncpy(thd->priv_host, ctxp->priv_host, sizeof(thd->priv_host)); + } +} diff --git a/sql/sp_head.h b/sql/sp_head.h index 33c6bd4fe38..bf3dc012a08 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -61,8 +61,8 @@ public: LEX_STRING m_retstr; // For FUNCTIONs only LEX_STRING m_body; LEX_STRING m_defstr; - char *m_creator; - uint m_creatorlen; + LEX_STRING m_definer_user; + LEX_STRING m_definer_host; longlong m_created; longlong m_modified; // Pointers set during parsing @@ -159,16 +159,9 @@ public: return sp_map_result_type(m_returns); } - void set_info(char *creator, uint creatorlen, + void set_info(char *definer, uint definerlen, longlong created, longlong modified, - st_sp_chistics *chistics) - { - m_creator= creator; - m_creatorlen= creatorlen; - m_created= created; - m_modified= modified; - m_chistics= chistics; - } + st_sp_chistics *chistics); inline void reset_thd_mem_root(THD *thd) { @@ -642,4 +635,24 @@ private: }; // class sp_instr_cfetch : public sp_instr +struct st_sp_security_context +{ + bool changed; + uint master_access; + uint db_access; + char *db; + uint db_length; + char *priv_user; + char priv_host[MAX_HOSTNAME]; + char *user; + char *host; + char *ip; +}; + +void +sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp); + +void +sp_restore_security_context(THD *thd, sp_head *sp,st_sp_security_context *ctxp); + #endif /* _SP_HEAD_H_ */ diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 479c0e5af7b..2527edc1643 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -778,6 +778,66 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh, } +/* + * This is like acl_getroot() above, but it doesn't check password, + * and we don't care about the user resources. + * Used to get access rights for SQL SECURITY DEFINER invokation of + * stored procedures. + */ +int acl_getroot_no_password(THD *thd) +{ + ulong user_access= NO_ACCESS; + int res= 1; + ACL_USER *acl_user= 0; + DBUG_ENTER("acl_getroot_no_password"); + + if (!initialized) + { + /* + here if mysqld's been started with --skip-grant-tables option. + */ + thd->priv_user= (char *) ""; // privileges for + *thd->priv_host= '\0'; // the user are unknown + thd->master_access= ~NO_ACCESS; // everything is allowed + DBUG_RETURN(0); + } + + VOID(pthread_mutex_lock(&acl_cache->lock)); + + /* + Find acl entry in user database. + This is specially tailored to suit the check we do for CALL of + a stored procedure; thd->user is set to what is actually a + priv_user, which can be ''. + */ + for (uint i=0 ; i < acl_users.elements ; i++) + { + acl_user= dynamic_element(&acl_users,i,ACL_USER*); + if ((!acl_user->user && (!thd->user || !thd->user[0])) || + (acl_user->user && strcmp(thd->user, acl_user->user) == 0)) + { + if (compare_hostname(&acl_user->host, thd->host, thd->ip)) + { + res= 0; + break; + } + } + } + + if (acl_user) + { + thd->master_access= acl_user->access; + thd->priv_user= acl_user->user ? thd->user : (char *) ""; + + if (acl_user->host.hostname) + strmake(thd->priv_host, acl_user->host.hostname, MAX_HOSTNAME); + else + *thd->priv_host= 0; + } + VOID(pthread_mutex_unlock(&acl_cache->lock)); + DBUG_RETURN(res); +} + static byte* check_get_key(ACL_USER *buff,uint *length, my_bool not_used __attribute__((unused))) { diff --git a/sql/sql_acl.h b/sql/sql_acl.h index 8b8115b10db..9858b403d27 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -139,6 +139,7 @@ ulong acl_get(const char *host, const char *ip, const char *user, const char *db, my_bool db_is_pattern); int acl_getroot(THD *thd, USER_RESOURCES *mqh, const char *passwd, uint passwd_len); +int acl_getroot_no_password(THD *thd); bool acl_check_host(const char *host, const char *ip); bool check_change_password(THD *thd, const char *host, const char *user); bool change_password(THD *thd, const char *host, const char *user, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 08a11d7c729..f5f07a651bd 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3495,6 +3495,7 @@ mysql_execute_command(THD *thd) } else { + st_sp_security_context save_ctx; uint smrx; LINT_INIT(smrx); @@ -3526,8 +3527,12 @@ mysql_execute_command(THD *thd) thd->server_status |= SERVER_MORE_RESULTS_EXISTS; } + sp_change_security_context(thd, sp, &save_ctx); + res= sp->execute_procedure(thd, &lex->value_list); + sp_restore_security_context(thd, sp, &save_ctx); + #ifndef EMBEDDED_LIBRARY thd->net.no_send_ok= nsok; #endif diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index cbafd69b9ac..a4832e1d913 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2712,7 +2712,7 @@ alter: LEX *lex= Lex; bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); - Lex->name= 0; + lex->name= 0; } sp_a_chistics { From bc1b68f0d866cc31fcbd321f88c216c44198bf79 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 13 Dec 2003 18:49:10 +0100 Subject: [PATCH 25/40] insert table select * from table2 now converts charsets correctly --- mysql-test/r/ctype_recoding.result | 24 ++++++++++++++++++++++-- mysql-test/t/ctype_recoding.test | 16 ++++++++++++++-- sql/field_conv.cc | 8 ++++---- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index 646dcb76f96..571c89ef467 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -1,7 +1,8 @@ SET CHARACTER SET koi8r; -DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ, t1; +DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ, t1, t2; SET CHARACTER SET koi8r; CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a; +CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -13,7 +14,26 @@ a SELECT HEX(a) FROM t1; HEX(a) EFF0EEE1E0 -DROP TABLE t1; +INSERT t2 SELECT * FROM t1; +SELECT HEX(a) FROM t2; +HEX(a) +D0BFD180D0BED0B1D0B0 +DROP TABLE t1, t2; +CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a; +CREATE TABLE t2 (a TEXT CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text character set cp1251 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(a) FROM t1; +HEX(a) +EFF0EEE1E0 +INSERT t2 SELECT * FROM t1; +SELECT HEX(a) FROM t2; +HEX(a) +D0BFD180D0BED0B1D0B0 +DROP TABLE t1, t2; CREATE TABLE `ÔÁÂÌÉÃÁ` ( ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ" diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index 2f08e021df2..0b901009041 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -1,15 +1,27 @@ SET CHARACTER SET koi8r; --disable_warnings -DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ, t1; +DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ, t1, t2; --enable_warnings SET CHARACTER SET koi8r; CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a; +CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8); SHOW CREATE TABLE t1; SELECT a FROM t1; SELECT HEX(a) FROM t1; -DROP TABLE t1; +INSERT t2 SELECT * FROM t1; +SELECT HEX(a) FROM t2; +DROP TABLE t1, t2; + +# same with TEXT +CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a; +CREATE TABLE t2 (a TEXT CHARACTER SET utf8); +SHOW CREATE TABLE t1; +SELECT HEX(a) FROM t1; +INSERT t2 SELECT * FROM t1; +SELECT HEX(a) FROM t2; +DROP TABLE t1, t2; CREATE TABLE `ÔÁÂÌÉÃÁ` ( diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 5f08c91372b..67905d35e0d 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -17,7 +17,7 @@ /* Functions to copy data to or from fields - This could be done with a single short function but opencooding this + This could be done with a single short function but opencoding this gives much more speed. */ @@ -549,6 +549,7 @@ void field_conv(Field *to,Field *from) if (to->pack_length() == from->pack_length() && to->real_type() != FIELD_TYPE_ENUM && to->real_type() != FIELD_TYPE_SET && + from->charset() == to->charset() && to->table->db_low_byte_first == from->table->db_low_byte_first) { // Identical fields memcpy(to->ptr,from->ptr,to->pack_length()); @@ -562,7 +563,7 @@ void field_conv(Field *to,Field *from) if (!blob->value.is_alloced() && from->real_type() != FIELD_TYPE_STRING) blob->value.copy(); - blob->store(blob->value.ptr(),blob->value.length(),to->charset()); + blob->store(blob->value.ptr(),blob->value.length(),from->charset()); return; } if ((from->result_type() == STRING_RESULT && @@ -574,8 +575,7 @@ void field_conv(Field *to,Field *from) char buff[MAX_FIELD_WIDTH]; String result(buff,sizeof(buff),from->charset()); from->val_str(&result,&result); - to->store(result.c_ptr_quick(),result.length(),to->charset()); - // QQ: what to do if "from" and "to" are of dirrent charsets? + to->store(result.c_ptr_quick(),result.length(),from->charset()); } else if (from->result_type() == REAL_RESULT) to->store(from->val_real()); From 4d52808bb3c358d9e7feeaaed33f0c1c4962afef Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 13 Dec 2003 18:00:15 -0400 Subject: [PATCH 26/40] Translation update --- sql/share/portuguese/errmsg.txt | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index ad845aac932..ffb70632bd4 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -254,7 +254,7 @@ character-set=latin1 "Cada tabela derivada deve ter seu próprio alias", "Select %u foi reduzido durante otimização", "Tabela '%-.64s' de um dos SELECT's não pode ser usada em %-.32s", -"Cliente não suporta o protocolo de autenticação exigido pelo servidor; considere a atualização deo cliente MySQL", +"Cliente não suporta o protocolo de autenticação exigido pelo servidor; considere a atualização do cliente MySQL", "Todas as partes de uma SPATIAL KEY devem ser NOT NULL", "COLLATION '%s' não é válida para CHARACTER SET '%s'", "O slave já está rodando", @@ -264,30 +264,30 @@ character-set=latin1 "Z_BUF_ERROR: Não suficiente espaço no buffer emissor para zlib (provavelmente, o comprimento dos dados descomprimidos está corrupto)", "Z_DATA_ERROR: Dados de entrada está corrupto para zlib", "%d linha(s) foi(foram) cortada(s) por group_concat()", -"Record count is fewer than the column count at row %ld", -"Record count is more than the column count at row %ld", -"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld", -"Data truncated, out of range for column '%s' at row %ld", -"Data truncated for column '%s' at row %ld", +"Conta de registro é menor que a conta de coluna na linha %ld", +"Conta de registro é maior que a conta de coluna na linha %ld", +"Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %ld", +"Dado truncado, fora de alcance para coluna '%s' na linha %ld", +"Dado truncado para coluna '%s' na linha %ld", "Usando engine de armazenamento %s para tabela '%s'", "Combinação ilegal de collations (%s,%s) e (%s,%s) para operação '%s'", -"Can't drop one or more of the requested users", -"Can't revoke all privileges, grant for one or more of the requested users", -"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", -"Illegal mix of collations for operation '%s'", -"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", -"Unknown collation: '%-.64s'", -"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.", -"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format", -"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", -"Wrong parameter or combination of parameters for START SLAVE UNTIL", -"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart", -"SQL thread is not to be started so UNTIL options are ignored", -"Incorrect index name '%-.100s'", -"Incorrect catalog name '%-.100s'", -"Query cache failed to set size %lu, new query cache size is %lu", -"Column '%-.64s' cannot be part of FULLTEXT index", -"Unknown key cache '%-.100s'", -"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", -"Unknown table engine '%s'", -"'%s' is deprecated. Use '%s' instead.", +"Não pode remover um ou mais dos usuários pedidos", +"Não pode revocar todos os privilégios, grant para um ou mais dos usuários pedidos", +"Ilegal combinação de collations (%s,%s), (%s,%s), (%s,%s) para operação '%s'", +"Ilegal combinação de collations para operação '%s'", +"Variável '%-.64s' não é uma variável componente (Não pode ser usada como XXXX.variável_nome)", +"Collation desconhecida: '%-.64s'", +"SSL parâmetros em CHANGE MASTER são ignorados porque este escravo MySQL foi compilado sem o SSL suporte. Os mesmos podem ser usados mais tarde quando o escravo MySQL com SSL seja iniciado.", +"Servidor está rodando em --secure-auth modo, porêm '%s@%s' tem senha no formato antigo; por favor troque a senha para o novo formato", +"Campo ou referência '%-.64s%s%-.64s%s%-.64s' de SELECT #%d foi resolvido em SELECT #%d", +"Parâmetro ou combinação de parâmetros errado para START SLAVE UNTIL", +"É recomendado para rodar com --skip-slave-start quando fazendo replicação passo-por-passo com START SLAVE UNTIL, de outra forma você não está seguro em caso de inesperada reinicialição do mysqld escravo", +"Thread SQL não pode ser inicializado tal que opções UNTIL são ignoradas", +"Incorreto nome de índice '%-.100s'", +"Incorreto nome de catálogo '%-.100s'", +"Falha em Query cache para configurar tamanho %lu, novo tamanho de query cache é %lu", +"Coluna '%-.64s' não pode ser parte de índice FULLTEXT", +"Key cache desconhecida '%-.100s'", +"MySQL foi inicializado em modo --skip-name-resolve. Você necesita reincializá-lo sem esta opção para este grant funcionar", +"Motor de tabela desconhecido '%s'", +"'%s' é desatualizado. Use '%s' em seu lugar.", From 1d77c0412ee5875cefaf514df483af38c63356f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 Dec 2003 13:24:16 +0100 Subject: [PATCH 27/40] Fixed various memory leaks. sql/sp.cc: Fixed memory leaks. Deletion of sps now in sp_cache. sql/sp_cache.cc: Fixed memory leaks. Use implicit delete of objects to make sure they're always freed. sql/sp_cache.h: Fixed memory leaks. Use implicit delete of objects to make sure they're always freed. sql/sp_head.cc: Fixed memory leaks. Make sure we use the right mem_root during parsing. sql/sp_head.h: Fixed memory leaks. Make sure we use the right mem_root during parsing. sql/sql_parse.cc: Fixed memory leaks. Don't forget to free the temporary object created at definition. sql/sql_yacc.yy: Fixed memory leaks. Make sure we use the right mem_root during parsing. --- sql/sp.cc | 20 ++++---------------- sql/sp_cache.cc | 18 +++++++++++++----- sql/sp_cache.h | 11 +++++++---- sql/sp_head.cc | 15 +++++++++------ sql/sp_head.h | 2 +- sql/sql_parse.cc | 6 ++++++ sql/sql_yacc.yy | 4 ++-- 7 files changed, 42 insertions(+), 34 deletions(-) diff --git a/sql/sp.cc b/sql/sp.cc index 10eb9c0c6f0..4bb629b3dbe 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -583,12 +583,9 @@ sp_drop_procedure(THD *thd, char *name, uint namelen) { DBUG_ENTER("sp_drop_procedure"); DBUG_PRINT("enter", ("name: %*s", namelen, name)); - sp_head *sp; int ret; - sp= sp_cache_remove(&thd->sp_proc_cache, name, namelen); - if (sp) - delete sp; + sp_cache_remove(&thd->sp_proc_cache, name, namelen); ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen); DBUG_RETURN(ret); @@ -601,12 +598,9 @@ sp_update_procedure(THD *thd, char *name, uint namelen, { DBUG_ENTER("sp_update_procedure"); DBUG_PRINT("enter", ("name: %*s", namelen, name)); - sp_head *sp; int ret; - sp= sp_cache_remove(&thd->sp_proc_cache, name, namelen); - if (sp) - delete sp; + sp_cache_remove(&thd->sp_proc_cache, name, namelen); ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen, newname, newnamelen, chistics); @@ -676,12 +670,9 @@ sp_drop_function(THD *thd, char *name, uint namelen) { DBUG_ENTER("sp_drop_function"); DBUG_PRINT("enter", ("name: %*s", namelen, name)); - sp_head *sp; int ret; - sp= sp_cache_remove(&thd->sp_func_cache, name, namelen); - if (sp) - delete sp; + sp_cache_remove(&thd->sp_func_cache, name, namelen); ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name, namelen); DBUG_RETURN(ret); @@ -694,12 +685,9 @@ sp_update_function(THD *thd, char *name, uint namelen, { DBUG_ENTER("sp_update_procedure"); DBUG_PRINT("enter", ("name: %*s", namelen, name)); - sp_head *sp; int ret; - sp= sp_cache_remove(&thd->sp_func_cache, name, namelen); - if (sp) - delete sp; + sp_cache_remove(&thd->sp_func_cache, name, namelen); ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, namelen, newname, newnamelen, chistics); diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index 7e9d5f92ef0..4fee49c2d81 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -92,11 +92,11 @@ sp_cache_lookup(sp_cache **cp, char *name, uint namelen) return c->lookup(name, namelen); } -sp_head * +bool sp_cache_remove(sp_cache **cp, char *name, uint namelen) { sp_cache *c= *cp; - sp_head *sp= NULL; + bool found= FALSE; if (c) { @@ -109,10 +109,10 @@ sp_cache_remove(sp_cache **cp, char *name, uint namelen) if (c->version < v) c->remove_all(); else - sp= c->remove(name, namelen); + found= c->remove(name, namelen); c->version= v+1; } - return sp; + return found; } @@ -123,6 +123,14 @@ hash_get_key_for_sp_head(const byte *ptr, uint *plen, return ((sp_head*)ptr)->name(plen); } +static void +hash_free_sp_head(void *p) +{ + sp_head *sp= (sp_head *)p; + + delete sp; +} + sp_cache::sp_cache() { init(); @@ -137,7 +145,7 @@ void sp_cache::init() { hash_init(&m_hashtable, system_charset_info, 0, 0, 0, - hash_get_key_for_sp_head, 0, 0); + hash_get_key_for_sp_head, hash_free_sp_head, 0); version= 0; } diff --git a/sql/sp_cache.h b/sql/sp_cache.h index 3d38d6f1d1f..da25227303b 100644 --- a/sql/sp_cache.h +++ b/sql/sp_cache.h @@ -37,8 +37,8 @@ void sp_cache_insert(sp_cache **cp, sp_head *sp); /* Lookup an SP in cache */ sp_head *sp_cache_lookup(sp_cache **cp, char *name, uint namelen); -/* Remove an SP from cache */ -sp_head *sp_cache_remove(sp_cache **cp, char *name, uint namelen); +/* Remove an SP from cache. Returns true if something was removed */ +bool sp_cache_remove(sp_cache **cp, char *name, uint namelen); /* @@ -75,14 +75,17 @@ public: return (sp_head *)hash_search(&m_hashtable, (const byte *)name, namelen); } - inline sp_head * + inline bool remove(char *name, uint namelen) { sp_head *sp= lookup(name, namelen); if (sp) + { hash_delete(&m_hashtable, (byte *)sp); - return sp; + return TRUE; + } + return FALSE; } inline void diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 66c811c1e19..e40d56d4ef9 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -146,6 +146,7 @@ sp_head::operator delete(void *ptr, size_t size) MEM_ROOT own_root; sp_head *sp= (sp_head *)ptr; + DBUG_PRINT("info", ("root: %lx", &sp->m_mem_root)); memcpy(&own_root, (const void *)&sp->m_mem_root, sizeof(MEM_ROOT)); free_root(&own_root, MYF(0)); @@ -178,15 +179,17 @@ sp_head::init(LEX *lex) } void -sp_head::init_strings(LEX_STRING *name, LEX *lex) +sp_head::init_strings(THD *thd, LEX *lex, LEX_STRING *name) { DBUG_ENTER("sp_head::init_strings"); + /* During parsing, we must use thd->mem_root */ + MEM_ROOT *root= &thd->mem_root; DBUG_PRINT("info", ("name: %*s", name->length, name->str)); m_name.length= name->length; - m_name.str= strmake_root(&m_mem_root, name->str, name->length); + m_name.str= strmake_root(root, name->str, name->length); m_params.length= m_param_end- m_param_begin; - m_params.str= strmake_root(&m_mem_root, + m_params.str= strmake_root(root, (char *)m_param_begin, m_params.length); if (m_returns_begin && m_returns_end) { @@ -204,13 +207,13 @@ sp_head::init_strings(LEX_STRING *name, LEX *lex) p-= 1; m_returns_end= (uchar *)p+1; m_retstr.length= m_returns_end - m_returns_begin; - m_retstr.str= strmake_root(&m_mem_root, + m_retstr.str= strmake_root(root, (char *)m_returns_begin, m_retstr.length); } m_body.length= lex->end_of_query - m_body_begin; - m_body.str= strmake_root(&m_mem_root, (char *)m_body_begin, m_body.length); + m_body.str= strmake_root(root, (char *)m_body_begin, m_body.length); m_defstr.length= lex->end_of_query - lex->buf; - m_defstr.str= strmake_root(&m_mem_root, (char *)lex->buf, m_defstr.length); + m_defstr.str= strmake_root(root, (char *)lex->buf, m_defstr.length); DBUG_VOID_RETURN; } diff --git a/sql/sp_head.h b/sql/sp_head.h index bf3dc012a08..2c0a5e18bad 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -83,7 +83,7 @@ public: // Initialize strings after parsing header void - init_strings(LEX_STRING *name, LEX *lex); + init_strings(THD *thd, LEX *lex, LEX_STRING *name); int create(THD *thd); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f5f07a651bd..89a81498ef2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3473,12 +3473,18 @@ mysql_execute_command(THD *thd) { case SP_OK: send_ok(thd); + delete lex->sphead; + lex->sphead= 0; break; case SP_WRITE_ROW_FAILED: net_printf(thd, ER_SP_ALREADY_EXISTS, SP_TYPE_STRING(lex), name); + delete lex->sphead; + lex->sphead= 0; goto error; default: net_printf(thd, ER_SP_STORE_FAILED, SP_TYPE_STRING(lex), name); + delete lex->sphead; + lex->sphead= 0; goto error; } break; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a4832e1d913..b08cbef3a57 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1078,7 +1078,7 @@ create: { LEX *lex= Lex; - lex->sphead->init_strings(&$3, lex); + lex->sphead->init_strings(YYTHD, lex, &$3); lex->sql_command= SQLCOM_CREATE_PROCEDURE; /* Restore flag if it was cleared above */ if (lex->sphead->m_old_cmq) @@ -1158,7 +1158,7 @@ create_function_tail: sp_head *sp= lex->sphead; lex->sql_command= SQLCOM_CREATE_SPFUNCTION; - sp->init_strings(&lex->udf.name, lex); + sp->init_strings(YYTHD, lex, &lex->udf.name); /* Restore flag if it was cleared above */ if (sp->m_old_cmq) YYTHD->client_capabilities |= CLIENT_MULTI_QUERIES; From 9000046c22fce85340a3507458658a8e1fd69f7c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 Dec 2003 17:58:15 +0200 Subject: [PATCH 28/40] Added missing timeout function for named pipes and shared memory (fixes core dump on windows) Signed auto_increment keys for HASH tables (like for MyISAM tables in 4.0) nitialize system_charset_info() early. Fixes core dump when starting windows service heap/hp_hash.c: Signed auto_increment keys for HASH tables (like for MyISAM tables in 4.0) mysql-test/r/create.result: More test for type returned by if_null() mysql-test/t/create.test: More test for type returned by if_null() sql/field.h: Remove not needed functions sql/item.cc: Use normal field create function instead of special functions just made for tmp_table_field_from_field_type sql/mysqld.cc: Initialize system_charset_info() early. Fixes core dump when starting windows service vio/vio.c: Added missing timeouts for named pipes and shared memory (fixes core dump on windows) vio/vio_priv.h: Added missing timeout function for named pipes and shared memory (fixes core dump on windows) vio/viosocket.c: Added missing timeout function for named pipes and shared memory (fixes core dump on windows) --- heap/hp_hash.c | 65 ++++++++++++++++++++++------ mysql-test/r/create.result | 22 ++++++++++ mysql-test/t/create.test | 10 ++++- sql/field.h | 22 +--------- sql/item.cc | 87 +++++++++++++++++++++----------------- sql/mysqld.cc | 3 ++ vio/vio.c | 2 + vio/vio_priv.h | 2 + vio/viosocket.c | 7 +++ 9 files changed, 146 insertions(+), 74 deletions(-) diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 2843407f3fe..4fdbfa16586 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -566,50 +566,87 @@ my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record) return 0; } + +/* + Update auto_increment info + + SYNOPSIS + update_auto_increment() + info MyISAM handler + record Row to update + + IMPLEMENTATION + Only replace the auto_increment value if it is higher than the previous + one. For signed columns we don't update the auto increment value if it's + less than zero. +*/ + void heap_update_auto_increment(HP_INFO *info, const byte *record) { - ulonglong value; + ulonglong value= 0; /* Store unsigned values here */ + longlong s_value= 0; /* Store signed values here */ + HA_KEYSEG *keyseg= info->s->keydef[info->s->auto_key - 1].seg; const uchar *key= (uchar*) record + keyseg->start; switch (info->s->auto_key_type) { case HA_KEYTYPE_INT8: + s_value= (longlong) *(char*)key; + break; case HA_KEYTYPE_BINARY: - value= (ulonglong) *(uchar*) key; + value=(ulonglong) *(uchar*) key; break; case HA_KEYTYPE_SHORT_INT: + s_value= (longlong) sint2korr(key); + break; case HA_KEYTYPE_USHORT_INT: - value= (ulonglong) uint2korr(key); + value=(ulonglong) uint2korr(key); break; case HA_KEYTYPE_LONG_INT: + s_value= (longlong) sint4korr(key); + break; case HA_KEYTYPE_ULONG_INT: - value= (ulonglong) uint4korr(key); + value=(ulonglong) uint4korr(key); break; case HA_KEYTYPE_INT24: - case HA_KEYTYPE_UINT24: - value= (ulonglong) uint3korr(key); + s_value= (longlong) sint3korr(key); break; - case HA_KEYTYPE_FLOAT: /* This shouldn't be used */ + case HA_KEYTYPE_UINT24: + value=(ulonglong) uint3korr(key); + break; + case HA_KEYTYPE_FLOAT: /* This shouldn't be used */ { float f_1; - float4get(f_1, key); - value= (ulonglong) f_1; + float4get(f_1,key); + /* Ignore negative values */ + value = (f_1 < (float) 0.0) ? 0 : (ulonglong) f_1; break; } - case HA_KEYTYPE_DOUBLE: /* This shouldn't be used */ + case HA_KEYTYPE_DOUBLE: /* This shouldn't be used */ { double f_1; - float8get(f_1, key); - value= (ulonglong) f_1; + float8get(f_1,key); + /* Ignore negative values */ + value = (f_1 < 0.0) ? 0 : (ulonglong) f_1; break; } case HA_KEYTYPE_LONGLONG: + s_value= sint8korr(key); + break; case HA_KEYTYPE_ULONGLONG: value= uint8korr(key); break; default: - value= 0; /* Error */ + DBUG_ASSERT(0); + value=0; /* Error */ break; } - set_if_bigger(info->s->auto_increment, value); + + /* + The following code works becasue if s_value < 0 then value is 0 + and if s_value == 0 then value will contain either s_value or the + correct value. + */ + set_if_bigger(info->s->auto_increment, + (s_value > 0) ? (ulonglong) s_value : value); } diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 2f61b4838ee..6160dd88fa5 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -407,6 +407,28 @@ a b c d e f g h dd 1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00 2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00 drop table t1, t2; +create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10)); +create table t2 select ifnull(a,a), ifnull(b,b), ifnull(c,c), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(i,i), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(n,n), ifnull(o,o) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ifnull(a,a)` tinyint(4) default NULL, + `ifnull(b,b)` smallint(6) default NULL, + `ifnull(c,c)` mediumint(9) default NULL, + `ifnull(d,d)` int(11) default NULL, + `ifnull(e,e)` bigint(20) default NULL, + `ifnull(f,f)` float(3,2) default NULL, + `ifnull(g,g)` double(4,3) default NULL, + `ifnull(h,h)` decimal(5,4) default NULL, + `ifnull(i,i)` year(4) default NULL, + `ifnull(j,j)` date default NULL, + `ifnull(k,k)` datetime NOT NULL default '0000-00-00 00:00:00', + `ifnull(l,l)` datetime default NULL, + `ifnull(m,m)` char(1) default NULL, + `ifnull(n,n)` char(3) default NULL, + `ifnull(o,o)` char(10) default NULL +) TYPE=MyISAM DEFAULT CHARSET=latin1 +drop table t1,t2; create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14'); insert into t1 values ('','',0,0.0); describe t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 54166c3b0dc..23d7cc8c347 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -318,11 +318,17 @@ select addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd from t1; explain t2; - select * from t2; - drop table t1, t2; +create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10)); +create table t2 select ifnull(a,a), ifnull(b,b), ifnull(c,c), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(i,i), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(n,n), ifnull(o,o) from t1; +show create table t2; +drop table t1,t2; + +# +# Test of default() +# create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14'); insert into t1 values ('','',0,0.0); describe t1; diff --git a/sql/field.h b/sql/field.h index 0b6ba7dde09..508fbad41a1 100644 --- a/sql/field.h +++ b/sql/field.h @@ -327,11 +327,6 @@ public: unireg_check_arg, field_name_arg, table_arg, dec_arg, zero_arg,unsigned_arg) {} - Field_decimal(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg,bool unsigned_arg) - :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg,0,0,unsigned_arg) - {} enum_field_types type() const { return FIELD_TYPE_DECIMAL;} enum ha_base_keytype key_type() const { return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; } @@ -362,11 +357,6 @@ public: unireg_check_arg, field_name_arg, table_arg, 0, zero_arg,unsigned_arg) {} - Field_tiny(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg,bool unsigned_arg) - :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg,0,0,unsigned_arg) - {} enum Item_result result_type () const { return INT_RESULT; } enum_field_types type() const { return FIELD_TYPE_TINY;} enum ha_base_keytype key_type() const @@ -608,13 +598,9 @@ public: :Field_str(ptr_arg, len_arg, null, 1, unireg_check_arg, field_name_arg, table_arg, cs) {} - Field_null(uint32 len_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) - :Field_str((char*) 0, len_arg, null, 1, - NONE, field_name_arg, table_arg, cs) - {} enum_field_types type() const { return FIELD_TYPE_NULL;} - int store(const char *to, uint length, CHARSET_INFO *cs) { null[0]=1; return 0; } + int store(const char *to, uint length, CHARSET_INFO *cs) + { null[0]=1; return 0; } int store(double nr) { null[0]=1; return 0; } int store(longlong nr) { null[0]=1; return 0; } void reset(void) {} @@ -684,10 +670,6 @@ public: :Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, table_arg, 1, 1) {} - Field_year(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg) - :Field_tiny(len_arg,maybe_null_arg,field_name_arg,table_arg,1) - {} enum_field_types type() const { return FIELD_TYPE_YEAR;} int store(const char *to,uint length,CHARSET_INFO *charset); int store(double nr); diff --git a/sql/item.cc b/sql/item.cc index 9af2c300202..072a7e5878f 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -995,35 +995,42 @@ enum_field_types Item::field_type() const Field *Item::tmp_table_field_from_field_type(TABLE *table) { - switch (field_type()) - { + /* + The field functions defines a field to be not null if null_ptr is not 0 + */ + uchar *null_ptr= maybe_null ? (uchar*) "" : 0; + + switch (field_type()) { case MYSQL_TYPE_DECIMAL: - return new Field_decimal(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_decimal((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, decimals, 0, unsigned_flag); case MYSQL_TYPE_TINY: - return new Field_tiny(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_tiny((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); case MYSQL_TYPE_SHORT: - return new Field_short(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_short((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); case MYSQL_TYPE_LONG: - return new Field_long(max_length, maybe_null, name, table, - unsigned_flag); - case MYSQL_TYPE_FLOAT: - return new Field_float(max_length, maybe_null, name, table, decimals); - case MYSQL_TYPE_DOUBLE: - return new Field_double(max_length, maybe_null, name, table, decimals); - case MYSQL_TYPE_NULL: - return new Field_null(max_length, name, table, &my_charset_bin); + return new Field_long((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); #ifdef HAVE_LONG_LONG case MYSQL_TYPE_LONGLONG: - return new Field_longlong(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_longlong((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); #endif + case MYSQL_TYPE_FLOAT: + return new Field_float((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, decimals, 0, unsigned_flag); + case MYSQL_TYPE_DOUBLE: + return new Field_double((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, decimals, 0, unsigned_flag); + case MYSQL_TYPE_NULL: + return new Field_null((char*) 0, max_length, Field::NONE, + name, table, &my_charset_bin); case MYSQL_TYPE_NEWDATE: case MYSQL_TYPE_INT24: - return new Field_long(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_medium((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); case MYSQL_TYPE_DATE: return new Field_date(maybe_null, name, table, &my_charset_bin); case MYSQL_TYPE_TIME: @@ -1032,34 +1039,38 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table) case MYSQL_TYPE_DATETIME: return new Field_datetime(maybe_null, name, table, &my_charset_bin); case MYSQL_TYPE_YEAR: - return new Field_year(max_length, maybe_null, name, table); + return new Field_year((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table); + default: + /* This case should never be choosen */ + DBUG_ASSERT(0); + /* If something goes awfully wrong, it's better to get a string than die */ case MYSQL_TYPE_ENUM: case MYSQL_TYPE_SET: - return new Field_long(max_length, maybe_null, name, table, - unsigned_flag); + case MYSQL_TYPE_VAR_STRING: + if (max_length > 255) + break; // If blob + return new Field_varstring(max_length, maybe_null, name, table, + collation.collation); + case MYSQL_TYPE_STRING: + if (max_length > 255) // If blob + break; + return new Field_string(max_length, maybe_null, name, table, + collation.collation); case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_BLOB: case MYSQL_TYPE_GEOMETRY: - return new Field_blob(max_length, maybe_null, name, table, collation.collation); - case MYSQL_TYPE_VAR_STRING: - if (max_length > 255) - return new Field_blob(max_length, maybe_null, name, table, collation.collation); - else - return new Field_varstring(max_length, maybe_null, name, table, collation.collation); - case MYSQL_TYPE_STRING: - if (max_length > 255) - return new Field_blob(max_length, maybe_null, name, table, collation.collation); - else - return new Field_string(max_length, maybe_null, name, table, collation.collation); - default: - // This case should never be choosen - DBUG_ASSERT(0); - return 0; + break; // Blob handled outside of case } + + /* blob is special as it's generated for both blobs and long strings */ + return new Field_blob(max_length, maybe_null, name, table, + collation.collation); } + /* ARGSUSED */ void Item_field::make_field(Send_field *tmp_field) { diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 805e6860f65..49f0b753549 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2787,6 +2787,9 @@ int main(int argc, char **argv) int2str((int) GetCurrentProcessId(),strmov(shutdown_event_name, "MySQLShutdown"), 10); + /* Must be initialized early for comparison of service name */ + system_charset_info= &my_charset_utf8_general_ci; + if (Service.GetOS()) /* true NT family */ { char file_path[FN_REFLEN]; diff --git a/vio/vio.c b/vio/vio.c index 05bfb220986..a356d8edeff 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -55,6 +55,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type, vio->in_addr =vio_in_addr; vio->vioblocking =vio_blocking; vio->is_blocking =vio_is_blocking; + vio->timeout =vio_ignore_timeout; } else /* default is VIO_TYPE_TCPIP */ #endif @@ -73,6 +74,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type, vio->in_addr =vio_in_addr; vio->vioblocking =vio_blocking; vio->is_blocking =vio_is_blocking; + vio->timeout =vio_ignore_timeout; } else #endif diff --git a/vio/vio_priv.h b/vio/vio_priv.h index 66a9bde4e0d..9a925a2c4c9 100644 --- a/vio/vio_priv.h +++ b/vio/vio_priv.h @@ -23,6 +23,8 @@ #include #include +void vio_ignore_timeout(Vio *vio, uint timeout); + #ifdef HAVE_OPENSSL #include "my_net.h" /* needed because of struct in_addr */ diff --git a/vio/viosocket.c b/vio/viosocket.c index 9d5c7c0d890..8dea06d4adf 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -355,6 +355,13 @@ int vio_close_pipe(Vio * vio) DBUG_RETURN(r); } + +void vio_ignore_timeout(Vio *vio __attribute__((unused)), + uint timeout __attribute__((unused))) +{ +} + + #ifdef HAVE_SMEM int vio_read_shared_memory(Vio * vio, gptr buf, int size) From 987d8ff9a38acd773fdb23a45c71a3a8a8197d64 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 Dec 2003 21:01:38 +0400 Subject: [PATCH 29/40] part one of the fix for the bug #2077: accented characters in enum/defaul values are reported incorrectly mysql-test/r/type_enum.result: test for the bug #2077: accented characters in enum/defaul values are reported incorrectly mysql-test/t/type_enum.test: test for the bug #2077: accented characters in enum/defaul values are reported incorrectly --- mysql-test/r/type_enum.result | 10 ++++++++++ mysql-test/t/type_enum.test | 10 ++++++++++ sql/sql_show.cc | 8 ++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 42ee54ce105..1903037480a 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1636,3 +1636,13 @@ t1 CREATE TABLE `t1` ( `a` enum('','a','b') NOT NULL default 'b' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +create table t1 (a enum(0xE4, '1', '2') not null default 0xE4); +show columns from t1; +Field Type Null Key Default Extra +a enum('ä','1','2') ä +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('ä','1','2') NOT NULL default '?' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 49ba73acaa8..bcebb1a5b27 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -24,3 +24,13 @@ drop table t1; create table t1 (a enum (' ','a','b ') not null default 'b '); show create table t1; drop table t1; + +# +# Bug #2077 +# + +create table t1 (a enum(0xE4, '1', '2') not null default 0xE4); +show columns from t1; +# should be fixed ASAP +show create table t1; +drop table t1; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 2ef7262f45c..855b5d1e97e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -688,14 +688,14 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, { byte *pos; uint flags=field->flags; - String type(tmp,sizeof(tmp), system_charset_info); + String type(tmp,sizeof(tmp), field->charset()); uint col_access; bool null_default_value=0; protocol->prepare_for_resend(); protocol->store(field->field_name, system_charset_info); field->sql_type(type); - protocol->store(type.ptr(), type.length(), system_charset_info); + protocol->store(type.ptr(), type.length(), type.charset()); if (verbose) protocol->store(field->has_charset() ? field->charset()->name : "NULL", system_charset_info); @@ -713,7 +713,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, null_default_value=1; if (!null_default_value && !field->is_null()) { // Not null by default - type.set(tmp,sizeof(tmp),system_charset_info); + type.set(tmp, sizeof(tmp), field->charset()); field->val_str(&type,&type); protocol->store(type.ptr(),type.length(),type.charset()); } @@ -1114,7 +1114,7 @@ store_create_info(THD *thd, TABLE *table, String *packet) packet->append(" default ", 9); if (!field->is_null()) { // Not null by default - type.set(tmp,sizeof(tmp),&my_charset_bin); + type.set(tmp, sizeof(tmp), field->charset()); field->val_str(&type,&type); if (type.length()) append_unescaped(packet, type.ptr(), type.length()); From c3617bb88ce77bcf614037aa371ec0a432ce4c21 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 Dec 2003 18:10:46 +0100 Subject: [PATCH 30/40] Updated results --- mysql-test/r/create.result | 2 +- mysql-test/r/mysqldump.result | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index d1ebe401005..78433c10014 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -427,7 +427,7 @@ t2 CREATE TABLE `t2` ( `ifnull(m,m)` char(1) default NULL, `ifnull(n,n)` char(3) default NULL, `ifnull(o,o)` char(10) default NULL -) TYPE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2; create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14'); insert into t1 values ('','',0,0.0); diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index ff1bee2923d..b49f8012776 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -64,7 +64,7 @@ INSERT INTO t1 VALUES ("1\""), ("\"2"); DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r; INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'); --- MySQL dump 10.2 +-- MySQL dump 10.3 -- -- Host: localhost Database: test -- ------------------------------------------------------ From caf4fd96f26a25f57e10d578d518f0a63109df2b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 02:23:40 +0200 Subject: [PATCH 31/40] Cleanup client/mysqltest.c: Remove not needed include files --- client/mysqltest.c | 4 ---- mysql-test/r/func_set.result | 12 ++++++------ mysql-test/t/func_set.test | 9 ++++----- mysql-test/t/rpl_log_pos.test | 1 - 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index e3e3d19984a..9bcef569669 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -54,13 +54,9 @@ #include #include #include -#include -#include #include #include #include -#include -#include #include #define MAX_QUERY 65536 diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index d51bc24112a..b101c18f505 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -6,6 +6,12 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select high_priority interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0` +SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); +INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56) +1 +SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77); +INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77) +1 select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd"); find_in_set("b","a,b,c") find_in_set("c","a,b,c") find_in_set("dd","a,bbb,dd") find_in_set("bbb","a,bbb,dd") 2 3 3 2 @@ -50,9 +56,3 @@ id elt(two.val,'one','two') 2 one 4 two drop table t1,t2; -SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); -INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56) -1 -SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77); -INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77) -1 diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index 7a7ad25f9c4..03843fd3da5 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -4,6 +4,10 @@ select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0; explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0; +# Test 8 and 9 values (Bug #1561) +SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); +SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77); + select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd"); select find_in_set("d","a,b,c"),find_in_set("dd","a,bbb,d"),find_in_set("bb","a,bbb,dd"); select make_set(0,'a','b','c'),make_set(-1,'a','b','c'),make_set(1,'a','b','c'),make_set(2,'a','b','c'),make_set(1+2,concat('a','b'),'c'); @@ -35,8 +39,3 @@ insert into t2 values (1,1),(2,1),(3,1),(4,2); select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; drop table t1,t2; - -# some more INTERVAL tests - -SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); -SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77); diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test index b32f68844a2..2e54c98c014 100644 --- a/mysql-test/t/rpl_log_pos.test +++ b/mysql-test/t/rpl_log_pos.test @@ -24,7 +24,6 @@ sleep 5; show slave status; stop slave; change master to master_log_pos=173; ---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT start slave; sleep 2; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT From 3467862b329628952320146f589fc97ddd021182 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 06:09:44 +0200 Subject: [PATCH 32/40] Added support for multi statement tests. Use mysqltest internal command delimiter to change the default delimiter (;) to something else, a string upto 16 characters is allowed. Separate the sub queries with ';' and end the whole statement with your own delimiter. --- client/mysqltest.c | 430 +++++++++++++++------------- mysql-test/r/multi_statement.result | 33 +++ mysql-test/t/multi_statement.test | 13 + 3 files changed, 277 insertions(+), 199 deletions(-) create mode 100644 mysql-test/r/multi_statement.result create mode 100644 mysql-test/t/multi_statement.test diff --git a/client/mysqltest.c b/client/mysqltest.c index 9bcef569669..a53e259c726 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -42,7 +42,7 @@ **********************************************************************/ -#define MTEST_VERSION "2.0" +#define MTEST_VERSION "2.1" #include #include @@ -86,7 +86,8 @@ #define MAX_CON_TRIES 5 #define SLAVE_POLL_INTERVAL 300000 /* 0.3 of a sec */ - +#define DEFAULT_DELIMITER ";" +#define MAX_DELIMITER 16 enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD, OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT, OPT_SKIP_SAFEMALLOC, @@ -114,6 +115,8 @@ static FILE** cur_file; static FILE** file_stack_end; static uint lineno_stack[MAX_INCLUDE_DEPTH]; static char TMPDIR[FN_REFLEN]; +static char delimiter[MAX_DELIMITER]= DEFAULT_DELIMITER; +static uint delimiter_length= 1; static int *cur_block, *block_stack_end; static int block_stack[BLOCK_STACK_DEPTH]; @@ -209,7 +212,8 @@ Q_WAIT_FOR_SLAVE_TO_STOP, Q_REQUIRE_VERSION, Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS, Q_ENABLE_INFO, Q_DISABLE_INFO, -Q_EXEC, +Q_EXEC, Q_DELIMITER, + Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ Q_COMMENT_WITH_COMMAND @@ -281,6 +285,7 @@ const char *command_names[]= "enable_info", "disable_info", "exec", + "delimiter", 0 }; @@ -1472,7 +1477,8 @@ int safe_connect(MYSQL* con, const char* host, const char* user, int i; for (i = 0; i < MAX_CON_TRIES; ++i) { - if (mysql_real_connect(con, host,user, pass, db, port, sock, 0)) + if (mysql_real_connect(con, host,user, pass, db, port, sock, + CLIENT_MULTI_STATEMENTS)) { con_error = 0; break; @@ -1622,24 +1628,46 @@ int do_while(struct st_query* q) } +my_bool end_of_query(int c, char* p) +{ + uint i= 0, j; + int tmp[MAX_DELIMITER]= {0}; + + for (i= 0; c == *(delimiter + i) && i < delimiter_length; + i++, c= fgetc(*cur_file)) + tmp[i]= c; + tmp[i]= c; + + for (j= i; j > 0 && i != delimiter_length; j--) + ungetc(tmp[j], *cur_file); + if (i == delimiter_length) + { + ungetc(tmp[j], *cur_file); + *p= 0; + return 1; + } + return 0; +} + + int read_line(char* buf, int size) { int c; - char* p = buf, *buf_end = buf + size-1; - int no_save = 0; + char* p= buf, *buf_end= buf + size - 1; + int no_save= 0; enum {R_NORMAL, R_Q1, R_ESC_Q_Q1, R_ESC_Q_Q2, R_ESC_SLASH_Q1, R_ESC_SLASH_Q2, - R_Q2, R_COMMENT, R_LINE_START} state = R_LINE_START; + R_Q2, R_COMMENT, R_LINE_START} state= R_LINE_START; start_lineno= *lineno; for (; p < buf_end ;) { - no_save = 0; - c = fgetc(*cur_file); + no_save= 0; + c= fgetc(*cur_file); if (feof(*cur_file)) { if ((*cur_file) != stdin) - my_fclose(*cur_file,MYF(0)); + my_fclose(*cur_file, MYF(0)); cur_file--; lineno--; if (cur_file == file_stack) @@ -1650,11 +1678,8 @@ int read_line(char* buf, int size) switch(state) { case R_NORMAL: /* Only accept '{' in the beginning of a line */ - if (c == ';') - { - *p = 0; + if (end_of_query(c, p)) return 0; - } else if (c == '\'') state = R_Q1; else if (c == '"') @@ -1668,7 +1693,7 @@ int read_line(char* buf, int size) case R_COMMENT: if (c == '\n') { - *p=0; + *p= 0; (*lineno)++; return 0; } @@ -1678,78 +1703,72 @@ int read_line(char* buf, int size) { state = R_COMMENT; } - else if (my_isspace(charset_info,c)) + else if (my_isspace(charset_info, c)) { if (c == '\n') start_lineno= ++*lineno; /* Query hasn't started yet */ - no_save = 1; + no_save= 1; } else if (c == '}') { - *buf++ = '}'; - *buf = 0; + *buf++= '}'; + *buf= 0; return 0; } - else if (c == ';' || c == '{') + else if (end_of_query(c, p) || c == '{') { - *p = 0; + *p= 0; return 0; } else if (c == '\'') - state = R_Q1; + state= R_Q1; else if (c == '"') - state = R_Q2; + state= R_Q2; else - state = R_NORMAL; + state= R_NORMAL; break; case R_Q1: if (c == '\'') - state = R_ESC_Q_Q1; + state= R_ESC_Q_Q1; else if (c == '\\') - state = R_ESC_SLASH_Q1; + state= R_ESC_SLASH_Q1; break; case R_ESC_Q_Q1: - if (c == ';') - { - *p = 0; + if (end_of_query(c, p)) return 0; - } if (c != '\'') - state = R_NORMAL; + state= R_NORMAL; else - state = R_Q1; + state= R_Q1; break; case R_ESC_SLASH_Q1: - state = R_Q1; + state= R_Q1; break; case R_Q2: if (c == '"') - state = R_ESC_Q_Q2; + state= R_ESC_Q_Q2; else if (c == '\\') - state = R_ESC_SLASH_Q2; + state= R_ESC_SLASH_Q2; break; case R_ESC_Q_Q2: - if (c == ';') - { - *p = 0; + if (end_of_query(c, p)) return 0; - } if (c != '"') - state = R_NORMAL; + state= R_NORMAL; else - state = R_Q2; + state= R_Q2; break; case R_ESC_SLASH_Q2: - state = R_Q2; + state= R_Q2; break; } if (!no_save) - *p++ = c; + *p++= c; } - *p=0; /* Always end with \0 */ + *p= 0; /* Always end with \0 */ return feof(*cur_file); } @@ -1766,22 +1785,22 @@ int read_query(struct st_query** q_ptr) get_dynamic(&q_lines, (gptr) q_ptr, parser.current_line) ; return 0; } - if (!(*q_ptr=q=(struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME))) || + if (!(*q_ptr= q= (struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME))) || insert_dynamic(&q_lines, (gptr) &q)) die(NullS); - q->record_file[0] = 0; - q->require_file=0; - q->first_word_len = 0; + q->record_file[0]= 0; + q->require_file= 0; + q->first_word_len= 0; memcpy((gptr) q->expected_errno, (gptr) global_expected_errno, sizeof(global_expected_errno)); - q->expected_errors=global_expected_errors; - q->abort_on_error = global_expected_errno[0] == 0; - bzero((gptr) global_expected_errno,sizeof(global_expected_errno)); + q->expected_errors= global_expected_errors; + q->abort_on_error= global_expected_errno[0] == 0; + bzero((gptr) global_expected_errno, sizeof(global_expected_errno)); global_expected_errors=0; q->type = Q_UNKNOWN; - q->query_buf=q->query=0; + q->query_buf= q->query= 0; if (read_line(read_query_buf, sizeof(read_query_buf))) return 1; @@ -1791,20 +1810,20 @@ int read_query(struct st_query** q_ptr) } else if (p[0] == '-' && p[1] == '-') { - q->type = Q_COMMENT_WITH_COMMAND; - p+=2; /* To calculate first word */ + q->type= Q_COMMENT_WITH_COMMAND; + p+= 2; /* To calculate first word */ } else { if (*p == '!') { - q->abort_on_error = 0; + q->abort_on_error= 0; p++; if (*p == '$') { - expected_errno = 0; + expected_errno= 0; p++; - for (;my_isdigit(charset_info,*p);p++) + for (; my_isdigit(charset_info, *p); p++) expected_errno = expected_errno * 10 + *p - '0'; q->expected_errno[0] = expected_errno; q->expected_errno[1] = 0; @@ -1812,30 +1831,30 @@ int read_query(struct st_query** q_ptr) } } - while (*p && my_isspace(charset_info,*p)) + while (*p && my_isspace(charset_info, *p)) p++ ; if (*p == '@') { p++; p1 = q->record_file; - while (!my_isspace(charset_info,*p) && + while (!my_isspace(charset_info, *p) && p1 < q->record_file + sizeof(q->record_file) - 1) *p1++ = *p++; *p1 = 0; } } - while (*p && my_isspace(charset_info,*p)) + while (*p && my_isspace(charset_info, *p)) p++; - if (!(q->query_buf=q->query=my_strdup(p,MYF(MY_WME)))) + if (!(q->query_buf= q->query= my_strdup(p, MYF(MY_WME)))) die(NullS); /* Calculate first word and first argument */ - for (p=q->query; *p && !my_isspace(charset_info,*p) ; p++) ; - q->first_word_len = (uint) (p - q->query); - while (*p && my_isspace(charset_info,*p)) + for (p= q->query; *p && !my_isspace(charset_info, *p) ; p++) ; + q->first_word_len= (uint) (p - q->query); + while (*p && my_isspace(charset_info, *p)) p++; - q->first_argument=p; - q->end = strend(q->query); + q->first_argument= p; + q->end= strend(q->query); parser.read_lines++; return 0; } @@ -2129,12 +2148,12 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res) int run_query(MYSQL* mysql, struct st_query* q, int flags) { - MYSQL_RES* res = 0; - int i, error = 0; + MYSQL_RES* res= 0; + int i, error= 0, err= 0, counter= 0; DYNAMIC_STRING *ds; DYNAMIC_STRING ds_tmp; DYNAMIC_STRING eval_query; - char* query; + char* query, buff[MAX_DELIMITER + 1]= {0}; int query_len; DBUG_ENTER("run_query"); @@ -2162,150 +2181,159 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) if ((flags & QUERY_SEND) && mysql_send_query(mysql, query, query_len)) die("At line %u: unable to send query '%s'(mysql_errno=%d,errno=%d)", - start_lineno, query, - mysql_errno(mysql), errno); - if ((flags & QUERY_SEND) && !disable_query_log) - { - replace_dynstr_append_mem(ds,query, query_len); - dynstr_append_mem(ds,";\n",2); - } - if (!(flags & QUERY_REAP)) - DBUG_RETURN(0); + start_lineno, query, mysql_errno(mysql), errno); - if ((*mysql->methods->read_query_result)(mysql) || - (!(last_result = res = mysql_store_result(mysql)) && - mysql_field_count(mysql))) + do { - if (q->require_file) + if ((flags & QUERY_SEND) && !disable_query_log && !counter) { - abort_not_supported_test(); + replace_dynstr_append_mem(ds,query, query_len); + sprintf(buff, "%s\n", delimiter); + dynstr_append_mem(ds, buff, strlen(delimiter) + 1); } - if (q->abort_on_error) - die("At line %u: query '%s' failed: %d: %s", start_lineno, query, - mysql_errno(mysql), mysql_error(mysql)); - else - { - for (i=0 ; (uint) i < q->expected_errors ; i++) - { - if ((q->expected_errno[i] == mysql_errno(mysql))) - { - if (i == 0 && q->expected_errors == 1) - { - /* Only log error if there is one possible error */ - dynstr_append_mem(ds,"ERROR ",6); - replace_dynstr_append_mem(ds, mysql_sqlstate(mysql), - strlen(mysql_sqlstate(mysql))); - dynstr_append_mem(ds,": ",2); - replace_dynstr_append_mem(ds,mysql_error(mysql), - strlen(mysql_error(mysql))); - dynstr_append_mem(ds,"\n",1); - } - /* Don't log error if we may not get an error */ - else if (q->expected_errno[0] != 0) - dynstr_append(ds,"Got one of the listed errors\n"); - goto end; /* Ok */ - } - } - DBUG_PRINT("info",("i: %d expected_errors: %d", i, q->expected_errors)); - dynstr_append_mem(ds,"ERROR ",6); - replace_dynstr_append_mem(ds, mysql_sqlstate(mysql), - strlen(mysql_sqlstate(mysql))); - dynstr_append_mem(ds,": ",2); - replace_dynstr_append_mem(ds, mysql_error(mysql), - strlen(mysql_error(mysql))); - dynstr_append_mem(ds,"\n",1); - if (i) - { - verbose_msg("query '%s' failed with wrong errno %d instead of %d...", - q->query, mysql_errno(mysql), q->expected_errno[0]); - error= 1; - goto end; - } - verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql), - mysql_error(mysql)); - /* - if we do not abort on error, failure to run the query does - not fail the whole test case - */ - goto end; - } - /*{ - verbose_msg("failed in mysql_store_result for query '%s' (%d)", query, - mysql_errno(mysql)); - error = 1; - goto end; - }*/ - } + if (!(flags & QUERY_REAP)) + DBUG_RETURN(0); - if (q->expected_errno[0]) - { - error = 1; - verbose_msg("query '%s' succeeded - should have failed with errno %d...", - q->query, q->expected_errno[0]); - goto end; - } - - if (!disable_result_log) - { - if (res) + if ((!counter && (*mysql->methods->read_query_result)(mysql)) || + (!(last_result= res= mysql_store_result(mysql)) && + mysql_field_count(mysql))) { - int num_fields= mysql_num_fields(res); - MYSQL_FIELD *fields= mysql_fetch_fields(res); - for (i = 0; i < num_fields; i++) + if (q->require_file) { - if (i) - dynstr_append_mem(ds, "\t", 1); - dynstr_append(ds, fields[i].name); + abort_not_supported_test(); } - dynstr_append_mem(ds, "\n", 1); - append_result(ds, res); - } - - /* Add all warnings to the result */ - if (!disable_warnings && mysql_warning_count(mysql)) - { - MYSQL_RES *warn_res=0; - uint count= mysql_warning_count(mysql); - if (!mysql_real_query(mysql, "SHOW WARNINGS", 13)) - { - warn_res=mysql_store_result(mysql); - } - if (!warn_res) - verbose_msg("Warning count is %u but didn't get any warnings\n", - count); + if (q->abort_on_error) + die("At line %u: query '%s' failed: %d: %s", start_lineno, query, + mysql_errno(mysql), mysql_error(mysql)); else { - dynstr_append_mem(ds, "Warnings:\n", 10); - append_result(ds, warn_res); - mysql_free_result(warn_res); + for (i=0 ; (uint) i < q->expected_errors ; i++) + { + if ((q->expected_errno[i] == mysql_errno(mysql))) + { + if (i == 0 && q->expected_errors == 1) + { + /* Only log error if there is one possible error */ + dynstr_append_mem(ds,"ERROR ",6); + replace_dynstr_append_mem(ds, mysql_sqlstate(mysql), + strlen(mysql_sqlstate(mysql))); + dynstr_append_mem(ds, ": ", 2); + replace_dynstr_append_mem(ds,mysql_error(mysql), + strlen(mysql_error(mysql))); + dynstr_append_mem(ds,"\n",1); + } + /* Don't log error if we may not get an error */ + else if (q->expected_errno[0] != 0) + dynstr_append(ds,"Got one of the listed errors\n"); + goto end; /* Ok */ + } + } + DBUG_PRINT("info",("i: %d expected_errors: %d", i, q->expected_errors)); + dynstr_append_mem(ds, "ERROR ",6); + replace_dynstr_append_mem(ds, mysql_sqlstate(mysql), + strlen(mysql_sqlstate(mysql))); + dynstr_append_mem(ds,": ",2); + replace_dynstr_append_mem(ds, mysql_error(mysql), + strlen(mysql_error(mysql))); + dynstr_append_mem(ds,"\n",1); + if (i) + { + verbose_msg("query '%s' failed with wrong errno %d instead of %d...", + q->query, mysql_errno(mysql), q->expected_errno[0]); + error= 1; + goto end; + } + verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql), + mysql_error(mysql)); + /* + if we do not abort on error, failure to run the query does + not fail the whole test case + */ + goto end; + } + /*{ + verbose_msg("failed in mysql_store_result for query '%s' (%d)", query, + mysql_errno(mysql)); + error = 1; + goto end; + }*/ + } + + if (q->expected_errno[0]) + { + error = 1; + verbose_msg("query '%s' succeeded - should have failed with errno %d...", + q->query, q->expected_errno[0]); + goto end; + } + + if (!disable_result_log) + { + if (res) + { + int num_fields= mysql_num_fields(res); + MYSQL_FIELD *fields= mysql_fetch_fields(res); + + for (i = 0; i < num_fields; i++) + { + if (i) + dynstr_append_mem(ds, "\t", 1); + dynstr_append(ds, fields[i].name); + } + dynstr_append_mem(ds, "\n", 1); + append_result(ds, res); + } + + /* Add all warnings to the result */ + if (!disable_warnings && mysql_warning_count(mysql)) + { + MYSQL_RES *warn_res=0; + uint count= mysql_warning_count(mysql); + if (!mysql_real_query(mysql, "SHOW WARNINGS", 13)) + { + warn_res= mysql_store_result(mysql); + } + if (!warn_res) + verbose_msg("Warning count is %u but didn't get any warnings\n", + count); + else + { + dynstr_append_mem(ds, "Warnings:\n", 10); + append_result(ds, warn_res); + mysql_free_result(warn_res); + } + } + if (!disable_info && mysql_info(mysql)) + { + dynstr_append(ds, "info: "); + dynstr_append(ds, mysql_info(mysql)); + dynstr_append_mem(ds, "\n", 1); } } - if (!disable_info && mysql_info(mysql)) + + if (glob_replace) + free_replace(); + + if (record) { - dynstr_append(ds, "info: "); - dynstr_append(ds, mysql_info(mysql)); - dynstr_append_mem(ds, "\n", 1); + if (!q->record_file[0] && !result_file) + die("At line %u: Missing result file", start_lineno); + if (!result_file) + str_to_file(q->record_file, ds->str, ds->length); } - } - - if (glob_replace) - free_replace(); - - if (record) - { - if (!q->record_file[0] && !result_file) - die("At line %u: Missing result file", start_lineno); - if (!result_file) - str_to_file(q->record_file, ds->str, ds->length); - } - else if (q->record_file[0]) - { - error = check_result(ds, q->record_file, q->require_file); - } + else if (q->record_file[0]) + { + error = check_result(ds, q->record_file, q->require_file); + } + if (res) + mysql_free_result(res); + last_result= 0; + counter++; + } while (!(err= mysql_next_result(mysql))); + if (err >= 1) + mysql_error(mysql); end: - if (res) - mysql_free_result(res); last_result=0; if (ds == &ds_tmp) dynstr_free(&ds_tmp); @@ -2425,7 +2453,7 @@ int main(int argc, char **argv) my_bool require_file=0, q_send_flag=0; char save_file[FN_REFLEN]; MY_INIT(argv[0]); - { + DBUG_ENTER("main"); DBUG_PROCESS(argv[0]); @@ -2520,6 +2548,10 @@ int main(int argc, char **argv) case Q_DEC: do_dec(q); break; case Q_ECHO: do_echo(q); break; case Q_SYSTEM: do_system(q); break; + case Q_DELIMITER: + strmake(delimiter, q->first_argument, sizeof(delimiter) - 1); + delimiter_length= strlen(delimiter); + break; case Q_LET: do_let(q); break; case Q_EVAL_RESULT: eval_result = 1; break; case Q_EVAL: @@ -2646,9 +2678,9 @@ int main(int argc, char **argv) free_used_memory(); exit(error ? 1 : 0); return error ? 1 : 0; /* Keep compiler happy */ - } } + /* Read arguments for embedded server and put them into embedded_server_args_count and embedded_server_args[] diff --git a/mysql-test/r/multi_statement.result b/mysql-test/r/multi_statement.result new file mode 100644 index 00000000000..4451b0a355e --- /dev/null +++ b/mysql-test/r/multi_statement.result @@ -0,0 +1,33 @@ +select 1; +1 +1 +select 2; +select 3; +select 4|||| +2 +2 +3 +3 +4 +4 +select 5; +select 6; +select 50, 'abc';'abcd' +5 +5 +6 +6 +50 abc +50 abc +select "abcd'";'abcd' +abcd' +abcd' +select "'abcd";'abcd' +'abcd +'abcd +select 5'abcd' +5 +5 +select 'finish'; +finish +finish diff --git a/mysql-test/t/multi_statement.test b/mysql-test/t/multi_statement.test new file mode 100644 index 00000000000..bd90275c9f5 --- /dev/null +++ b/mysql-test/t/multi_statement.test @@ -0,0 +1,13 @@ +select 1; +delimiter ||||; +select 2; +select 3; +select 4|||| +delimiter 'abcd'|||| +select 5; +select 6; +select 50, 'abc';'abcd' +select "abcd'";'abcd'select "'abcd";'abcd' +select 5'abcd' +delimiter ;'abcd' +select 'finish'; From 2c2c409afb04e43cd46e3856bea6d48d433d4028 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 11:44:22 +0200 Subject: [PATCH 33/40] Some minor code clean up. --- client/mysqltest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index a53e259c726..08b58f1ccfe 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1630,7 +1630,7 @@ int do_while(struct st_query* q) my_bool end_of_query(int c, char* p) { - uint i= 0, j; + uint i, j; int tmp[MAX_DELIMITER]= {0}; for (i= 0; c == *(delimiter + i) && i < delimiter_length; @@ -1642,7 +1642,7 @@ my_bool end_of_query(int c, char* p) ungetc(tmp[j], *cur_file); if (i == delimiter_length) { - ungetc(tmp[j], *cur_file); + ungetc(tmp[i], *cur_file); *p= 0; return 1; } @@ -2189,7 +2189,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) { replace_dynstr_append_mem(ds,query, query_len); sprintf(buff, "%s\n", delimiter); - dynstr_append_mem(ds, buff, strlen(delimiter) + 1); + dynstr_append_mem(ds, buff, delimiter_length + 1); } if (!(flags & QUERY_REAP)) DBUG_RETURN(0); From 029e30b4aa357708bdbf924cfd78069fb19382bb Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 16:36:12 +0400 Subject: [PATCH 34/40] Missed header added heap/hp_hash.c: header added --- heap/hp_hash.c | 1 + 1 file changed, 1 insertion(+) diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 4fdbfa16586..d30cbc9b82f 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -18,6 +18,7 @@ #include "heapdef.h" #include +#include ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key, uint start_key_len, From 241bb226993b5ea11e73903858b5ba0fdc6e6647 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 14:15:27 +0100 Subject: [PATCH 35/40] Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server. Added missing cleanup in sp-security.test. mysql-test/r/sp-security.result: Added clean-up. mysql-test/t/sp-security.test: Added clean-up. sql/item_func.cc: Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server. sql/sp_head.cc: Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server. sql/sp_head.h: Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server. sql/sql_parse.cc: Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server. --- mysql-test/r/sp-security.result | 1 + mysql-test/t/sp-security.test | 1 + sql/item_func.cc | 8 +++++++- sql/sp_head.cc | 4 +++- sql/sp_head.h | 3 ++- sql/sql_parse.cc | 6 ++++++ 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index 00e22ceebd4..9d5f71225b6 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -39,6 +39,7 @@ call stamp(5); ERROR 42000: Access denied for user: 'dummy'@'localhost' to database 'db1_secret' call stamp(6); ERROR 42000: Access denied for user: ''@'localhost' to database 'db1_secret' +drop procedure stamp; use test; drop database db1_secret; delete from mysql.user where user='dummy'; diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 923438c8525..0d77b53210e 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -94,6 +94,7 @@ call stamp(6); # Clean up connection con1root; +drop procedure stamp; use test; drop database db1_secret; delete from mysql.user where user='dummy'; diff --git a/sql/item_func.cc b/sql/item_func.cc index 428ca5aa90e..442e5c53675 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3069,19 +3069,25 @@ Item_func_sp::execute(Item **itp) { DBUG_ENTER("Item_func_sp::execute"); THD *thd= current_thd; - st_sp_security_context save_ctx; int res; +#ifndef NO_EMBEDDED_ACCESS_CHECKS + st_sp_security_context save_ctx; +#endif if (! m_sp) m_sp= sp_find_function(thd, &m_name); if (! m_sp) DBUG_RETURN(-1); +#ifndef NO_EMBEDDED_ACCESS_CHECKS sp_change_security_context(thd, m_sp, &save_ctx); +#endif res= m_sp->execute_function(thd, args, arg_count, itp); +#ifndef NO_EMBEDDED_ACCESS_CHECKS sp_restore_security_context(thd, m_sp, &save_ctx); +#endif DBUG_RETURN(res); } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index e40d56d4ef9..f6f4b4b8dae 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1080,7 +1080,7 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp) // // Security context swapping // - +#ifndef NO_EMBEDDED_ACCESS_CHECKS void sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp) { @@ -1136,3 +1136,5 @@ sp_restore_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp) strncpy(thd->priv_host, ctxp->priv_host, sizeof(thd->priv_host)); } } + +#endif /* NO_EMBEDDED_ACCESS_CHECKS */ diff --git a/sql/sp_head.h b/sql/sp_head.h index 2c0a5e18bad..b2dee5204bb 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -649,10 +649,11 @@ struct st_sp_security_context char *ip; }; +#ifndef NO_EMBEDDED_ACCESS_CHECKS void sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp); - void sp_restore_security_context(THD *thd, sp_head *sp,st_sp_security_context *ctxp); +#endif /* NO_EMBEDDED_ACCESS_CHECKS */ #endif /* _SP_HEAD_H_ */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 89a81498ef2..1ff4d721924 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3501,7 +3501,9 @@ mysql_execute_command(THD *thd) } else { +#ifndef NO_EMBEDDED_ACCESS_CHECKS st_sp_security_context save_ctx; +#endif uint smrx; LINT_INIT(smrx); @@ -3533,11 +3535,15 @@ mysql_execute_command(THD *thd) thd->server_status |= SERVER_MORE_RESULTS_EXISTS; } +#ifndef NO_EMBEDDED_ACCESS_CHECKS sp_change_security_context(thd, sp, &save_ctx); +#endif res= sp->execute_procedure(thd, &lex->value_list); +#ifndef NO_EMBEDDED_ACCESS_CHECKS sp_restore_security_context(thd, sp, &save_ctx); +#endif #ifndef EMBEDDED_LIBRARY thd->net.no_send_ok= nsok; From 96636daf674aff9b744fb7f0a501a0cff36c9921 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 17:39:33 +0400 Subject: [PATCH 36/40] proper fix for the bug #2077: accented characters in enum/defaul values are reported incorrectly. note: bar asked me to use res.charset in ::sql_type() functions to be more consistent. mysql-test/r/type_enum.result: proper fix for the bug #2077: accented characters in enum/defaul values are reported incorrectly mysql-test/t/type_enum.test: proper fix for the bug #2077: accented characters in enum/defaul values are reported incorrectly sql/field.cc: proper fix for the bug #2077: accented characters in enum/defaul values are reported incorrectly sql/sql_show.cc: proper fix for the bug #2077: accented characters in enum/defaul values are reported incorrectly sql/table.cc: proper fix for the bug #2077: accented characters in enum/defaul values are reported incorrectly --- mysql-test/r/type_enum.result | 3 ++- mysql-test/t/type_enum.test | 2 +- sql/field.cc | 22 ++++++++++++++++------ sql/sql_show.cc | 12 +++++++++--- sql/table.cc | 16 ++++++++++++++-- 5 files changed, 42 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 1903037480a..2ab6695e5c6 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1636,6 +1636,7 @@ t1 CREATE TABLE `t1` ( `a` enum('','a','b') NOT NULL default 'b' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +set names latin1; create table t1 (a enum(0xE4, '1', '2') not null default 0xE4); show columns from t1; Field Type Null Key Default Extra @@ -1643,6 +1644,6 @@ a enum(' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('ä','1','2') NOT NULL default '?' + `a` enum('ä','1','2') NOT NULL default 'ä' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index bcebb1a5b27..c53277334a6 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -29,8 +29,8 @@ drop table t1; # Bug #2077 # +set names latin1; create table t1 (a enum(0xE4, '1', '2') not null default 0xE4); show columns from t1; -# should be fixed ASAP show create table t1; drop table t1; diff --git a/sql/field.cc b/sql/field.cc index 23f6e1232b6..237427a9d80 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5192,16 +5192,21 @@ void Field_enum::sort_string(char *to,uint length __attribute__((unused))) void Field_enum::sql_type(String &res) const { + char buffer[255]; + String enum_item(buffer, sizeof(buffer), res.charset()); + res.length(0); res.append("enum("); bool flag=0; - for (const char **pos=typelib->type_names; *pos ; pos++) + for (const char **pos= typelib->type_names; *pos; pos++) { if (flag) res.append(','); - append_unescaped(&res, *pos, strlen(*pos)); - flag=1; + /* convert to res.charset() == utf8, then quote */ + enum_item.copy(*pos, strlen(*pos), charset(), res.charset()); + append_unescaped(&res, enum_item.ptr(), enum_item.length()); + flag= 1; } res.append(')'); } @@ -5300,16 +5305,21 @@ String *Field_set::val_str(String *val_buffer, void Field_set::sql_type(String &res) const { + char buffer[255]; + String set_item(buffer, sizeof(buffer), res.charset()); + res.length(0); res.append("set("); bool flag=0; - for (const char **pos=typelib->type_names; *pos ; pos++) + for (const char **pos= typelib->type_names; *pos; pos++) { if (flag) res.append(','); - append_unescaped(&res, *pos, strlen(*pos)); - flag=1; + /* convert to res.charset() == utf8, then quote */ + set_item.copy(*pos, strlen(*pos), charset(), res.charset()); + append_unescaped(&res, set_item.ptr(), set_item.length()); + flag= 1; } res.append(')'); } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 855b5d1e97e..781ee2e7082 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -688,14 +688,14 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, { byte *pos; uint flags=field->flags; - String type(tmp,sizeof(tmp), field->charset()); + String type(tmp,sizeof(tmp), system_charset_info); uint col_access; bool null_default_value=0; protocol->prepare_for_resend(); protocol->store(field->field_name, system_charset_info); field->sql_type(type); - protocol->store(type.ptr(), type.length(), type.charset()); + protocol->store(type.ptr(), type.length(), system_charset_info); if (verbose) protocol->store(field->has_charset() ? field->charset()->name : "NULL", system_charset_info); @@ -1117,7 +1117,13 @@ store_create_info(THD *thd, TABLE *table, String *packet) type.set(tmp, sizeof(tmp), field->charset()); field->val_str(&type,&type); if (type.length()) - append_unescaped(packet, type.ptr(), type.length()); + { + String def_val; + /* convert to system_charset_info == utf8 */ + def_val.copy(type.ptr(), type.length(), field->charset(), + system_charset_info); + append_unescaped(packet, def_val.ptr(), def_val.length()); + } else packet->append("''",2); } diff --git a/sql/table.cc b/sql/table.cc index e87cafd5275..7c12762d9c4 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1058,9 +1058,21 @@ ulong next_io_size(register ulong pos) } /* next_io_size */ - /* Store in String an SQL quoted string */ +/* + Store an SQL quoted string. -void append_unescaped(String *res,const char *pos, uint length) + SYNOPSIS + append_unescaped() + res result String + pos string to be quoted + length it's length + + NOTE + This function works correctly with utf8 or single-byte charset strings. + May fail with some multibyte charsets though. +*/ + +void append_unescaped(String *res, const char *pos, uint length) { const char *end= pos+length; res->append('\''); From 8af0acea6faa9a6fbb675696396c4019972df0ce Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 16:03:39 +0200 Subject: [PATCH 37/40] Fixed parenthesis needed by valgrind-max. --- client/mysqltest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 08b58f1ccfe..b3b8cd55221 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2453,7 +2453,7 @@ int main(int argc, char **argv) my_bool require_file=0, q_send_flag=0; char save_file[FN_REFLEN]; MY_INIT(argv[0]); - + { DBUG_ENTER("main"); DBUG_PROCESS(argv[0]); @@ -2678,6 +2678,7 @@ int main(int argc, char **argv) free_used_memory(); exit(error ? 1 : 0); return error ? 1 : 0; /* Keep compiler happy */ + } } From bc748bef530dcbcd155f3fe58f68d77520d7d264 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 18:09:22 +0100 Subject: [PATCH 38/40] Post-merge fixes. Multiple result sets from stored procedures now works with the mysql and mysqltest clients. client/mysqltest.c: Post-merge fixes. mysql-test/r/index_merge_innodb.result: Post-merge fixes. mysql-test/r/sp-error.result: Post-merge fixes. Removed now obsolete error test for multiple selects (without "into"). mysql-test/r/sp.result: Post-merge fixes. Added test for mulple result sets. mysql-test/r/variables.result: Post-merge fixes. mysql-test/t/index_merge_innodb.test: Post-merge fixes. mysql-test/t/sp-error.test: Post-merge fixes. Removed now obsolete error test for multiple selects (without "into"). mysql-test/t/sp.test: Post-merge fixes. Added test for mulple result sets. sql/lex.h: Post-merge fixes. --- client/mysqltest.c | 16 - mysql-test/r/index_merge_innodb.result | 2 +- mysql-test/r/sp-error.result | 184 +++--- mysql-test/r/sp.result | 737 +++++++++++++------------ mysql-test/r/variables.result | 2 +- mysql-test/t/index_merge_innodb.test | 2 +- mysql-test/t/sp-error.test | 95 ++-- mysql-test/t/sp.test | 27 +- sql/lex.h | 3 +- 9 files changed, 541 insertions(+), 527 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index d61250878b3..b3b8cd55221 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -135,8 +135,6 @@ static const char *embedded_server_groups[] = { NullS }; -static char delimiter= DEFAULT_DELIMITER; - DYNAMIC_ARRAY q_lines; #include "sslopt-vars.h" @@ -1629,17 +1627,6 @@ int do_while(struct st_query* q) return 0; } -int do_delimiter(char *p) -{ - while (*p && my_isspace(charset_info,*p)) - p++; - if (!*p) - die("Missing delimiter character\n"); - delimiter=*p; - - return 0; -} - my_bool end_of_query(int c, char* p) { @@ -2645,9 +2632,6 @@ int main(int argc, char **argv) do_sync_with_master2(""); break; } - case Q_DELIMITER: - do_delimiter(q->first_argument); - break; case Q_COMMENT: /* Ignore row */ case Q_COMMENT_WITH_COMMAND: break; diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index ef6ffa82da7..a5eb882fa00 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -5,7 +5,7 @@ key1 int not null, key2 int not null, INDEX i1(key1), INDEX i2(key2), -) type=innodb; +) engine=innodb; explain select * from t1 where key1 < 5 or key2 > 197; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using where diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index ac952549803..748fda6c4ec 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1,110 +1,102 @@ delete from mysql.proc; -create procedure syntaxerror(t int); +create procedure syntaxerror(t int)| ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 -create procedure syntaxerror(t int); +create procedure syntaxerror(t int)| ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 -create procedure syntaxerror(t int); +create procedure syntaxerror(t int)| ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 create procedure proc1() -set @x = 42; +set @x = 42| create function func1() returns int -return 42; +return 42| create procedure foo() -create procedure bar() set @x=3; +create procedure bar() set @x=3| ERROR 2F003: Can't create a PROCEDURE from within another stored routine create procedure foo() -create function bar() returns double return 2.3; +create function bar() returns double return 2.3| ERROR 2F003: Can't create a FUNCTION from within another stored routine create procedure proc1() -set @x = 42; +set @x = 42| ERROR 42000: PROCEDURE proc1 already exists create function func1() returns int -return 42; +return 42| ERROR 42000: FUNCTION func1 already exists -drop procedure proc1; -drop function func1; -alter procedure foo; +drop procedure proc1| +drop function func1| +alter procedure foo| ERROR 42000: PROCEDURE foo does not exist -alter function foo; +alter function foo| ERROR 42000: FUNCTION foo does not exist -drop procedure foo; +drop procedure foo| ERROR 42000: PROCEDURE foo does not exist -drop function foo; +drop function foo| ERROR 42000: FUNCTION foo does not exist -call foo(); +call foo()| ERROR 42000: PROCEDURE foo does not exist -drop procedure if exists foo; +drop procedure if exists foo| Warnings: -Warning 1288 PROCEDURE foo does not exist -show create procedure foo; +Warning 1289 PROCEDURE foo does not exist +show create procedure foo| ERROR 42000: PROCEDURE foo does not exist create procedure foo() foo: loop leave bar; -end loop; +end loop| ERROR 42000: LEAVE with no matching label: bar create procedure foo() foo: loop iterate bar; -end loop; +end loop| ERROR 42000: ITERATE with no matching label: bar create procedure foo() foo: begin iterate foo; -end; +end| ERROR 42000: ITERATE with no matching label: foo create procedure foo() foo: loop foo: loop set @x=2; end loop foo; -end loop foo; +end loop foo| ERROR 42000: Redefining label foo create procedure foo() foo: loop set @x=2; -end loop bar; +end loop bar| ERROR 42000: End-label bar without match create procedure foo(out x int) begin declare y int; set x = y; -end; +end| Warnings: -Warning 1294 Referring to uninitialized variable y -drop procedure foo; +Warning 1295 Referring to uninitialized variable y +drop procedure foo| create procedure foo() -begin -select name from mysql.proc; -select type from mysql.proc; -end; -call foo(); -ERROR 0A000: SELECT in a stored procedure must have INTO -drop procedure foo; -create procedure foo() -return 42; +return 42| ERROR 42000: RETURN is only allowed in a FUNCTION create function foo() returns int begin declare x int; select max(c) into x from test.t; return x; -end; +end| ERROR 0A000: Statements like SELECT, INSERT, UPDATE (and others) are not allowed in a FUNCTION create procedure p(x int) -insert into test.t1 values (x); +insert into test.t1 values (x)| create function f(x int) returns int -return x+42; -call p(); +return x+42| +call p()| ERROR 42000: Wrong number of arguments for PROCEDURE p, expected 1, got 0 -call p(1, 2); +call p(1, 2)| ERROR 42000: Wrong number of arguments for PROCEDURE p, expected 1, got 2 -select f(); +select f()| ERROR 42000: Wrong number of arguments for FUNCTION f, expected 1, got 0 -select f(1, 2); +select f(1, 2)| ERROR 42000: Wrong number of arguments for FUNCTION f, expected 1, got 2 -drop procedure p; -drop function f; +drop procedure p| +drop function f| create procedure p(val int, out res int) begin declare x int default 0; @@ -115,7 +107,7 @@ set res = 0; else set res = 1; end if; -end; +end| ERROR 42000: Undefined CONDITION: foo create procedure p(val int, out res int) begin @@ -128,13 +120,13 @@ set res = 0; else set res = 1; end if; -end; +end| ERROR 42000: Undefined CONDITION: bar create function f(val int) returns int begin declare x int; set x = val+3; -end; +end| ERROR 42000: No RETURN found in FUNCTION f create function f(val int) returns int begin @@ -143,16 +135,16 @@ set x = val+3; if x < 4 then return x; end if; -end; -select f(10); +end| +select f(10)| ERROR 2F005: FUNCTION f ended without RETURN -drop function f; +drop function f| create procedure p() begin declare c cursor for insert into test.t1 values ("foo", 42); open c; close c; -end; +end| ERROR 42000: Cursor statement must be a SELECT create procedure p() begin @@ -160,46 +152,46 @@ declare x int; declare c cursor for select * into x from test.t limit 1; open c; close c; -end; +end| ERROR 42000: Cursor SELECT must not have INTO create procedure p() begin declare c cursor for select * from test.t; open cc; close c; -end; +end| ERROR 42000: Undefined CURSOR: cc -drop table if exists t1; -create table t1 (val int); +drop table if exists t1| +create table t1 (val int)| create procedure p() begin declare c cursor for select * from test.t1; open c; open c; close c; -end; -call p(); +end| +call p()| ERROR 24000: Cursor is already open -drop procedure p; +drop procedure p| create procedure p() begin declare c cursor for select * from test.t1; open c; close c; close c; -end; -call p(); +end| +call p()| ERROR 24000: Cursor is not open -drop procedure p; -alter procedure bar3 sql security invoker; +drop procedure p| +alter procedure bar3 sql security invoker| ERROR 42000: PROCEDURE bar3 does not exist alter procedure bar3 name -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA| ERROR 42000: Identifier name 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' is too long -drop table t1; -drop table if exists t1; -create table t1 (val int, x float); -insert into t1 values (42, 3.1), (19, 1.2); +drop table t1| +drop table if exists t1| +create table t1 (val int, x float)| +insert into t1 values (42, 3.1), (19, 1.2)| create procedure p() begin declare c cursor for select * from t1; @@ -207,7 +199,7 @@ declare x int; open c; fetch c into x, y; close c; -end; +end| ERROR 42000: Undeclared variable: y create procedure p() begin @@ -216,10 +208,10 @@ declare x int; open c; fetch c into x; close c; -end; -call p(); +end| +call p()| ERROR HY000: Wrong number of FETCH variables -drop procedure p; +drop procedure p| create procedure p() begin declare c cursor for select * from t1; @@ -229,66 +221,66 @@ declare z int; open c; fetch c into x, y, z; close c; -end; -call p(); +end| +call p()| ERROR HY000: Wrong number of FETCH variables -drop procedure p; +drop procedure p| create procedure p(in x int, x char(10)) begin -end; +end| ERROR 42000: Duplicate parameter: x create function p(x int, x char(10)) begin -end; +end| ERROR 42000: Duplicate parameter: x create procedure p() begin declare x float; declare x int; -end; +end| ERROR 42000: Duplicate variable: x create procedure p() begin declare c condition for 1064; declare c condition for 1065; -end; +end| ERROR 42000: Duplicate condition: c create procedure p() begin declare c cursor for select * from t1; declare c cursor for select field from t1; -end; +end| ERROR 42000: Duplicate cursor: c create procedure bug1965() begin declare c cursor for select val from t1 order by valname; open c; close c; -end; -call bug1965(); +end| +call bug1965()| ERROR 42S22: Unknown column 'valname' in 'order clause' -drop procedure bug1965; -select 1 into a; +drop procedure bug1965| +select 1 into a| ERROR 42000: Undeclared variable: a create procedure bug336(id char(16)) begin declare x int; set x = (select sum(t.data) from test.t2 t); -end; +end| ERROR 0A000: Subselect value not supported create function bug1654() returns int -return (select sum(t.data) from test.t2 t); +return (select sum(t.data) from test.t2 t)| ERROR 0A000: Statements like SELECT, INSERT, UPDATE (and others) are not allowed in a FUNCTION -drop table if exists table_1; -create table t3 (column_1_0 int); +drop table if exists table_1| +create table t3 (column_1_0 int)| create procedure bug1653() -update t3 set column_1 = 0; -call bug1653(); +update t3 set column_1 = 0| +call bug1653()| ERROR 42S22: Unknown column 'column_1' in 'field list' -drop table t3; -create table t3 (column_1 int); -call bug1653(); -drop procedure bug1653; -drop table t3; -drop table t1; +drop table t3| +create table t3 (column_1 int)| +call bug1653()| +drop procedure bug1653| +drop table t3| +drop table t1| diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 05e6096f8ac..812939751b2 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -38,9 +38,9 @@ bar 666 delete from t1; create procedure empty() begin -end; -call empty(); -drop procedure empty; +end| +call empty()| +drop procedure empty| create procedure scope(a int, b float) begin declare b int; @@ -48,35 +48,35 @@ declare c float; begin declare c int; end; -end; -drop procedure scope; +end| +drop procedure scope| create procedure two(x1 char(16), x2 char(16), y int) begin insert into test.t1 values (x1, y); insert into test.t1 values (x2, y); -end; -call two("one", "two", 3); -select * from t1; +end| +call two("one", "two", 3)| +select * from t1| id data one 3 two 3 -delete from t1; -drop procedure two; +delete from t1| +drop procedure two| create procedure locset(x char(16), y int) begin declare z1, z2 int; set z1 = y; set z2 = z1+2; insert into test.t1 values (x, z2); -end; -call locset("locset", 19); -select * from t1; +end| +call locset("locset", 19)| +select * from t1| id data locset 21 -delete from t1; -drop procedure locset; -drop table if exists t3; -create table t3 ( d date, i int, f double, s varchar(32) ); +delete from t1| +drop procedure locset| +drop table if exists t3| +create table t3 ( d date, i int, f double, s varchar(32) )| create procedure nullset() begin declare ld date; @@ -91,9 +91,9 @@ insert into t3 (i, f, s) values ((ld is null), 1, "ld is null"), ((lf is null), 1, "lf is null"), ((lf = 0), null, "lf = 0"), ((ls is null), 1, "ls is null"); -end; -call nullset(); -select * from t3; +end| +call nullset()| +select * from t3| d i f s NULL NULL NULL NULL NULL 1 1 ld is null @@ -102,140 +102,141 @@ NULL NULL NULL li = 0 NULL 1 1 lf is null NULL NULL NULL lf = 0 NULL 1 1 ls is null -drop table t3; -drop procedure nullset; +drop table t3| +drop procedure nullset| create procedure mixset(x char(16), y int) begin declare z int; set @z = y, z = 666, max_join_size = 100; insert into test.t1 values (x, z); -end; -call mixset("mixset", 19); -show variables like 'max_join_size'; +end| +call mixset("mixset", 19)| +show variables like 'max_join_size'| Variable_name Value max_join_size 100 -select id,data,@z from t1; +select id,data,@z from t1| id data @z mixset 666 19 -delete from t1; -drop procedure mixset; +delete from t1| +drop procedure mixset| create procedure zip(x char(16), y int) begin declare z int; call zap(y, z); call bar(x, z); -end; +end| create procedure zap(x int, out y int) begin declare z int; set z = x+1, y = z; -end; -call zip("zip", 99); -select * from t1; +end| +call zip("zip", 99)| +select * from t1| id data zip 100 -delete from t1; -drop procedure zip; -drop procedure bar; -call zap(7, @zap); -select @zap; +delete from t1| +drop procedure zip| +drop procedure bar| +call zap(7, @zap)| +select @zap| @zap 8 -drop procedure zap; +drop procedure zap| create procedure c1(x int) -call c2("c", x); +call c2("c", x)| create procedure c2(s char(16), x int) -call c3(x, s); +call c3(x, s)| create procedure c3(x int, s char(16)) -call c4("level", x, s); +call c4("level", x, s)| create procedure c4(l char(8), x int, s char(16)) -insert into t1 values (concat(l,s), x); -call c1(42); -select * from t1; +insert into t1 values (concat(l,s), x)| +call c1(42)| +select * from t1| id data levelc 42 -delete from t1; -drop procedure c1; -drop procedure c2; -drop procedure c3; -drop procedure c4; +delete from t1| +drop procedure c1| +drop procedure c2| +drop procedure c3| +drop procedure c4| create procedure iotest(x1 char(16), x2 char(16), y int) begin call inc2(x2, y); insert into test.t1 values (x1, y); -end; +end| create procedure inc2(x char(16), y int) begin call inc(y); insert into test.t1 values (x, y); -end; +end| create procedure inc(inout io int) -set io = io + 1; -call iotest("io1", "io2", 1); -select * from t1; +set io = io + 1| +call iotest("io1", "io2", 1)| +select * from t1| id data io2 2 io1 1 -delete from t1; -drop procedure iotest; -drop procedure inc2; +delete from t1| +drop procedure iotest| +drop procedure inc2| create procedure incr(inout x int) -call inc(x); -select @zap; +call inc(x)| +select @zap| @zap 8 -call incr(@zap); -select @zap; +call incr(@zap)| +select @zap| @zap 9 -drop procedure inc; -drop procedure incr; +drop procedure inc| +drop procedure incr| create procedure cbv1() begin declare y int default 3; call cbv2(y+1, y); insert into test.t1 values ("cbv1", y); -end; +end| create procedure cbv2(y1 int, inout y2 int) begin set y2 = 4711; insert into test.t1 values ("cbv2", y1); -end; -call cbv1(); -select * from t1; +end| +call cbv1()| +select * from t1| id data cbv2 4 cbv1 4711 -delete from t1; -drop procedure cbv1; -drop procedure cbv2; -insert into t2 values ("a", 1, 1.1), ("b", 2, 1.2), ("c", 3, 1.3); +delete from t1| +drop procedure cbv1| +drop procedure cbv2| +insert into t2 values ("a", 1, 1.1), ("b", 2, 1.2), ("c", 3, 1.3)| create procedure sub1(id char(16), x int) -insert into test.t1 values (id, x); +insert into test.t1 values (id, x)| create function sub3(i int) returns int -return i+1; -call sub1("sub1a", (select 7)); -call sub1("sub1b", (select max(i) from t2)); -call sub1("sub1c", (select i,d from t2 limit 1)); -call sub1("sub1d", (select 1 from (select 1) a)); -select * from t1; +return i+1| +call sub1("sub1a", (select 7))| +call sub1("sub1b", (select max(i) from t2))| +call sub1("sub1c", (select i,d from t2 limit 1))| +call sub1("sub1d", (select 1 from (select 1) a))| +select * from t1| id data sub1a 7 sub1b 3 sub1c 1 sub1d 1 -select sub3((select max(i) from t2)); +select sub3((select max(i) from t2))| sub3((select max(i) from t2)) 4 -drop procedure sub1; -drop function sub3; +drop procedure sub1| +drop function sub3| +delete from t2| create procedure a0(x int) while x do set x = x-1; insert into test.t1 values ("a0", x); -end while; -call a0(3); -select * from t1; +end while| +call a0(3)| +select * from t1| id data sub1a 7 sub1b 3 @@ -244,68 +245,68 @@ sub1d 1 a0 2 a0 1 a0 0 -delete from t1; -drop procedure a0; +delete from t1| +drop procedure a0| create procedure a(x int) while x > 0 do set x = x-1; insert into test.t1 values ("a", x); -end while; -call a(3); -select * from t1; +end while| +call a(3)| +select * from t1| id data a 2 a 1 a 0 -delete from t1; -drop procedure a; +delete from t1| +drop procedure a| create procedure b(x int) repeat insert into test.t1 values (repeat("b",3), x); set x = x-1; -until x = 0 end repeat; -call b(3); -select * from t1; +until x = 0 end repeat| +call b(3)| +select * from t1| id data bbb 3 bbb 2 bbb 1 -delete from t1; -drop procedure b; +delete from t1| +drop procedure b| create procedure b2(x int) repeat(select 1 into outfile 'b2'); insert into test.t1 values (repeat("b2",3), x); set x = x-1; -until x = 0 end repeat; -drop procedure b2; +until x = 0 end repeat| +drop procedure b2| create procedure c(x int) hmm: while x > 0 do insert into test.t1 values ("c", x); set x = x-1; iterate hmm; insert into test.t1 values ("x", x); -end while hmm; -call c(3); -select * from t1; +end while hmm| +call c(3)| +select * from t1| id data c 3 c 2 c 1 -delete from t1; -drop procedure c; +delete from t1| +drop procedure c| create procedure d(x int) hmm: while x > 0 do insert into test.t1 values ("d", x); set x = x-1; leave hmm; insert into test.t1 values ("x", x); -end while; -call d(3); -select * from t1; +end while| +call d(3)| +select * from t1| id data d 3 -delete from t1; -drop procedure d; +delete from t1| +drop procedure d| create procedure e(x int) foo: loop if x = 0 then @@ -313,15 +314,15 @@ leave foo; end if; insert into test.t1 values ("e", x); set x = x-1; -end loop foo; -call e(3); -select * from t1; +end loop foo| +call e(3)| +select * from t1| id data e 3 e 2 e 1 -delete from t1; -drop procedure e; +delete from t1| +drop procedure e| create procedure f(x int) if x < 0 then insert into test.t1 values ("f", 0); @@ -329,17 +330,17 @@ elseif x = 0 then insert into test.t1 values ("f", 1); else insert into test.t1 values ("f", 2); -end if; -call f(-2); -call f(0); -call f(4); -select * from t1; +end if| +call f(-2)| +call f(0)| +call f(4)| +select * from t1| id data f 0 f 1 f 2 -delete from t1; -drop procedure f; +delete from t1| +drop procedure f| create procedure g(x int) case when x < 0 then @@ -348,17 +349,17 @@ when x = 0 then insert into test.t1 values ("g", 1); else insert into test.t1 values ("g", 2); -end case; -call g(-42); -call g(0); -call g(1); -select * from t1; +end case| +call g(-42)| +call g(0)| +call g(1)| +select * from t1| id data g 0 g 1 g 2 -delete from t1; -drop procedure g; +delete from t1| +drop procedure g| create procedure h(x int) case x when 0 then @@ -367,17 +368,17 @@ when 1 then insert into test.t1 values ("h1", x); else insert into test.t1 values ("h?", x); -end case; -call h(0); -call h(1); -call h(17); -select * from t1; +end case| +call h(0)| +call h(1)| +call h(17)| +select * from t1| id data h0 0 h1 1 h? 17 -delete from t1; -drop procedure h; +delete from t1| +drop procedure h| create procedure i(x int) foo: begin @@ -385,133 +386,159 @@ if x = 0 then leave foo; end if; insert into test.t1 values ("i", x); -end foo; -call i(0); -call i(3); -select * from t1; +end foo| +call i(0)| +call i(3)| +select * from t1| id data i 3 -delete from t1; -drop procedure i; +delete from t1| +drop procedure i| +insert into t1 values ("foo", 3), ("bar", 19)| +insert into t2 values ("x", 9, 4.1), ("y", -1, 19.2), ("z", 3, 2.2)| +create procedure sel1() +begin +select * from t1; +end| +call sel1()| +id data +foo 3 +bar 19 +drop procedure sel1| +create procedure sel2() +begin +select * from t1; +select * from t2; +end| +call sel2()| +id data +foo 3 +bar 19 +s i d +x 9 4.1 +y -1 19.2 +z 3 2.2 +drop procedure sel2| +delete from t1| +delete from t2| create procedure into_test(x char(16), y int) begin insert into test.t1 values (x, y); select id,data into x,y from test.t1 limit 1; insert into test.t1 values (concat(x, "2"), y+2); -end; -call into_test("into", 100); -select * from t1; +end| +call into_test("into", 100)| +select * from t1| id data into 100 into2 102 -delete from t1; -drop procedure into_test; +delete from t1| +drop procedure into_test| create procedure into_test2(x char(16), y int) begin insert into test.t1 values (x, y); select id,data into x,@z from test.t1 limit 1; insert into test.t1 values (concat(x, "2"), y+2); -end; -call into_test2("into", 100); -select id,data,@z from t1; +end| +call into_test2("into", 100)| +select id,data,@z from t1| id data @z into 100 100 into2 102 100 -delete from t1; -drop procedure into_test2; +delete from t1| +drop procedure into_test2| create procedure into_test3() begin declare x char(16); declare y int; select * into x,y from test.t1 limit 1; insert into test.t2 values (x, y, 0.0); -end; -insert into t1 values ("into3", 19); -delete from t2; -call into_test3(); -call into_test3(); -select * from t2; +end| +insert into t1 values ("into3", 19)| +call into_test3()| +call into_test3()| +select * from t2| s i d into3 19 0 into3 19 0 -delete from t1; -delete from t2; -drop procedure into_test3; +delete from t1| +delete from t2| +drop procedure into_test3| create procedure into_test4() begin declare x int; select data into x from test.t1 limit 1; insert into test.t3 values ("into4", x); -end; -delete from t1; -drop table if exists t3; -create table t3 ( s char(16), d int); -call into_test4(); +end| +delete from t1| +drop table if exists t3| +create table t3 ( s char(16), d int)| +call into_test4()| Warnings: -select * from t3; +select * from t3| s d into4 NULL -insert into t1 values ("i4", 77); -call into_test4(); -select * from t3; +insert into t1 values ("i4", 77)| +call into_test4()| +select * from t3| s d into4 NULL into4 77 -delete from t1; -drop table t3; -drop procedure into_test4; +delete from t1| +drop table t3| +drop procedure into_test4| create procedure into_outfile(x char(16), y int) begin insert into test.t1 values (x, y); select * into outfile "/tmp/spout" from test.t1; insert into test.t1 values (concat(x, "2"), y+2); -end; -call into_outfile("ofile", 1); -delete from t1; -drop procedure into_outfile; +end| +call into_outfile("ofile", 1)| +delete from t1| +drop procedure into_outfile| create procedure into_dumpfile(x char(16), y int) begin insert into test.t1 values (x, y); select * into dumpfile "/tmp/spdump" from test.t1 limit 1; insert into test.t1 values (concat(x, "2"), y+2); -end; -call into_dumpfile("dfile", 1); -delete from t1; -drop procedure into_dumpfile; +end| +call into_dumpfile("dfile", 1)| +delete from t1| +drop procedure into_dumpfile| create procedure create_select(x char(16), y int) begin insert into test.t1 values (x, y); create table test.t3 select * from test.t1; insert into test.t3 values (concat(x, "2"), y+2); -end; -drop table if exists t3; -call create_select("cs", 90); -select * from t1, t3; +end| +drop table if exists t3| +call create_select("cs", 90)| +select * from t1, t3| id data id data cs 90 cs 90 cs 90 cs2 92 -drop table if exists t3; -delete from t1; -drop procedure create_select; +drop table if exists t3| +delete from t1| +drop procedure create_select| create function e() returns double -return 2.7182818284590452354; -set @e = e(); -select e(), @e; +return 2.7182818284590452354| +set @e = e()| +select e(), @e| e() @e 2.718281828459 2.718281828459 create function inc(i int) returns int -return i+1; -select inc(1), inc(99), inc(-71); +return i+1| +select inc(1), inc(99), inc(-71)| inc(1) inc(99) inc(-71) 2 100 -70 create function mul(x int, y int) returns int -return x*y; -select mul(1,1), mul(3,5), mul(4711, 666); +return x*y| +select mul(1,1), mul(3,5), mul(4711, 666)| mul(1,1) mul(3,5) mul(4711, 666) 1 15 3137526 create function append(s1 char(8), s2 char(8)) returns char(16) -return concat(s1, s2); -select append("foo", "bar"); +return concat(s1, s2)| +select append("foo", "bar")| append("foo", "bar") foobar create function fac(n int unsigned) returns bigint unsigned @@ -522,37 +549,37 @@ set f = f * n; set n = n - 1; end while; return f; -end; -select fac(1), fac(2), fac(5), fac(10); +end| +select fac(1), fac(2), fac(5), fac(10)| fac(1) fac(2) fac(5) fac(10) 1 2 120 3628800 create function fun(d double, i int, u int unsigned) returns double -return mul(inc(i), fac(u)) / e(); -select fun(2.3, 3, 5); +return mul(inc(i), fac(u)) / e()| +select fun(2.3, 3, 5)| fun(2.3, 3, 5) 176.58213176229 -insert into t2 values (append("xxx", "yyy"), mul(4,3), e()); -insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6)); -select * from t2 where s = append("a", "b"); +insert into t2 values (append("xxx", "yyy"), mul(4,3), e())| +insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))| +select * from t2 where s = append("a", "b")| s i d ab 24 1324.36598821719 -select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2); +select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2)| s i d xxxyyy 12 2.71828182845905 ab 24 1324.36598821719 -select * from t2 where d = e(); +select * from t2 where d = e()| s i d xxxyyy 12 2.71828182845905 -select * from t2; +select * from t2| s i d xxxyyy 12 2.71828182845905 ab 24 1324.36598821719 -delete from t2; -drop function e; -drop function inc; -drop function mul; -drop function append; -drop function fun; +delete from t2| +drop function e| +drop function inc| +drop function mul| +drop function append| +drop function fun| create procedure hndlr1(val int) begin declare x int default 0; @@ -564,13 +591,13 @@ insert into test.t666 values ("hndlr1", val); # Non-existing table if (x) then insert into test.t1 values ("hndlr1", val); # This instead then end if; -end; -call hndlr1(42); -select * from t1; +end| +call hndlr1(42)| +select * from t1| id data hndlr1 42 -delete from t1; -drop procedure hndlr1; +delete from t1| +drop procedure hndlr1| create procedure hndlr2(val int) begin declare x int default 0; @@ -579,13 +606,13 @@ declare exit handler for sqlstate '42S02' set x = 1; insert into test.t666 values ("hndlr2", val); # Non-existing table end; insert into test.t1 values ("hndlr2", x); -end; -call hndlr2(42); -select * from t1; +end| +call hndlr2(42)| +select * from t1| id data hndlr2 1 -delete from t1; -drop procedure hndlr2; +delete from t1| +drop procedure hndlr2| create procedure hndlr3(val int) begin declare x int default 0; @@ -605,15 +632,15 @@ insert into test.t1 values ("hndlr3", y); end if; end; end if; -end; -call hndlr3(3); -select * from t1; +end| +call hndlr3(3)| +select * from t1| id data hndlr3 13 -delete from t1; -drop procedure hndlr3; -drop table if exists t3; -create table t3 ( id char(16), data int ); +delete from t1| +drop procedure hndlr3| +drop table if exists t3| +create table t3 ( id char(16), data int )| create procedure hndlr4() begin declare x int default 0; @@ -621,13 +648,13 @@ declare val int; # No default declare continue handler for sqlstate '02000' set x=1; select data into val from test.t3 where id='z' limit 1; # No hits insert into test.t3 values ('z', val); -end; -call hndlr4(); -select * from t3; +end| +call hndlr4()| +select * from t3| id data z NULL -drop table t3; -drop procedure hndlr4; +drop table t3| +drop procedure hndlr4| create procedure cur1() begin declare done int default 0; @@ -644,17 +671,17 @@ insert into test.t1 values (a, b+c); end if; until done end repeat; close c; -end; -insert into t2 values ("foo", 42, -1.9), ("bar", 3, 12.1), ("zap", 666, -3.14); -call cur1(); -select * from t1; +end| +insert into t2 values ("foo", 42, -1.9), ("bar", 3, 12.1), ("zap", 666, -3.14)| +call cur1()| +select * from t1| id data foo 40 bar 15 zap 663 -drop procedure cur1; -drop table if exists t3; -create table t3 ( s char(16), i int ); +drop procedure cur1| +drop table if exists t3| +create table t3 ( s char(16), i int )| create procedure cur2() begin declare done int default 0; @@ -680,56 +707,56 @@ end; until done end repeat; close c1; close c2; -end; -call cur2(); -select * from t3; +end| +call cur2()| +select * from t3| s i foo 40 bar 3 zap 663 -delete from t1; -delete from t2; -drop table t3; -drop procedure cur2; +delete from t1| +delete from t2| +drop table t3| +drop procedure cur2| create procedure chistics() language sql not deterministic sql security definer comment 'Characteristics procedure test' - insert into t1 values ("chistics", 1); -call chistics(); -select * from t1; + insert into t1 values ("chistics", 1)| +call chistics()| +select * from t1| id data chistics 1 -delete from t1; -alter procedure chistics sql security invoker name chistics2; -show create procedure chistics2; +delete from t1| +alter procedure chistics sql security invoker name chistics2| +show create procedure chistics2| Procedure Create Procedure chistics2 CREATE PROCEDURE chistics2() SQL SECURITY INVOKER COMMENT 'Characteristics procedure test' insert into t1 values ("chistics", 1) -drop procedure chistics2; +drop procedure chistics2| create function chistics() returns int language sql deterministic sql security invoker comment 'Characteristics procedure test' - return 42; -select chistics(); + return 42| +select chistics()| chistics() 42 -alter function chistics name chistics2 comment 'Characteristics function test'; -show create function chistics2; +alter function chistics name chistics2 comment 'Characteristics function test'| +show create function chistics2| Function Create Function chistics2 CREATE FUNCTION chistics2() RETURNS int DETERMINISTIC SQL SECURITY INVOKER COMMENT 'Characteristics function test' return 42 -drop function chistics2; -insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3); -set @@sql_mode = 'ANSI'; +drop function chistics2| +insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)| +set @@sql_mode = 'ANSI'| create procedure modes(out c1 int, out c2 int) begin declare done int default 0; @@ -746,16 +773,16 @@ set c2 = c2 + 1; end if; until done end repeat; close c; -end; -set @@sql_mode = ''; -set sql_select_limit = 1; -call modes(@c1, @c2); -set sql_select_limit = default; -select @c1, @c2; +end$ +set @@sql_mode = ''| +set sql_select_limit = 1| +call modes(@c1, @c2)| +set sql_select_limit = default| +select @c1, @c2| @c1 @c2 12 3 -delete from t1; -drop procedure modes; +delete from t1| +drop procedure modes| create procedure bug822(a_id char(16), a_data int) begin declare n int; @@ -763,16 +790,16 @@ select count(*) into n from t1 where id = a_id and data = a_data; if n = 0 then insert into t1 (id, data) values (a_id, a_data); end if; -end; -call bug822('foo', 42); -call bug822('foo', 42); -call bug822('bar', 666); -select * from t1; +end| +call bug822('foo', 42)| +call bug822('foo', 42)| +call bug822('bar', 666)| +select * from t1| id data foo 42 bar 666 -delete from t1; -drop procedure bug822; +delete from t1| +drop procedure bug822| create procedure bug1495() begin declare x int; @@ -782,19 +809,19 @@ insert into t1 values ("less", x-10); else insert into t1 values ("more", x+10); end if; -end; -insert into t1 values ('foo', 12); -call bug1495(); -delete from t1 where id='foo'; -insert into t1 values ('bar', 7); -call bug1495(); -delete from t1 where id='bar'; -select * from t1; +end| +insert into t1 values ('foo', 12)| +call bug1495()| +delete from t1 where id='foo'| +insert into t1 values ('bar', 7)| +call bug1495()| +delete from t1 where id='bar'| +select * from t1| id data less 2 more 17 -delete from t1; -drop procedure bug1495; +delete from t1| +drop procedure bug1495| create procedure bug1547(s char(16)) begin declare x int; @@ -804,44 +831,44 @@ insert into t1 values ("less", x-10); else insert into t1 values ("more", x+10); end if; -end; -insert into t1 values ("foo", 12), ("bar", 7); -call bug1547("foo"); -call bug1547("bar"); -select * from t1; +end| +insert into t1 values ("foo", 12), ("bar", 7)| +call bug1547("foo")| +call bug1547("bar")| +select * from t1| id data foo 12 bar 7 less 2 more 17 -delete from t1; -drop procedure bug1547; -drop table if exists t70; -create table t70 (s1 int,s2 int); -insert into t70 values (1,2); +delete from t1| +drop procedure bug1547| +drop table if exists t70| +create table t70 (s1 int,s2 int)| +insert into t70 values (1,2)| create procedure bug1656(out p1 int, out p2 int) -select * into p1, p1 from t70; -call bug1656(@1, @2); -select @1, @2; +select * into p1, p1 from t70| +call bug1656(@1, @2)| +select @1, @2| @1 @2 2 NULL -drop table t70; -drop procedure bug1656; -drop table if exists t3; -create table t3(a int); +drop table t70| +drop procedure bug1656| +drop table if exists t3| +create table t3(a int)| create procedure bug1862() begin insert into t3 values(2); flush tables; -end; -call bug1862(); -call bug1862(); -select * from t3; +end| +call bug1862()| +call bug1862()| +select * from t3| a 2 2 -drop table t3; -drop procedure bug1862; +drop table t3| +drop procedure bug1862| create procedure bug1874() begin declare x int; @@ -854,20 +881,20 @@ select sum(data) into x from t1; insert into t2 values ("sum", x, 0); select avg(data) into y from t1; insert into t2 values ("avg", 0, y); -end; -insert into t1 (data) values (3), (1), (5), (9), (4); -call bug1874(); -select * from t2; +end| +insert into t1 (data) values (3), (1), (5), (9), (4)| +call bug1874()| +select * from t2| s i d max 9 0 min 1 0 sum 22 0 avg 0 4.4 -delete from t1; -delete from t2; -drop procedure bug1874; -drop table if exists fac; -create table fac (n int unsigned not null primary key, f bigint unsigned); +delete from t1| +delete from t2| +drop procedure bug1874| +drop table if exists fac| +create table fac (n int unsigned not null primary key, f bigint unsigned)| create procedure ifac(n int unsigned) begin declare i int unsigned default 1; @@ -880,9 +907,9 @@ insert into test.fac values (i, fac(i)); set i = i + 1; end; end while; -end; -call ifac(20); -select * from fac; +end| +call ifac(20)| +select * from fac| n f 1 1 2 2 @@ -904,19 +931,19 @@ n f 18 6402373705728000 19 121645100408832000 20 2432902008176640000 -drop table fac; -show function status like '%f%'; +drop table fac| +show function status like '%f%'| Name Type Definer Modified Created Security_type Comment fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER -drop procedure ifac; -drop function fac; -show function status like '%f%'; +drop procedure ifac| +drop function fac| +show function status like '%f%'| Name Type Definer Modified Created Security_type Comment -drop table if exists primes; +drop table if exists primes| create table primes ( i int unsigned not null primary key, p bigint unsigned not null -); +)| insert into primes values ( 0, 3), ( 1, 5), ( 2, 7), ( 3, 11), ( 4, 13), ( 5, 17), ( 6, 19), ( 7, 23), ( 8, 29), ( 9, 31), @@ -926,7 +953,7 @@ insert into primes values (25, 103), (26, 107), (27, 109), (28, 113), (29, 127), (30, 131), (31, 137), (32, 139), (33, 149), (34, 151), (35, 157), (36, 163), (37, 167), (38, 173), (39, 179), -(40, 181), (41, 191), (42, 193), (43, 197), (44, 199); +(40, 181), (41, 191), (42, 193), (43, 197), (44, 199)| create procedure opp(n bigint unsigned, out pp bool) begin declare r double; @@ -952,7 +979,7 @@ set s = s+1; end; end if; end loop; -end; +end| create procedure ip(m int unsigned) begin declare p bigint unsigned; @@ -969,8 +996,8 @@ end if; set p = p+2; end; end while; -end; -show create procedure opp; +end| +show create procedure opp| Procedure Create Procedure opp CREATE PROCEDURE opp(n bigint unsigned, out pp bool) begin @@ -998,24 +1025,24 @@ end; end if; end loop; end -show procedure status like '%p%'; +show procedure status like '%p%'| Name Type Definer Modified Created Security_type Comment ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER -call ip(200); -select * from primes where i=45 or i=100 or i=199; +call ip(200)| +select * from primes where i=45 or i=100 or i=199| i p 45 211 100 557 199 1229 -drop table primes; -drop procedure opp; -drop procedure ip; -show procedure status like '%p%'; +drop table primes| +drop procedure opp| +drop procedure ip| +show procedure status like '%p%'| Name Type Definer Modified Created Security_type Comment -drop table if exists fib; -create table fib ( f bigint unsigned not null ); -insert into fib values (1), (1); +drop table if exists fib| +create table fib ( f bigint unsigned not null )| +insert into fib values (1), (1)| create procedure fib(n int unsigned) begin if n > 0 then @@ -1030,9 +1057,9 @@ insert into fib values (x+y); call fib(n-1); end; end if; -end; -call fib(20); -select * from fib order by f asc; +end| +call fib(20)| +select * from fib order by f asc| f 1 1 @@ -1056,25 +1083,25 @@ f 6765 10946 17711 -drop table fib; -drop procedure fib; +drop table fib| +drop procedure fib| create procedure bar(x char(16), y int) comment "111111111111" sql security invoker -insert into test.t1 values (x, y); -show procedure status like 'bar'; +insert into test.t1 values (x, y)| +show procedure status like 'bar'| Name Type Definer Modified Created Security_type Comment bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 -alter procedure bar name bar2 comment "2222222222" sql security definer; -alter procedure bar2 name bar comment "3333333333"; -alter procedure bar; -show create procedure bar; +alter procedure bar name bar2 comment "2222222222" sql security definer| +alter procedure bar2 name bar comment "3333333333"| +alter procedure bar| +show create procedure bar| Procedure Create Procedure bar CREATE PROCEDURE bar(x char(16), y int) COMMENT '3333333333' insert into test.t1 values (x, y) -show procedure status like 'bar'; +show procedure status like 'bar'| Name Type Definer Modified Created Security_type Comment bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333 -drop procedure bar; +drop procedure bar| drop table t1; drop table t2; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index a5c8be8c819..e8e3e875f09 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -360,7 +360,7 @@ set sql_log_bin=1; set sql_log_off=1; set sql_log_update=1; Warnings: -Note 1298 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored. +Note 1299 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored. set sql_low_priority_updates=1; set sql_max_join_size=200; select @@sql_max_join_size,@@max_join_size; diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test index d3943918468..657b9498f00 100644 --- a/mysql-test/t/index_merge_innodb.test +++ b/mysql-test/t/index_merge_innodb.test @@ -14,7 +14,7 @@ create table t1 INDEX i1(key1), INDEX i2(key2), -) type=innodb; +) engine=innodb; --disable_query_log let $1=200; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index ab13559b860..b8b60ac8dde 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -32,18 +32,18 @@ create function func1() returns int return 42| # Can't create recursively ---error 1286 +--error 1287 create procedure foo() create procedure bar() set @x=3| ---error 1286 +--error 1287 create procedure foo() create function bar() returns double return 2.3| # Already exists ---error 1287 +--error 1288 create procedure proc1() set @x = 42| ---error 1287 +--error 1288 create function func1() returns int return 42| @@ -51,39 +51,39 @@ drop procedure proc1| drop function func1| # Does not exist ---error 1288 +--error 1289 alter procedure foo| ---error 1288 +--error 1289 alter function foo| ---error 1288 +--error 1289 drop procedure foo| ---error 1288 +--error 1289 drop function foo| ---error 1288 +--error 1289 call foo()| drop procedure if exists foo| ---error 1288 +--error 1289 show create procedure foo| # LEAVE/ITERATE with no match ---error 1291 +--error 1292 create procedure foo() foo: loop leave bar; end loop| ---error 1291 +--error 1292 create procedure foo() foo: loop iterate bar; end loop| ---error 1291 +--error 1292 create procedure foo() foo: begin iterate foo; end| # Redefining label ---error 1292 +--error 1293 create procedure foo() foo: loop foo: loop @@ -92,7 +92,7 @@ foo: loop end loop foo| # End label mismatch ---error 1293 +--error 1294 create procedure foo() foo: loop set @x=2; @@ -106,24 +106,13 @@ begin end| drop procedure foo| -# We require INTO in SELECTs for some older clients (as mysql and mysqltest, -# for now). -create procedure foo() -begin - select name from mysql.proc; - select type from mysql.proc; -end| ---error 1295 -call foo()| -drop procedure foo| - # RETURN in FUNCTION only ---error 1296 +--error 1297 create procedure foo() return 42| # Doesn't allow queries in FUNCTIONs (for now :-( ) ---error 1297 +--error 1298 create function foo() returns int begin declare x int; @@ -137,19 +126,19 @@ create procedure p(x int) create function f(x int) returns int return x+42| ---error 1301 +--error 1302 call p()| ---error 1301 +--error 1302 call p(1, 2)| ---error 1301 +--error 1302 select f()| ---error 1301 +--error 1302 select f(1, 2)| drop procedure p| drop function f| ---error 1302 +--error 1303 create procedure p(val int, out res int) begin declare x int default 0; @@ -163,7 +152,7 @@ begin end if; end| ---error 1302 +--error 1303 create procedure p(val int, out res int) begin declare x int default 0; @@ -178,7 +167,7 @@ begin end if; end| ---error 1303 +--error 1304 create function f(val int) returns int begin declare x int; @@ -196,12 +185,12 @@ begin end if; end| ---error 1304 +--error 1305 select f(10)| drop function f| ---error 1305 +--error 1306 create procedure p() begin declare c cursor for insert into test.t1 values ("foo", 42); @@ -210,7 +199,7 @@ begin close c; end| ---error 1306 +--error 1307 create procedure p() begin declare x int; @@ -220,7 +209,7 @@ begin close c; end| ---error 1307 +--error 1308 create procedure p() begin declare c cursor for select * from test.t; @@ -242,7 +231,7 @@ begin open c; close c; end| ---error 1308 +--error 1309 call p()| drop procedure p| @@ -254,11 +243,11 @@ begin close c; close c; end| ---error 1309 +--error 1310 call p()| drop procedure p| ---error 1288 +--error 1289 alter procedure bar3 sql security invoker| --error 1059 alter procedure bar3 name @@ -272,7 +261,7 @@ drop table if exists t1| create table t1 (val int, x float)| insert into t1 values (42, 3.1), (19, 1.2)| ---error 1310 +--error 1311 create procedure p() begin declare c cursor for select * from t1; @@ -292,7 +281,7 @@ begin fetch c into x; close c; end| ---error 1311 +--error 1312 call p()| drop procedure p| @@ -307,34 +296,34 @@ begin fetch c into x, y, z; close c; end| ---error 1311 +--error 1312 call p()| drop procedure p| ---error 1313 +--error 1314 create procedure p(in x int, x char(10)) begin end| ---error 1313 +--error 1314 create function p(x int, x char(10)) begin end| ---error 1314 +--error 1315 create procedure p() begin declare x float; declare x int; end| ---error 1315 +--error 1316 create procedure p() begin declare c condition for 1064; declare c condition for 1065; end| ---error 1316 +--error 1317 create procedure p() begin declare c cursor for select * from t1; @@ -358,13 +347,13 @@ drop procedure bug1965| # # BUG#1966 # ---error 1310 +--error 1311 select 1 into a| # # BUG#336 # ---error 1318 +--error 1319 create procedure bug336(id char(16)) begin declare x int; @@ -374,7 +363,7 @@ end| # # BUG#1654 # ---error 1297 +--error 1298 create function bug1654() returns int return (select sum(t.data) from test.t2 t)| diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index cda03e46e37..11a00c51996 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -289,7 +289,7 @@ select sub3((select max(i) from t2))| drop procedure sub1| #drop procedure sub2| drop function sub3| - +delete from t2| # Basic tests of the flow control constructs @@ -462,6 +462,30 @@ delete from t1| drop procedure i| +# SELECT with one of more result set sent back to the clinet +insert into t1 values ("foo", 3), ("bar", 19)| +insert into t2 values ("x", 9, 4.1), ("y", -1, 19.2), ("z", 3, 2.2)| + +create procedure sel1() +begin + select * from t1; +end| + +call sel1()| +drop procedure sel1| + +create procedure sel2() +begin + select * from t1; + select * from t2; +end| + +call sel2()| +drop procedure sel2| +delete from t1| +delete from t2| + + # SELECT INTO local variables create procedure into_test(x char(16), y int) begin @@ -501,7 +525,6 @@ begin end| insert into t1 values ("into3", 19)| -delete from t2| # Two call needed for bug test call into_test3()| call into_test3()| diff --git a/sql/lex.h b/sql/lex.h index 747d0a05a1d..7f7a27289b1 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -258,8 +258,8 @@ static SYMBOL symbols[] = { { "LOGS", SYM(LOGS_SYM),0,0}, { "LONG", SYM(LONG_SYM),0,0}, { "LONGBLOB", SYM(LONGBLOB),0,0}, - { "LOOP", SYM(LOOP_SYM),0,0}, { "LONGTEXT", SYM(LONGTEXT),0,0}, + { "LOOP", SYM(LOOP_SYM),0,0}, { "LOW_PRIORITY", SYM(LOW_PRIORITY),0,0}, { "MASTER", SYM(MASTER_SYM),0,0}, { "MASTER_CONNECT_RETRY", SYM(MASTER_CONNECT_RETRY_SYM),0,0}, @@ -480,7 +480,6 @@ static SYMBOL symbols[] = { { "WORK", SYM(WORK_SYM),0,0}, { "WRITE", SYM(WRITE_SYM),0,0}, { "WHILE", SYM(WHILE_SYM),0,0}, - { "NO_WRITE_TO_BINLOG", SYM(NO_WRITE_TO_BINLOG),0,0}, { "X509", SYM(X509_SYM),0,0}, { "XOR", SYM(XOR),0,0}, { "YEAR", SYM(YEAR_SYM),0,0}, From fd4544879b91fec027909f3607fe9fa68a214241 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 19:14:10 +0100 Subject: [PATCH 39/40] Renamed the "schema" column to "db" in mysql.proc to keep it in style with all the other mysql.* tables. --- Docs/sp-imp-spec.txt | 4 ++-- scripts/mysql_create_system_tables.sh | 4 ++-- scripts/mysql_fix_privilege_tables.sql | 4 ++-- sql/sp.cc | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Docs/sp-imp-spec.txt b/Docs/sp-imp-spec.txt index ee9bc7a0e4f..c1b91d2c2c5 100644 --- a/Docs/sp-imp-spec.txt +++ b/Docs/sp-imp-spec.txt @@ -1056,7 +1056,7 @@ - The mysql.proc schema: CREATE TABLE proc ( - schema char(64) binary DEFAULT '' NOT NULL, + db char(64) binary DEFAULT '' NOT NULL, name char(64) binary DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) binary DEFAULT '' NOT NULL, @@ -1093,7 +1093,7 @@ 'NO_AUTO_VALUE_ON_ZERO' ) DEFAULT 0 NOT NULL, comment char(64) binary DEFAULT '' NOT NULL, - PRIMARY KEY (schema,name,type) + PRIMARY KEY (db,name,type) ) comment='Stored Procedures'; -- diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index 57198abd53a..d20d745d514 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -289,7 +289,7 @@ fi if test ! -f $mdata/proc.frm then c_p="$c_p CREATE TABLE proc (" - c_p="$c_p schema char(64) binary DEFAULT '' NOT NULL," + c_p="$c_p db char(64) binary DEFAULT '' NOT NULL," c_p="$c_p name char(64) binary DEFAULT '' NOT NULL," c_p="$c_p type enum('FUNCTION','PROCEDURE') NOT NULL," c_p="$c_p specific_name char(64) binary DEFAULT '' NOT NULL," @@ -326,7 +326,7 @@ then c_p="$c_p 'NO_AUTO_VALUE_ON_ZERO'" c_p="$c_p ) DEFAULT 0 NOT NULL," c_p="$c_p comment char(64) binary DEFAULT '' NOT NULL," - c_p="$c_p PRIMARY KEY (schema,name,type)" + c_p="$c_p PRIMARY KEY (db,name,type)" c_p="$c_p ) comment='Stored Procedures';" fi diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index 788913fa38e..115236948c9 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -140,7 +140,7 @@ unique index (name) # CREATE TABLE IF NOT EXISTS proc ( - schema char(64) binary DEFAULT '' NOT NULL, + db char(64) binary DEFAULT '' NOT NULL, name char(64) binary DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) binary DEFAULT '' NOT NULL, @@ -177,5 +177,5 @@ CREATE TABLE IF NOT EXISTS proc ( 'NO_AUTO_VALUE_ON_ZERO' ) DEFAULT 0 NOT NULL, comment char(64) binary DEFAULT '' NOT NULL, - PRIMARY KEY (schema,name,type) + PRIMARY KEY (db,name,type) ) comment='Stored Procedures'; diff --git a/sql/sp.cc b/sql/sp.cc index 4bb629b3dbe..6143c31176c 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -37,7 +37,7 @@ create_string(THD *thd, ulong *lenp, enum { - MYSQL_PROC_FIELD_SCHEMA = 0, + MYSQL_PROC_FIELD_DB = 0, MYSQL_PROC_FIELD_NAME, MYSQL_PROC_FIELD_TYPE, MYSQL_PROC_FIELD_SPECIFIC_NAME, @@ -64,12 +64,12 @@ db_find_routine_aux(THD *thd, int type, char *name, uint namelen, DBUG_ENTER("db_find_routine_aux"); DBUG_PRINT("enter", ("type: %d name: %*s", type, namelen, name)); TABLE *table; - byte key[64+64+1]; // schema, name, type + byte key[64+64+1]; // db, name, type uint keylen; int ret; // Put the key together - memset(key, (int)' ', 64); // QQ Empty schema for now + memset(key, (int)' ', 64); // QQ Empty db for now keylen= namelen; if (keylen > 64) keylen= 64; From 1ca25d0e02876cc48f176195840a8dbbc4b4b0e9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Dec 2003 19:18:01 +0000 Subject: [PATCH 40/40] Fixed some minor issues, revealed by compiler warnings when using BUILD/compile-pentium-debug-max BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql/item_func.cc | 5 +++++ sql/opt_range.cc | 1 + sql/sql_insert.cc | 11 ++++++++--- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index c63a1237bbd..72825baa766 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -49,6 +49,7 @@ jani@dsl-kpogw4gb5.dial.inet.fi jani@hynda.(none) jani@hynda.mysql.fi jani@janikt.pp.saunalahti.fi +jani@linux.local jani@rhols221.adsl.netsonic.fi jani@rhols221.arenanet.fi jani@ua126d19.elisa.omakaista.fi diff --git a/sql/item_func.cc b/sql/item_func.cc index 442e5c53675..01a5f1cdf3c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3144,6 +3144,11 @@ Item_func_sp::fix_length_and_dec() decimals= 0; max_length= 21; break; + case ROW_RESULT: + default: + // This case should never be choosen + DBUG_ASSERT(0); + break; } } DBUG_VOID_RETURN; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 93ba77f04ae..53a1c822b2f 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1014,6 +1014,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, SEL_IMERGE *min_imerge= NULL; double min_imerge_cost= DBL_MAX; ha_rows min_imerge_records; + LINT_INIT(min_imerge_records); // Protected by min_imerge List_iterator_fast it(tree->merges); while ((imerge= it++)) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 67afc355153..1de86f486b4 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1140,7 +1140,9 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) /* request for new delayed insert */ if (!(thd->lock=mysql_lock_tables(thd,&di->table,1))) { - di->dead=thd->killed= THD::KILL_CONNECTION; // Fatal error + /* Fatal error */ + di->dead= 1; + thd->killed= THD::KILL_CONNECTION; } pthread_cond_broadcast(&di->cond_client); } @@ -1148,7 +1150,9 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) { if (di->handle_inserts()) { - di->dead=thd->killed=THD::KILL_CONNECTION; // Some fatal error + /* Some fatal error */ + di->dead= 1; + thd->killed= THD::KILL_CONNECTION; } } di->status=0; @@ -1175,7 +1179,8 @@ end: close_thread_tables(thd); // Free the table di->table=0; - di->dead=thd->killed= THD::KILL_CONNECTION; // If error + di->dead= 1; // If error + thd->killed= THD::KILL_CONNECTION; // If error pthread_cond_broadcast(&di->cond_client); // Safety pthread_mutex_unlock(&di->mutex);