diff --git a/VC++Files/storage/example/example.vcproj b/VC++Files/storage/example/example.vcproj index 257a1e77b71..81353cb759b 100644 --- a/VC++Files/storage/example/example.vcproj +++ b/VC++Files/storage/example/example.vcproj @@ -23,7 +23,7 @@ Optimization="2" InlineFunctionExpansion="1" OptimizeForProcessor="2" - AdditionalIncludeDirectories="../../include,../../regex,../../sql" + AdditionalIncludeDirectories="../../include,../../regex,../../sql,../../extra/yassl/include" PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="0" @@ -72,7 +72,7 @@ Name="VCCLCompilerTool" Optimization="0" OptimizeForProcessor="2" - AdditionalIncludeDirectories="../../include,../../regex,../../sql" + AdditionalIncludeDirectories="../../include,../../regex,../../sql,../../extra/yassl/include" PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;USE_TLS;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="1" @@ -122,7 +122,7 @@ Optimization="2" InlineFunctionExpansion="1" OptimizeForProcessor="2" - AdditionalIncludeDirectories="../../include,../../regex,../../sql" + AdditionalIncludeDirectories="../../include,../../regex,../../sql,../../extra/yassl/include" PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;USE_TLS;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="0" @@ -171,7 +171,7 @@ Name="VCCLCompilerTool" Optimization="0" OptimizeForProcessor="2" - AdditionalIncludeDirectories="../../include,../../regex,../../sql" + AdditionalIncludeDirectories="../../include,../../regex,../../sql,../../extra/yassl/include" PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="1" diff --git a/win/cmakefiles/client b/client/cmakelists.txt similarity index 100% rename from win/cmakefiles/client rename to client/cmakelists.txt diff --git a/win/cmakefiles/base b/cmakelists.txt similarity index 100% rename from win/cmakefiles/base rename to cmakelists.txt diff --git a/win/cmakefiles/dbug b/dbug/cmakelists.txt similarity index 100% rename from win/cmakefiles/dbug rename to dbug/cmakelists.txt diff --git a/extra/cmakelists.txt b/extra/cmakelists.txt new file mode 100644 index 00000000000..50e0f04eb14 --- /dev/null +++ b/extra/cmakelists.txt @@ -0,0 +1,32 @@ +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) + +ADD_EXECUTABLE(comp_err comp_err.c) +TARGET_LINK_LIBRARIES(comp_err dbug mysys strings wsock32) + +GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) + +ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h + COMMAND ${COMP_ERR_EXE} + --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets + --out-dir=${PROJECT_SOURCE_DIR}/sql/share/ + --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h + --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h + --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h + --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt + DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) + +ADD_CUSTOM_TARGET(GenError + ALL + DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h) + +ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) +TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt odbc32 odbccp32 wsock32) + +ADD_EXECUTABLE(perror perror.c) +TARGET_LINK_LIBRARIES(perror strings mysys dbug wsock32) + +ADD_EXECUTABLE(replace replace.c) +TARGET_LINK_LIBRARIES(replace strings mysys dbug wsock32) diff --git a/win/cmakefiles/yassl b/extra/yassl/cmakelists.txt similarity index 100% rename from win/cmakefiles/yassl rename to extra/yassl/cmakelists.txt diff --git a/win/cmakefiles/taocrypt b/extra/yassl/taocrypt/cmakelists.txt similarity index 100% rename from win/cmakefiles/taocrypt rename to extra/yassl/taocrypt/cmakelists.txt diff --git a/include/config-win.h b/include/config-win.h index fb7aeb82e83..a7bce21b3a1 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -429,8 +429,8 @@ inline double ulonglong2double(ulonglong value) #define HAVE_RTREE_KEYS 1 #define HAVE_ROW_BASED_REPLICATION 1 -/* #undef HAVE_OPENSSL */ -/* #undef HAVE_YASSL */ +#define HAVE_OPENSSL 1 +#define HAVE_YASSL 1 /* Define charsets you want */ /* #undef HAVE_CHARSET_armscii8 */ diff --git a/win/cmakefiles/libmysql b/libmysql/cmakelists.txt similarity index 100% rename from win/cmakefiles/libmysql rename to libmysql/cmakelists.txt diff --git a/mysql-test/lib/mtr_timer.pl b/mysql-test/lib/mtr_timer.pl index 709cebd6407..a85ab8c6122 100644 --- a/mysql-test/lib/mtr_timer.pl +++ b/mysql-test/lib/mtr_timer.pl @@ -78,6 +78,12 @@ sub mtr_timer_start($$$) { { # Child, redirect output and exec # FIXME do we need to redirect streams? + + # Don't do the ^C cleanup in the timeout child processes! + # There is actually a race here, if we get ^C after fork(), but before + # clearing the signal handler. + $SIG{INT}= 'DEFAULT'; + $0= "mtr_timer(timers,$name,$duration)"; sleep($duration); exit(0); diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result index ecaf1ec252e..ced21440686 100644 --- a/mysql-test/r/events.result +++ b/mysql-test/r/events.result @@ -465,4 +465,10 @@ select event_schema, event_name, definer, event_body from information_schema.eve event_schema event_name definer event_body events_test white_space root@localhost select 3 drop event white_space; +create event e1 on schedule every 1 year do set @a = 5; +create table t1 (s1 int); +create trigger t1_ai after insert on t1 for each row show create event e1; +ERROR 0A000: Not allowed to return a result set from a trigger +drop table t1; +drop event e1; drop database events_test; diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index 0b554f97b9a..f7100f20524 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -1,5 +1,19 @@ create database if not exists events_test; use events_test; +set @a=3; +CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5; +call p_16(); +"Here we used to crash!" +call p_16(); +ERROR HY000: Event 'e_16' already exists +call p_16(); +ERROR HY000: Event 'e_16' already exists +DROP EVENT e_16; +CALL p_16(); +CALL p_16(); +ERROR HY000: Event 'e_16' already exists +DROP PROCEDURE p_16; +DROP EVENT e_16; set global event_scheduler=0; "Wait a bit to settle down" delete from mysql.event; diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index feed5483827..f31692bea0a 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -546,4 +546,15 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION p1 VALUES IN (1) ENGINE = MyISAM, PARTITION p2 VALUES IN (2) ENGINE = MyISAM) drop table t1; +create table t1 (a int unsigned not null auto_increment primary key) +partition by key(a); +alter table t1 rename t2, add c char(10), comment "no comment"; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(10) unsigned NOT NULL AUTO_INCREMENT, + `c` char(10) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' PARTITION BY KEY (a) +drop table t2; End of 5.1 tests diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 5ab8779782a..40fe0b09814 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1166,3 +1166,10 @@ drop procedure bug15091; drop function if exists bug16896; create aggregate function bug16896() returns int return 1; ERROR 42000: AGGREGATE is not supported for stored functions +drop function if exists bug16164; +create function bug16164() returns int +begin +show authors; +return 42; +end| +ERROR 0A000: Not allowed to return a result set from a function diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 7def4cdcf9d..34f5e529260 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -3156,3 +3156,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where 2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 9 Using filesort DROP TABLE t1; +create table t1( f1 int,f2 int); +insert into t1 values (1,1),(2,2); +select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1'; +t +crash1 +crash1 +drop table t1; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 69f916b92d5..2c6973b4558 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -23,21 +23,20 @@ partition_03ndb : Bug#16385 ps_7ndb : dbug assert in RBR mode when executing test suite #rpl_bit_npk : Bug#13418 rpl_ddl : Bug#15963 SBR does not show "Definer" correctly -rpl_ndb_2innodb : Bugs#17400: delete & update of rows in table without pk fails -rpl_ndb_2myisam : Bugs#17400: delete & update of rows in table without pk fails +rpl_ndb_2innodb : Assert failure in ha_partition::extra() +rpl_ndb_2myisam : Assert failure in ha_partition::extra() rpl_ndb_auto_inc : Bug#17086 #rpl_ndb_basic : Bug#16228 [IN REVIEW] rpl_ndb_blob : interferes with following tests, causing hang rpl_ndb_blob2 : interferes with following tests, causing hang -rpl_ndb_ddl : Bug#17400: delete & update of rows in table without pk fails -rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails -rpl_ndb_innodb2ndb : Bugs#17400: delete & update of rows in table without pk fails +rpl_ndb_ddl : master hangs +#rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails +rpl_ndb_innodb2ndb : Bug#18261: Cluster Replication: tests rpl_ndb_xxx2ndb fails rpl_ndb_insert_ignore : Bugs: #17431: INSERT IGNORE INTO returns failed: 1296 -rpl_ndb_myisam2ndb : Bugs#17400: delete & update of rows in table without pk fails +rpl_ndb_myisam2ndb : Bug#18261: Cluster Replication: tests rpl_ndb_xxx2ndb fails #rpl_ndb_log : result not deterministic rpl_ndb_relay_space : Bug#16993 -rpl_ndb_multi_update2 : BUG#17738 In progress -rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails +#rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_sp007 : Bug #17290 rpl_row_inexist_tbl : Disabled since patch makes this test wait forever rpl_sp : Bug#16456 diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test index a261b3c0c11..d9d8d75ff8c 100644 --- a/mysql-test/t/events.test +++ b/mysql-test/t/events.test @@ -427,6 +427,16 @@ drop event white_space; # END: BUG #17453: Creating Event crash the server # +# +# Bug#17403 "Events: packets out of order with show create event" +# +create event e1 on schedule every 1 year do set @a = 5; +create table t1 (s1 int); +--error ER_SP_NO_RETSET +create trigger t1_ai after insert on t1 for each row show create event e1; +drop table t1; +drop event e1; + ##set global event_scheduler=1; ##select get_lock("test_lock3", 20); ##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20); diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index 2d4374dcb41..4214d8483d1 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -1,5 +1,26 @@ create database if not exists events_test; use events_test; +# +# START - BUG#16408: Events: crash for an event in a procedure +# +set @a=3; +CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5; +call p_16(); +--echo "Here we used to crash!" +--error 1516 +call p_16(); +--error 1516 +call p_16(); +DROP EVENT e_16; +CALL p_16(); +--error 1516 +CALL p_16(); +DROP PROCEDURE p_16; +DROP EVENT e_16; +# +# END - BUG#16408: Events: crash for an event in a procedure +# + # # Start - 16407: Events: Changes in sql_mode won't be taken into account # diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index bac8b6573e6..73949733426 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -697,4 +697,21 @@ alter table t1 add primary key (b); show create table t1; drop table t1; +############################################ +# +# Author: Mikael Ronstrom +# Date: 2006-03-01 +# Purpose +# Bug 17772: Crash at ALTER TABLE with rename +# and add column + comment on +# partitioned table +# +############################################ +create table t1 (a int unsigned not null auto_increment primary key) +partition by key(a); +alter table t1 rename t2, add c char(10), comment "no comment"; +show create table t2; + +drop table t2; + --echo End of 5.1 tests diff --git a/mysql-test/t/rpl_ndb_multi_update2.test b/mysql-test/t/rpl_ndb_multi_update2.test index d337ddfe88a..df4f0eec39d 100644 --- a/mysql-test/t/rpl_ndb_multi_update2.test +++ b/mysql-test/t/rpl_ndb_multi_update2.test @@ -3,5 +3,10 @@ # to reuse test code between engine runs # ############################################################ -- source include/have_ndb.inc + +# Run this only for row based replication, as replication of +# auto_increment values are not supported with NDB as storage engine +-- source include/have_binlog_format_row.inc + let $engine_type=NDB; --source extra/rpl_tests/rpl_multi_update2.test diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 4b307de2ad0..da40cdf643a 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1691,6 +1691,24 @@ drop function if exists bug16896; --error ER_SP_NO_AGGREGATE create aggregate function bug16896() returns int return 1; +# +# End of 5.0 tests +# + +# +# Bug#16164 "Easter egg": check that SHOW AUTHORS is disabled in +# stored functions/triggers +# +--disable_warnings +drop function if exists bug16164; +--enable_warnings +delimiter |; +--error ER_SP_NO_RETSET +create function bug16164() returns int +begin + show authors; + return 42; +end| # # BUG#NNNN: New bug synopsis diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 733403f482e..368020dd721 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -2067,3 +2067,10 @@ SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); DROP TABLE t1; +# +# Bug#17366: Unchecked Item_int results in server crash +# +create table t1( f1 int,f2 int); +insert into t1 values (1,1),(2,2); +select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1'; +drop table t1; diff --git a/win/cmakefiles/mysys b/mysys/cmakelists.txt similarity index 100% rename from win/cmakefiles/mysys rename to mysys/cmakelists.txt diff --git a/win/cmakefiles/regex b/regex/cmakelists.txt similarity index 100% rename from win/cmakefiles/regex rename to regex/cmakelists.txt diff --git a/win/cmakefiles/im b/server-tools/instance-manager/cmakelists.txt similarity index 100% rename from win/cmakefiles/im rename to server-tools/instance-manager/cmakelists.txt diff --git a/win/cmakefiles/sql b/sql/cmakelists.txt similarity index 100% rename from win/cmakefiles/sql rename to sql/cmakelists.txt diff --git a/sql/event.h b/sql/event.h index d070f93c575..27de8b46e32 100644 --- a/sql/event.h +++ b/sql/event.h @@ -40,7 +40,6 @@ #define EVENT_EXEC_NO_MORE (1L << 0) #define EVENT_NOT_USED (1L << 1) - extern ulong opt_event_executor; enum enum_event_on_completion @@ -122,6 +121,39 @@ public: bool free_sphead_on_delete; uint flags;//all kind of purposes + static void *operator new(size_t size) + { + void *p; + DBUG_ENTER("Event_timed::new(size)"); + p= my_malloc(size, MYF(0)); + DBUG_PRINT("info", ("alloc_ptr=0x%lx", p)); + DBUG_RETURN(p); + } + + static void *operator new(size_t size, MEM_ROOT *mem_root) + { return (void*) alloc_root(mem_root, (uint) size); } + + static void operator delete(void *ptr, size_t size) + { + DBUG_ENTER("Event_timed::delete(ptr,size)"); + DBUG_PRINT("enter", ("free_ptr=0x%lx", ptr)); + TRASH(ptr, size); + my_free((gptr) ptr, MYF(0)); + DBUG_VOID_RETURN; + } + + static void operator delete(void *ptr, MEM_ROOT *mem_root) + { + /* + Don't free the memory it will be done by the mem_root but + we need to call the destructor because we free other resources + which are not allocated on the root but on the heap, or we + deinit mutexes. + */ + DBUG_ASSERT(0); + } + + Event_timed():in_spawned_thread(0),locked_by_thread_id(0), running(0), status_changed(false), last_executed_changed(false), expression(0), created(0), @@ -136,15 +168,21 @@ public: } ~Event_timed() - { - pthread_mutex_destroy(&this->LOCK_running); - if (free_sphead_on_delete) - free_sp(); - } + { + deinit_mutexes(); + if (free_sphead_on_delete) + free_sp(); + } void init(); + + void + deinit_mutexes() + { + pthread_mutex_destroy(&this->LOCK_running); + } int init_definer(THD *thd); diff --git a/sql/event_timed.cc b/sql/event_timed.cc index 8348a75914e..b0e818a4e48 100644 --- a/sql/event_timed.cc +++ b/sql/event_timed.cc @@ -1228,12 +1228,12 @@ Event_timed::change_security_context(THD *thd, Security_context *s_ctx, definer_host.str, dbname.str)) { my_error(ER_NO_SUCH_USER, MYF(0), definer_user.str, definer_host.str); - DBUG_RETURN(TRUE); + DBUG_RETURN(true); } *backup= thd->security_ctx; thd->security_ctx= s_ctx; #endif - DBUG_RETURN(FALSE); + DBUG_RETURN(false); } @@ -1368,7 +1368,8 @@ Event_timed::compile(THD *thd, MEM_ROOT *mem_root) ret= 0; done: lex.et->free_sphead_on_delete= false; - delete lex.et; + lex.et->deinit_mutexes(); + lex_end(&lex); DBUG_PRINT("note", ("return old data on its place. set back NAMES")); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index d97dcc390ca..ea2f67b3ba5 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -176,6 +176,7 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_SHOW_CREATE_DB: case SQLCOM_SHOW_CREATE_FUNC: case SQLCOM_SHOW_CREATE_PROC: + case SQLCOM_SHOW_CREATE_EVENT: case SQLCOM_SHOW_DATABASES: case SQLCOM_SHOW_ERRORS: case SQLCOM_SHOW_FIELDS: @@ -200,6 +201,7 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_SHOW_WARNS: case SQLCOM_SHOW_PROC_CODE: case SQLCOM_SHOW_FUNC_CODE: + case SQLCOM_SHOW_AUTHORS: case SQLCOM_REPAIR: case SQLCOM_BACKUP_TABLE: case SQLCOM_RESTORE_TABLE: diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 34947e35b17..f4186120766 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -82,8 +82,9 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); ha_rows const maybe_deleted= table->file->records; /* - If all rows shall be deleted, we always log this statement-based - (see [binlog], below), so we set this flag and test it below. + If all rows shall be deleted, we (almost) always log this + statement-based (see [binlog], below), so we set this flag and + test it below. */ ha_delete_all_rows= 1; if (!(error=table->file->delete_all_rows())) @@ -330,12 +331,13 @@ cleanup: thd->clear_error(); /* - [binlog]: If 'handler::delete_all_rows()' was called, we - replicate statement-based; otherwise, 'ha_delete_row()' was - used to delete specific rows which we might log row-based. + [binlog]: If 'handler::delete_all_rows()' was called and the + storage engine does not inject the rows itself, we replicate + statement-based; otherwise, 'ha_delete_row()' was used to + delete specific rows which we might log row-based. */ THD::enum_binlog_query_type const - query_type(ha_delete_all_rows ? + query_type(ha_delete_all_rows && !table->file->is_injective() ? THD::STMT_QUERY_TYPE : THD::ROW_QUERY_TYPE); int log_result= thd->binlog_query(query_type, diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 59ebdd2a1cc..954c3be17c6 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -761,6 +761,7 @@ typedef struct st_lex const uchar *tok_start_prev, *tok_end_prev; char *length,*dec,*change,*name; + Table_ident *like_name; char *help_arg; char *backup_dir; /* For RESTORE/BACKUP */ char* to_log; /* For PURGE MASTER LOGS TO */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 871c8bdff9f..77dfcfe862a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2897,9 +2897,9 @@ mysql_execute_command(THD *thd) else { /* regular create */ - if (lex->name) + if (lex->like_name) res= mysql_create_like_table(thd, create_table, &lex->create_info, - (Table_ident *)lex->name); + lex->like_name); else { res= mysql_create_table(thd, create_table->db, @@ -3803,10 +3803,14 @@ end_with_restore_list: send_ok(thd, rows_affected); /* lex->unit.cleanup() is called outside, no need to call it here */ - } while (0); - lex->et->free_sphead_on_delete= true; - delete lex->et; - lex->et= 0; + } while (0); + if (!thd->spcont) + { + lex->et->free_sphead_on_delete= true; + lex->et->free_sp(); + lex->et->deinit_mutexes(); + } + break; } case SQLCOM_SHOW_CREATE_EVENT: @@ -5845,7 +5849,9 @@ void mysql_parse(THD *thd, char *inBuf, uint length) if (thd->lex->et) { thd->lex->et->free_sphead_on_delete= true; - delete thd->lex->et; + /* alloced on thd->mem_root so no real memory free but dtor call */ + thd->lex->et->free_sp(); + thd->lex->et->deinit_mutexes(); thd->lex->et= NULL; } } @@ -5886,7 +5892,8 @@ void mysql_parse(THD *thd, char *inBuf, uint length) if (thd->lex->et) { thd->lex->et->free_sphead_on_delete= true; - delete thd->lex->et; + lex->et->free_sp(); + lex->et->deinit_mutexes(); thd->lex->et= NULL; } } diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 18793d43016..03fa046094a 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -3741,14 +3741,14 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf, ha_legacy_type(default_db_type))); if (is_create_table_ind) { - if (old_lex->name) + if (old_lex->like_name) { /* This code is executed when we do a CREATE TABLE t1 LIKE t2 - old_lex->name contains the t2 and the table we are opening has + old_lex->like_name contains the t2 and the table we are opening has name t1. */ - Table_ident *table_ident= (Table_ident *)old_lex->name; + Table_ident *table_ident= old_lex->like_name; char *src_db= table_ident->db.str ? table_ident->db.str : thd->db; char *src_table= table_ident->table.str; char buf[FN_REFLEN]; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7695001cd67..59c7436d85c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7114,7 +7114,10 @@ static Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, if (!cond) cond= new Item_cond_and(eq_list); else + { + DBUG_ASSERT(cond->type() == Item::COND_ITEM); ((Item_cond *) cond)->add_at_head(&eq_list); + } cond->quick_fix_field(); cond->update_used_tables(); @@ -7199,6 +7202,11 @@ static COND* substitute_for_best_equal_field(COND *cond, while ((item_equal= it++)) { cond= eliminate_item_equal(cond, cond_equal->upper_levels, item_equal); + // This occurs when eliminate_item_equal() founds that cond is + // always false and substitues it with Item_int 0. + // Due to this, value of item_equal will be 0, so just return it. + if (cond->type() != Item::COND_ITEM) + break; } } } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c5b7acb5eb3..9accacbd7b4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1214,7 +1214,8 @@ create: lex->create_info.options=$2 | $4; lex->create_info.db_type= lex->thd->variables.table_type; lex->create_info.default_table_charset= NULL; - lex->name=0; + lex->name= 0; + lex->like_name= 0; } create2 { Lex->current_select= &Lex->select_lex; } @@ -1274,7 +1275,7 @@ create: lex->create_info.options= $3; - if (!(lex->et= new Event_timed())) // implicitly calls Event_timed::init() + if (!(lex->et= new(YYTHD->mem_root) Event_timed())) // implicitly calls Event_timed::init() YYABORT; /* @@ -3272,13 +3273,13 @@ create2: | LIKE table_ident { LEX *lex=Lex; - if (!(lex->name= (char *)$2)) + if (!(lex->like_name= $2)) YYABORT; } | '(' LIKE table_ident ')' { LEX *lex=Lex; - if (!(lex->name= (char *)$3)) + if (!(lex->like_name= $3)) YYABORT; } ; @@ -4712,8 +4713,8 @@ alter: { THD *thd= YYTHD; LEX *lex= thd->lex; + lex->name= 0; lex->sql_command= SQLCOM_ALTER_TABLE; - lex->name= 0; lex->duplicates= DUP_ERROR; if (!lex->select_lex.add_table_to_list(thd, $4, NULL, TL_OPTION_UPDATING)) @@ -4722,7 +4723,8 @@ alter: lex->key_list.empty(); lex->col_list.empty(); lex->select_lex.init_order(); - lex->select_lex.db=lex->name=0; + lex->select_lex.db=lex->name= 0; + lex->like_name= 0; bzero((char*) &lex->create_info,sizeof(lex->create_info)); lex->create_info.db_type= (handlerton*) &default_hton; lex->create_info.default_table_charset= NULL; @@ -4811,7 +4813,7 @@ alter: } lex->spname= 0;//defensive programming - if (!(et= new Event_timed()))// implicitly calls Event_timed::init() + if (!(et= new (YYTHD->mem_root) Event_timed()))// implicitly calls Event_timed::init() YYABORT; lex->et = et; @@ -7715,7 +7717,7 @@ drop: YYABORT; } - if (!(lex->et= new Event_timed())) + if (!(lex->et= new (YYTHD->mem_root) Event_timed())) YYABORT; if (!lex->et_compile_phase) @@ -8439,7 +8441,7 @@ show_param: { Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT; Lex->spname= $3; - Lex->et= new Event_timed(); + Lex->et= new (YYTHD->mem_root) Event_timed(); if (!Lex->et) YYABORT; Lex->et->init_definer(YYTHD); diff --git a/win/cmakefiles/bdb b/storage/bdb/cmakelists.txt similarity index 100% rename from win/cmakefiles/bdb rename to storage/bdb/cmakelists.txt diff --git a/win/cmakefiles/heap b/storage/heap/cmakelists.txt similarity index 100% rename from win/cmakefiles/heap rename to storage/heap/cmakelists.txt diff --git a/win/cmakefiles/innobase b/storage/innobase/cmakelists.txt similarity index 100% rename from win/cmakefiles/innobase rename to storage/innobase/cmakelists.txt diff --git a/win/cmakefiles/myisam b/storage/myisam/cmakelists.txt similarity index 100% rename from win/cmakefiles/myisam rename to storage/myisam/cmakelists.txt diff --git a/win/cmakefiles/myisammrg b/storage/myisammrg/cmakelists.txt similarity index 100% rename from win/cmakefiles/myisammrg rename to storage/myisammrg/cmakelists.txt diff --git a/win/cmakefiles/strings b/strings/cmakelists.txt similarity index 100% rename from win/cmakefiles/strings rename to strings/cmakelists.txt diff --git a/win/cmakefiles/tests b/tests/cmakelists.txt similarity index 100% rename from win/cmakefiles/tests rename to tests/cmakelists.txt diff --git a/win/cmakefiles/vio b/vio/cmakelists.txt similarity index 100% rename from win/cmakefiles/vio rename to vio/cmakelists.txt diff --git a/win/README b/win/README index c8eed8e93fe..27c7e5c5762 100644 --- a/win/README +++ b/win/README @@ -60,16 +60,11 @@ click the build solution menu option. Current issues -------------- -1. Dependencies are not handled correctly with the current scripts. What -this means is that a new error file may not be generated when the errmsg.txt -file changes. In this case, simply force the GenError target to build. This -should execute comp_err to generate the required files. - -2. Not all configurations are currently available. i.e. Classic, Pro, Max. +1. Not all configurations are currently available. i.e. Classic, Pro, Max. Currently, only debug and release are available. This will change in the near future. -3. The definitions set for features (partitioning, blackhole, etc) are not +2. The definitions set for features (partitioning, blackhole, etc) are not changed based on the options given with configure. This will soon be fixed as well. diff --git a/win/build-vs71.bat b/win/build-vs71.bat index db92d9c3b72..46f3bc32f6e 100644 --- a/win/build-vs71.bat +++ b/win/build-vs71.bat @@ -1,10 +1,5 @@ @echo off -REM - First we need to copy all the cmakelists to the proper folders -cd win\cmakefiles -call deploy.bat -cd ..\.. - del cmakecache.txt copy win\vs71cache.txt cmakecache.txt cmake -G "Visual Studio 7 .NET 2003" diff --git a/win/build-vs8.bat b/win/build-vs8.bat index 54789b16503..349c3e78628 100644 --- a/win/build-vs8.bat +++ b/win/build-vs8.bat @@ -1,10 +1,5 @@ @echo off -REM - First we need to copy all the cmakelists to the proper folders -cd win\cmakefiles -call deploy.bat -cd ..\.. - del cmakecache.txt copy win\vs8cache.txt cmakecache.txt cmake -G "Visual Studio 8 2005" diff --git a/win/cmakefiles/deploy.bat b/win/cmakefiles/deploy.bat deleted file mode 100644 index 44ecb2d55fb..00000000000 --- a/win/cmakefiles/deploy.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -copy base ..\..\cmakelists.txt -copy client ..\..\client\cmakelists.txt -copy dbug ..\..\dbug\cmakelists.txt -copy extra ..\..\extra\cmakelists.txt -copy mysys ..\..\mysys\cmakelists.txt -copy regex ..\..\regex\cmakelists.txt -copy sql ..\..\sql\cmakelists.txt -copy strings ..\..\strings\cmakelists.txt -copy vio ..\..\vio\cmakelists.txt -copy zlib ..\..\zlib\cmakelists.txt -copy yassl ..\..\extra\yassl\cmakelists.txt -copy taocrypt ..\..\extra\yassl\taocrypt\cmakelists.txt -copy bdb ..\..\storage\bdb\cmakelists.txt -copy heap ..\..\storage\heap\cmakelists.txt -copy innobase ..\..\storage\innobase\cmakelists.txt -copy myisam ..\..\storage\myisam\cmakelists.txt -copy myisammrg ..\..\storage\myisammrg\cmakelists.txt -copy im ..\..\server-tools\instance-manager\cmakelists.txt -copy libmysql ..\..\libmysql\cmakelists.txt -copy tests ..\..\tests\cmakelists.txt diff --git a/win/cmakefiles/extra b/win/cmakefiles/extra deleted file mode 100644 index d31779fca63..00000000000 --- a/win/cmakefiles/extra +++ /dev/null @@ -1,29 +0,0 @@ -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) - -ADD_EXECUTABLE(comp_err comp_err.c) -TARGET_LINK_LIBRARIES(comp_err dbug mysys strings wsock32) - -GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) - -ADD_CUSTOM_TARGET(GenError - ${COMP_ERR_EXE} --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets - --out-dir=${PROJECT_SOURCE_DIR}/sql/share/ - --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h - --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h - --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h - --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt - DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) - - - -ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) -TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt odbc32 odbccp32 wsock32) - -ADD_EXECUTABLE(perror perror.c) -TARGET_LINK_LIBRARIES(perror strings mysys dbug wsock32) - -ADD_EXECUTABLE(replace replace.c) -TARGET_LINK_LIBRARIES(replace strings mysys dbug wsock32) diff --git a/win/cmakefiles/zlib b/zlib/cmakelists.txt similarity index 100% rename from win/cmakefiles/zlib rename to zlib/cmakelists.txt