Commit e94aefcd authored by jani@ibmlab.site's avatar jani@ibmlab.site

Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  ibmlab.site:/home/my/bk/mysql-5.1-new
parents f803908e e4f5f138
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="../../include,../../regex,../../sql" AdditionalIncludeDirectories="../../include,../../regex,../../sql,../../extra/yassl/include"
PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;WITH_PARTITION_STORAGE_ENGINE" PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;WITH_PARTITION_STORAGE_ENGINE"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
OptimizeForProcessor="2" 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" PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;USE_TLS;WITH_PARTITION_STORAGE_ENGINE"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="1" RuntimeLibrary="1"
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="../../include,../../regex,../../sql" AdditionalIncludeDirectories="../../include,../../regex,../../sql,../../extra/yassl/include"
PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;USE_TLS;WITH_PARTITION_STORAGE_ENGINE" PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;USE_TLS;WITH_PARTITION_STORAGE_ENGINE"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="../../include,../../regex,../../sql" AdditionalIncludeDirectories="../../include,../../regex,../../sql,../../extra/yassl/include"
PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;WITH_PARTITION_STORAGE_ENGINE" PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;WITH_PARTITION_STORAGE_ENGINE"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="1" RuntimeLibrary="1"
......
...@@ -8,16 +8,19 @@ TARGET_LINK_LIBRARIES(comp_err dbug mysys strings wsock32) ...@@ -8,16 +8,19 @@ TARGET_LINK_LIBRARIES(comp_err dbug mysys strings wsock32)
GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) 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 ADD_CUSTOM_TARGET(GenError
${COMP_ERR_EXE} --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets ALL
--out-dir=${PROJECT_SOURCE_DIR}/sql/share/ DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h)
--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) ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt odbc32 odbccp32 wsock32) TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt odbc32 odbccp32 wsock32)
......
...@@ -429,8 +429,8 @@ inline double ulonglong2double(ulonglong value) ...@@ -429,8 +429,8 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_RTREE_KEYS 1 #define HAVE_RTREE_KEYS 1
#define HAVE_ROW_BASED_REPLICATION 1 #define HAVE_ROW_BASED_REPLICATION 1
/* #undef HAVE_OPENSSL */ #define HAVE_OPENSSL 1
/* #undef HAVE_YASSL */ #define HAVE_YASSL 1
/* Define charsets you want */ /* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_armscii8 */
......
...@@ -78,6 +78,12 @@ sub mtr_timer_start($$$) { ...@@ -78,6 +78,12 @@ sub mtr_timer_start($$$) {
{ {
# Child, redirect output and exec # Child, redirect output and exec
# FIXME do we need to redirect streams? # 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)"; $0= "mtr_timer(timers,$name,$duration)";
sleep($duration); sleep($duration);
exit(0); exit(0);
......
...@@ -465,4 +465,10 @@ select event_schema, event_name, definer, event_body from information_schema.eve ...@@ -465,4 +465,10 @@ select event_schema, event_name, definer, event_body from information_schema.eve
event_schema event_name definer event_body event_schema event_name definer event_body
events_test white_space root@localhost select 3 events_test white_space root@localhost select 3
drop event white_space; 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; drop database events_test;
create database if not exists events_test; create database if not exists events_test;
use 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; set global event_scheduler=0;
"Wait a bit to settle down" "Wait a bit to settle down"
delete from mysql.event; delete from mysql.event;
......
...@@ -546,4 +546,15 @@ t1 CREATE TABLE `t1` ( ...@@ -546,4 +546,15 @@ t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL `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) ) 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; 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 End of 5.1 tests
...@@ -1166,3 +1166,10 @@ drop procedure bug15091; ...@@ -1166,3 +1166,10 @@ drop procedure bug15091;
drop function if exists bug16896; drop function if exists bug16896;
create aggregate function bug16896() returns int return 1; create aggregate function bug16896() returns int return 1;
ERROR 42000: AGGREGATE is not supported for stored functions 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
...@@ -3156,3 +3156,10 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -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 1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 9 Using filesort 2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 9 Using filesort
DROP TABLE t1; 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;
...@@ -23,21 +23,20 @@ partition_03ndb : Bug#16385 ...@@ -23,21 +23,20 @@ partition_03ndb : Bug#16385
ps_7ndb : dbug assert in RBR mode when executing test suite ps_7ndb : dbug assert in RBR mode when executing test suite
#rpl_bit_npk : Bug#13418 #rpl_bit_npk : Bug#13418
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly 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_2innodb : Assert failure in ha_partition::extra()
rpl_ndb_2myisam : Bugs#17400: delete & update of rows in table without pk fails rpl_ndb_2myisam : Assert failure in ha_partition::extra()
rpl_ndb_auto_inc : Bug#17086 rpl_ndb_auto_inc : Bug#17086
#rpl_ndb_basic : Bug#16228 [IN REVIEW] #rpl_ndb_basic : Bug#16228 [IN REVIEW]
rpl_ndb_blob : interferes with following tests, causing hang rpl_ndb_blob : interferes with following tests, causing hang
rpl_ndb_blob2 : 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_ddl : master hangs
rpl_ndb_delete_nowhere : 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_innodb2ndb : Bug#18261: Cluster Replication: tests rpl_ndb_xxx2ndb fails
rpl_ndb_insert_ignore : Bugs: #17431: INSERT IGNORE INTO returns failed: 1296 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_log : result not deterministic
rpl_ndb_relay_space : Bug#16993 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_ndb_sp007 : Bug #17290
rpl_row_inexist_tbl : Disabled since patch makes this test wait forever rpl_row_inexist_tbl : Disabled since patch makes this test wait forever
rpl_sp : Bug#16456 rpl_sp : Bug#16456
......
...@@ -427,6 +427,16 @@ drop event white_space; ...@@ -427,6 +427,16 @@ drop event white_space;
# END: BUG #17453: Creating Event crash the server # 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; ##set global event_scheduler=1;
##select get_lock("test_lock3", 20); ##select get_lock("test_lock3", 20);
##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20); ##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
......
create database if not exists events_test; create database if not exists events_test;
use 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 # Start - 16407: Events: Changes in sql_mode won't be taken into account
# #
......
...@@ -697,4 +697,21 @@ alter table t1 add primary key (b); ...@@ -697,4 +697,21 @@ alter table t1 add primary key (b);
show create table t1; show create table t1;
drop 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 --echo End of 5.1 tests
...@@ -3,5 +3,10 @@ ...@@ -3,5 +3,10 @@
# to reuse test code between engine runs # # to reuse test code between engine runs #
############################################################ ############################################################
-- source include/have_ndb.inc -- 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; let $engine_type=NDB;
--source extra/rpl_tests/rpl_multi_update2.test --source extra/rpl_tests/rpl_multi_update2.test
...@@ -1691,6 +1691,24 @@ drop function if exists bug16896; ...@@ -1691,6 +1691,24 @@ drop function if exists bug16896;
--error ER_SP_NO_AGGREGATE --error ER_SP_NO_AGGREGATE
create aggregate function bug16896() returns int return 1; 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 # BUG#NNNN: New bug synopsis
......
...@@ -2067,3 +2067,10 @@ SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); ...@@ -2067,3 +2067,10 @@ SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
DROP TABLE t1; 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;
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#define EVENT_EXEC_NO_MORE (1L << 0) #define EVENT_EXEC_NO_MORE (1L << 0)
#define EVENT_NOT_USED (1L << 1) #define EVENT_NOT_USED (1L << 1)
extern ulong opt_event_executor; extern ulong opt_event_executor;
enum enum_event_on_completion enum enum_event_on_completion
...@@ -122,6 +121,39 @@ class Event_timed ...@@ -122,6 +121,39 @@ class Event_timed
bool free_sphead_on_delete; bool free_sphead_on_delete;
uint flags;//all kind of purposes 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), Event_timed():in_spawned_thread(0),locked_by_thread_id(0),
running(0), status_changed(false), running(0), status_changed(false),
last_executed_changed(false), expression(0), created(0), last_executed_changed(false), expression(0), created(0),
...@@ -136,15 +168,21 @@ class Event_timed ...@@ -136,15 +168,21 @@ class Event_timed
} }
~Event_timed() ~Event_timed()
{ {
pthread_mutex_destroy(&this->LOCK_running); deinit_mutexes();
if (free_sphead_on_delete) if (free_sphead_on_delete)
free_sp(); free_sp();
} }
void void
init(); init();
void
deinit_mutexes()
{
pthread_mutex_destroy(&this->LOCK_running);
}
int int
init_definer(THD *thd); init_definer(THD *thd);
......
...@@ -1228,12 +1228,12 @@ Event_timed::change_security_context(THD *thd, Security_context *s_ctx, ...@@ -1228,12 +1228,12 @@ Event_timed::change_security_context(THD *thd, Security_context *s_ctx,
definer_host.str, dbname.str)) definer_host.str, dbname.str))
{ {
my_error(ER_NO_SUCH_USER, MYF(0), definer_user.str, definer_host.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; *backup= thd->security_ctx;
thd->security_ctx= s_ctx; thd->security_ctx= s_ctx;
#endif #endif
DBUG_RETURN(FALSE); DBUG_RETURN(false);
} }
...@@ -1368,7 +1368,8 @@ Event_timed::compile(THD *thd, MEM_ROOT *mem_root) ...@@ -1368,7 +1368,8 @@ Event_timed::compile(THD *thd, MEM_ROOT *mem_root)
ret= 0; ret= 0;
done: done:
lex.et->free_sphead_on_delete= false; lex.et->free_sphead_on_delete= false;
delete lex.et; lex.et->deinit_mutexes();
lex_end(&lex); lex_end(&lex);
DBUG_PRINT("note", ("return old data on its place. set back NAMES")); DBUG_PRINT("note", ("return old data on its place. set back NAMES"));
......
...@@ -176,6 +176,7 @@ sp_get_flags_for_command(LEX *lex) ...@@ -176,6 +176,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_CREATE_DB: case SQLCOM_SHOW_CREATE_DB:
case SQLCOM_SHOW_CREATE_FUNC: case SQLCOM_SHOW_CREATE_FUNC:
case SQLCOM_SHOW_CREATE_PROC: case SQLCOM_SHOW_CREATE_PROC:
case SQLCOM_SHOW_CREATE_EVENT:
case SQLCOM_SHOW_DATABASES: case SQLCOM_SHOW_DATABASES:
case SQLCOM_SHOW_ERRORS: case SQLCOM_SHOW_ERRORS:
case SQLCOM_SHOW_FIELDS: case SQLCOM_SHOW_FIELDS:
...@@ -200,6 +201,7 @@ sp_get_flags_for_command(LEX *lex) ...@@ -200,6 +201,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_WARNS: case SQLCOM_SHOW_WARNS:
case SQLCOM_SHOW_PROC_CODE: case SQLCOM_SHOW_PROC_CODE:
case SQLCOM_SHOW_FUNC_CODE: case SQLCOM_SHOW_FUNC_CODE:
case SQLCOM_SHOW_AUTHORS:
case SQLCOM_REPAIR: case SQLCOM_REPAIR:
case SQLCOM_BACKUP_TABLE: case SQLCOM_BACKUP_TABLE:
case SQLCOM_RESTORE_TABLE: case SQLCOM_RESTORE_TABLE:
......
...@@ -82,8 +82,9 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -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); table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
ha_rows const maybe_deleted= table->file->records; ha_rows const maybe_deleted= table->file->records;
/* /*
If all rows shall be deleted, we always log this statement-based If all rows shall be deleted, we (almost) always log this
(see [binlog], below), so we set this flag and test it below. statement-based (see [binlog], below), so we set this flag and
test it below.
*/ */
ha_delete_all_rows= 1; ha_delete_all_rows= 1;
if (!(error=table->file->delete_all_rows())) if (!(error=table->file->delete_all_rows()))
...@@ -330,12 +331,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -330,12 +331,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
thd->clear_error(); thd->clear_error();
/* /*
[binlog]: If 'handler::delete_all_rows()' was called, we [binlog]: If 'handler::delete_all_rows()' was called and the
replicate statement-based; otherwise, 'ha_delete_row()' was storage engine does not inject the rows itself, we replicate
used to delete specific rows which we might log row-based. statement-based; otherwise, 'ha_delete_row()' was used to
delete specific rows which we might log row-based.
*/ */
THD::enum_binlog_query_type const 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::STMT_QUERY_TYPE :
THD::ROW_QUERY_TYPE); THD::ROW_QUERY_TYPE);
int log_result= thd->binlog_query(query_type, int log_result= thd->binlog_query(query_type,
......
...@@ -761,6 +761,7 @@ typedef struct st_lex ...@@ -761,6 +761,7 @@ typedef struct st_lex
const uchar *tok_start_prev, *tok_end_prev; const uchar *tok_start_prev, *tok_end_prev;
char *length,*dec,*change,*name; char *length,*dec,*change,*name;
Table_ident *like_name;
char *help_arg; char *help_arg;
char *backup_dir; /* For RESTORE/BACKUP */ char *backup_dir; /* For RESTORE/BACKUP */
char* to_log; /* For PURGE MASTER LOGS TO */ char* to_log; /* For PURGE MASTER LOGS TO */
......
...@@ -2897,9 +2897,9 @@ mysql_execute_command(THD *thd) ...@@ -2897,9 +2897,9 @@ mysql_execute_command(THD *thd)
else else
{ {
/* regular create */ /* regular create */
if (lex->name) if (lex->like_name)
res= mysql_create_like_table(thd, create_table, &lex->create_info, res= mysql_create_like_table(thd, create_table, &lex->create_info,
(Table_ident *)lex->name); lex->like_name);
else else
{ {
res= mysql_create_table(thd, create_table->db, res= mysql_create_table(thd, create_table->db,
...@@ -3803,10 +3803,14 @@ mysql_execute_command(THD *thd) ...@@ -3803,10 +3803,14 @@ mysql_execute_command(THD *thd)
send_ok(thd, rows_affected); send_ok(thd, rows_affected);
/* lex->unit.cleanup() is called outside, no need to call it here */ /* lex->unit.cleanup() is called outside, no need to call it here */
} while (0); } while (0);
lex->et->free_sphead_on_delete= true; if (!thd->spcont)
delete lex->et; {
lex->et= 0; lex->et->free_sphead_on_delete= true;
lex->et->free_sp();
lex->et->deinit_mutexes();
}
break; break;
} }
case SQLCOM_SHOW_CREATE_EVENT: case SQLCOM_SHOW_CREATE_EVENT:
...@@ -5845,7 +5849,9 @@ void mysql_parse(THD *thd, char *inBuf, uint length) ...@@ -5845,7 +5849,9 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
if (thd->lex->et) if (thd->lex->et)
{ {
thd->lex->et->free_sphead_on_delete= true; 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; thd->lex->et= NULL;
} }
} }
...@@ -5886,7 +5892,8 @@ void mysql_parse(THD *thd, char *inBuf, uint length) ...@@ -5886,7 +5892,8 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
if (thd->lex->et) if (thd->lex->et)
{ {
thd->lex->et->free_sphead_on_delete= true; thd->lex->et->free_sphead_on_delete= true;
delete thd->lex->et; lex->et->free_sp();
lex->et->deinit_mutexes();
thd->lex->et= NULL; thd->lex->et= NULL;
} }
} }
......
...@@ -3741,14 +3741,14 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf, ...@@ -3741,14 +3741,14 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
ha_legacy_type(default_db_type))); ha_legacy_type(default_db_type)));
if (is_create_table_ind) 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 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. 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_db= table_ident->db.str ? table_ident->db.str : thd->db;
char *src_table= table_ident->table.str; char *src_table= table_ident->table.str;
char buf[FN_REFLEN]; char buf[FN_REFLEN];
......
...@@ -7114,7 +7114,10 @@ static Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, ...@@ -7114,7 +7114,10 @@ static Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
if (!cond) if (!cond)
cond= new Item_cond_and(eq_list); cond= new Item_cond_and(eq_list);
else else
{
DBUG_ASSERT(cond->type() == Item::COND_ITEM);
((Item_cond *) cond)->add_at_head(&eq_list); ((Item_cond *) cond)->add_at_head(&eq_list);
}
cond->quick_fix_field(); cond->quick_fix_field();
cond->update_used_tables(); cond->update_used_tables();
...@@ -7199,6 +7202,11 @@ static COND* substitute_for_best_equal_field(COND *cond, ...@@ -7199,6 +7202,11 @@ static COND* substitute_for_best_equal_field(COND *cond,
while ((item_equal= it++)) while ((item_equal= it++))
{ {
cond= eliminate_item_equal(cond, cond_equal->upper_levels, item_equal); 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;
} }
} }
} }
......
...@@ -1214,7 +1214,8 @@ create: ...@@ -1214,7 +1214,8 @@ create:
lex->create_info.options=$2 | $4; lex->create_info.options=$2 | $4;
lex->create_info.db_type= lex->thd->variables.table_type; lex->create_info.db_type= lex->thd->variables.table_type;
lex->create_info.default_table_charset= NULL; lex->create_info.default_table_charset= NULL;
lex->name=0; lex->name= 0;
lex->like_name= 0;
} }
create2 create2
{ Lex->current_select= &Lex->select_lex; } { Lex->current_select= &Lex->select_lex; }
...@@ -1274,7 +1275,7 @@ create: ...@@ -1274,7 +1275,7 @@ create:
lex->create_info.options= $3; 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; YYABORT;
/* /*
...@@ -3272,13 +3273,13 @@ create2: ...@@ -3272,13 +3273,13 @@ create2:
| LIKE table_ident | LIKE table_ident
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!(lex->name= (char *)$2)) if (!(lex->like_name= $2))
YYABORT; YYABORT;
} }
| '(' LIKE table_ident ')' | '(' LIKE table_ident ')'
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!(lex->name= (char *)$3)) if (!(lex->like_name= $3))
YYABORT; YYABORT;
} }
; ;
...@@ -4712,8 +4713,8 @@ alter: ...@@ -4712,8 +4713,8 @@ alter:
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
LEX *lex= thd->lex; LEX *lex= thd->lex;
lex->name= 0;
lex->sql_command= SQLCOM_ALTER_TABLE; lex->sql_command= SQLCOM_ALTER_TABLE;
lex->name= 0;
lex->duplicates= DUP_ERROR; lex->duplicates= DUP_ERROR;
if (!lex->select_lex.add_table_to_list(thd, $4, NULL, if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
TL_OPTION_UPDATING)) TL_OPTION_UPDATING))
...@@ -4722,7 +4723,8 @@ alter: ...@@ -4722,7 +4723,8 @@ alter:
lex->key_list.empty(); lex->key_list.empty();
lex->col_list.empty(); lex->col_list.empty();
lex->select_lex.init_order(); 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)); bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= (handlerton*) &default_hton; lex->create_info.db_type= (handlerton*) &default_hton;
lex->create_info.default_table_charset= NULL; lex->create_info.default_table_charset= NULL;
...@@ -4811,7 +4813,7 @@ alter: ...@@ -4811,7 +4813,7 @@ alter:
} }
lex->spname= 0;//defensive programming 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; YYABORT;
lex->et = et; lex->et = et;
...@@ -7715,7 +7717,7 @@ drop: ...@@ -7715,7 +7717,7 @@ drop:
YYABORT; YYABORT;
} }
if (!(lex->et= new Event_timed())) if (!(lex->et= new (YYTHD->mem_root) Event_timed()))
YYABORT; YYABORT;
if (!lex->et_compile_phase) if (!lex->et_compile_phase)
...@@ -8439,7 +8441,7 @@ show_param: ...@@ -8439,7 +8441,7 @@ show_param:
{ {
Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT; Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT;
Lex->spname= $3; Lex->spname= $3;
Lex->et= new Event_timed(); Lex->et= new (YYTHD->mem_root) Event_timed();
if (!Lex->et) if (!Lex->et)
YYABORT; YYABORT;
Lex->et->init_definer(YYTHD); Lex->et->init_definer(YYTHD);
......
...@@ -60,16 +60,11 @@ click the build solution menu option. ...@@ -60,16 +60,11 @@ click the build solution menu option.
Current issues Current issues
-------------- --------------
1. Dependencies are not handled correctly with the current scripts. What 1. Not all configurations are currently available. i.e. Classic, Pro, Max.
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.
Currently, only debug and release are available. This will change in the near Currently, only debug and release are available. This will change in the near
future. 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 changed based on the options given with configure. This will soon be fixed
as well. as well.
@echo off @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 del cmakecache.txt
copy win\vs71cache.txt cmakecache.txt copy win\vs71cache.txt cmakecache.txt
cmake -G "Visual Studio 7 .NET 2003" cmake -G "Visual Studio 7 .NET 2003"
......
@echo off @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 del cmakecache.txt
copy win\vs8cache.txt cmakecache.txt copy win\vs8cache.txt cmakecache.txt
cmake -G "Visual Studio 8 2005" cmake -G "Visual Studio 8 2005"
......
@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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment