mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Merge mysql.com:/home/mysql_src/mysql-5.0-van
into mysql.com:/home/mysql_src/mysql-5.1-merge-of-5.0 (2nd try; Pekka kindly accepted to fix storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp and storage/ndb/src/kernel/vm/SimulatedBlock.cpp after I push). configure.in: Auto merged mysql-test/r/ndb_charset.result: Auto merged mysql-test/t/view.test: Auto merged mysys/base64.c: Auto merged sql/ha_archive.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/lock.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged storage/myisam/ft_parser.c: Auto merged storage/ndb/include/kernel/AttributeDescriptor.hpp: Auto merged storage/ndb/src/kernel/vm/SimulatedBlock.hpp: Auto merged storage/ndb/tools/ndb_size.pl: Auto merged storage/ndb/tools/ndb_size.tmpl: Auto merged mysql-test/t/disabled.def: merge storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: used "ul", Pekka said he'll fix storage/ndb/src/kernel/vm/SimulatedBlock.cpp: used "ul", Pekka said he'll fix
This commit is contained in:
commit
380690316f
54 changed files with 1380 additions and 182 deletions
|
@ -1872,9 +1872,13 @@ com_help(String *buffer __attribute__((unused)),
|
|||
if (help_arg)
|
||||
return com_server_help(buffer,line,help_arg+1);
|
||||
|
||||
put_info("\nFor the complete MySQL Manual online, visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
|
||||
put_info("For info on technical support from MySQL developers, visit:\n http://www.mysql.com/support\n", INFO_INFO);
|
||||
put_info("For info on MySQL books, utilities, consultants, etc., visit:\n http://www.mysql.com/portal\n", INFO_INFO);
|
||||
put_info("\nFor information about MySQL products and services, visit:\n"
|
||||
" http://www.mysql.com/\n"
|
||||
"For developer information, including the MySQL Reference Manual, "
|
||||
"visit:\n"
|
||||
" http://dev.mysql.com/\n"
|
||||
"To buy MySQL Network Support, training, or other products, visit:\n"
|
||||
" https://shop.mysql.com/\n", INFO_INFO);
|
||||
put_info("List of all MySQL commands:", INFO_INFO);
|
||||
if (!named_cmds)
|
||||
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
|
||||
|
|
13
configure.in
13
configure.in
|
@ -1537,6 +1537,19 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
|
|||
OPTIMIZE_CXXFLAGS="-O3 -DNDEBUG"
|
||||
fi
|
||||
|
||||
# If the user specified CFLAGS, we won't add any optimizations
|
||||
if test -n "$SAVE_CFLAGS"
|
||||
then
|
||||
OPTIMIZE_CFLAGS=""
|
||||
DEBUG_OPTIMIZE_CC=""
|
||||
fi
|
||||
# Ditto for CXXFLAGS
|
||||
if test -n "$SAVE_CXXFLAGS"
|
||||
then
|
||||
OPTIMIZE_CXXFLAGS=""
|
||||
DEBUG_OPTIMIZE_CXX=""
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(debug,
|
||||
[ --without-debug Build a production version without debugging code],
|
||||
[with_debug=$withval],
|
||||
|
|
|
@ -536,9 +536,15 @@ void safe_mutex_end(FILE *file);
|
|||
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
|
||||
#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
|
||||
#define pthread_mutex_t safe_mutex_t
|
||||
#define safe_mutex_assert_owner(mp) DBUG_ASSERT((mp)->count > 0 && pthread_equal(pthread_self(),(mp)->thread))
|
||||
#define safe_mutex_assert_owner(mp) \
|
||||
DBUG_ASSERT((mp)->count > 0 && \
|
||||
pthread_equal(pthread_self(), (mp)->thread))
|
||||
#define safe_mutex_assert_not_owner(mp) \
|
||||
DBUG_ASSERT(! (mp)->count || \
|
||||
! pthread_equal(pthread_self(), (mp)->thread))
|
||||
#else
|
||||
#define safe_mutex_assert_owner(mp)
|
||||
#define safe_mutex_assert_not_owner(mp)
|
||||
#endif /* SAFE_MUTEX */
|
||||
|
||||
/* READ-WRITE thread locking */
|
||||
|
|
|
@ -30,3 +30,10 @@ check table t1;
|
|||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
|
||||
execute stmt1;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
execute stmt1;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
deallocate prepare stmt1;
|
||||
|
|
|
@ -429,4 +429,8 @@ REPAIR TABLE t1;
|
|||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
INSERT INTO t1 VALUES('testword\'\'');
|
||||
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
||||
a
|
||||
testword''
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -596,3 +596,18 @@ GROUP_CONCAT(a ORDER BY a)
|
|||
,x
|
||||
,z
|
||||
DROP TABLE t1;
|
||||
set names latin1;
|
||||
create table t1 (a char, b char);
|
||||
insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b');
|
||||
create table t2 select group_concat(b) as a from t1 where a = 'a';
|
||||
create table t3 (select group_concat(a) as a from t1 where a = 'a') union
|
||||
(select group_concat(b) as a from t1 where a = 'b');
|
||||
select charset(a) from t2;
|
||||
charset(a)
|
||||
latin1
|
||||
select charset(a) from t3;
|
||||
charset(a)
|
||||
latin1
|
||||
latin1
|
||||
drop table t1, t2, t3;
|
||||
set names default;
|
||||
|
|
|
@ -445,3 +445,40 @@ drop table t2;
|
|||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (1);
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
c1
|
||||
1
|
||||
send the below to another connection, do not wait for the result
|
||||
optimize table t1;
|
||||
proceed with the normal connection
|
||||
handler t1 read next;
|
||||
c1
|
||||
1
|
||||
handler t1 close;
|
||||
read the result from the other connection
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
proceed with the normal connection
|
||||
drop table t1;
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (14397);
|
||||
flush tables with read lock;
|
||||
drop table t1;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
send the below to another connection, do not wait for the result
|
||||
drop table t1;
|
||||
proceed with the normal connection
|
||||
select * from t1;
|
||||
c1
|
||||
14397
|
||||
unlock tables;
|
||||
read the result from the other connection
|
||||
proceed with the normal connection
|
||||
select * from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
|
|
|
@ -205,3 +205,54 @@ select (@after-@before) >= 2;
|
|||
(@after-@before) >= 2
|
||||
1
|
||||
drop table t1,t2;
|
||||
commit;
|
||||
begin;
|
||||
create temporary table ti (a int) engine=innodb;
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
insert into ti values(1);
|
||||
set autocommit=0;
|
||||
create temporary table t1 (a int) engine=myisam;
|
||||
commit;
|
||||
insert t1 values (1);
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
create table t0 (n int);
|
||||
insert t0 select * from t1;
|
||||
set autocommit=1;
|
||||
insert into t0 select GET_LOCK("lock1",null);
|
||||
set autocommit=0;
|
||||
create table t2 (n int) engine=innodb;
|
||||
insert into t2 values (3);
|
||||
select get_lock("lock1",60);
|
||||
get_lock("lock1",60)
|
||||
1
|
||||
show binlog events from 98;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 98 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16)
|
||||
master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18)
|
||||
master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */
|
||||
master-bin.000001 369 Query 1 # use `test`; delete from t1
|
||||
master-bin.000001 446 Xid 1 # COMMIT /* xid=114 */
|
||||
master-bin.000001 473 Query 1 # use `test`; delete from t2
|
||||
master-bin.000001 550 Xid 1 # COMMIT /* xid=115 */
|
||||
master-bin.000001 577 Query 1 # use `test`; alter table t2 type=MyISAM
|
||||
master-bin.000001 666 Query 1 # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 754 Xid 1 # COMMIT /* xid=117 */
|
||||
master-bin.000001 781 Query 1 # use `test`; insert into t2 values (20)
|
||||
master-bin.000001 870 Query 1 # use `test`; drop table t1,t2
|
||||
master-bin.000001 949 Query 1 # use `test`; create temporary table ti (a int) engine=innodb
|
||||
master-bin.000001 1059 Query 1 # use `test`; insert into ti values(1)
|
||||
master-bin.000001 1146 Xid 1 # COMMIT /* xid=132 */
|
||||
master-bin.000001 1173 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam
|
||||
master-bin.000001 1283 Query 1 # use `test`; insert t1 values (1)
|
||||
master-bin.000001 1366 Query 1 # use `test`; create table t0 (n int)
|
||||
master-bin.000001 1452 Query 1 # use `test`; insert t0 select * from t1
|
||||
master-bin.000001 1541 Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null)
|
||||
master-bin.000001 1648 Query 1 # use `test`; create table t2 (n int) engine=innodb
|
||||
master-bin.000001 1748 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
|
||||
do release_lock("lock1");
|
||||
drop table t0,t2;
|
||||
|
|
|
@ -505,6 +505,16 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
|
||||
1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
|
||||
drop table t1,t2;
|
||||
create table t1 (
|
||||
c1 varchar(32),
|
||||
key (c1)
|
||||
) engine=myisam;
|
||||
alter table t1 disable keys;
|
||||
insert into t1 values ('a'), ('b');
|
||||
select c1 from t1 order by c1 limit 1;
|
||||
c1
|
||||
a
|
||||
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`)) ENGINE=MyISAM;
|
||||
Got one of the listed errors
|
||||
create table t1 (a int, b varchar(200), c text not null) checksum=1;
|
||||
|
|
|
@ -306,11 +306,21 @@ count(*)
|
|||
drop table t1;
|
||||
create table t1 (
|
||||
a char(10) primary key
|
||||
) engine=ndb;
|
||||
insert into t1 values ('jonas % ');
|
||||
replace into t1 values ('jonas % ');
|
||||
replace into t1 values ('jonas % ');
|
||||
) engine=ndbcluster default charset=latin1;
|
||||
insert into t1 values ('aaabb');
|
||||
select * from t1;
|
||||
a
|
||||
jonas %
|
||||
aaabb
|
||||
replace into t1 set a = 'AAABB';
|
||||
select * from t1;
|
||||
a
|
||||
AAABB
|
||||
replace into t1 set a = 'aAaBb';
|
||||
select * from t1;
|
||||
a
|
||||
aAaBb
|
||||
replace into t1 set a = 'aaabb';
|
||||
select * from t1;
|
||||
a
|
||||
aaabb
|
||||
drop table t1;
|
||||
|
|
|
@ -375,3 +375,28 @@ drop procedure foo;
|
|||
drop function fn1;
|
||||
drop database mysqltest1;
|
||||
drop user "zedjzlcsjhd"@127.0.0.1;
|
||||
use test;
|
||||
use test;
|
||||
drop function if exists f1;
|
||||
create function f1() returns int reads sql data
|
||||
begin
|
||||
declare var integer;
|
||||
declare c cursor for select a from v1;
|
||||
open c;
|
||||
fetch c into var;
|
||||
close c;
|
||||
return var;
|
||||
end|
|
||||
create view v1 as select 1 as a;
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (f1());
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
drop view v1;
|
||||
drop function f1;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
reset master;
|
||||
|
|
|
@ -845,6 +845,8 @@ set password = 'foo1';
|
|||
select password;
|
||||
end|
|
||||
ERROR 42000: Variable 'password' must be quoted with `...`, or renamed
|
||||
set names='foo2'|
|
||||
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 bug13510_2()
|
||||
begin
|
||||
declare names varchar(10);
|
||||
|
@ -872,6 +874,127 @@ names
|
|||
foo4
|
||||
drop procedure bug13510_3|
|
||||
drop procedure bug13510_4|
|
||||
drop function if exists bug_13627_f|
|
||||
CREATE TABLE t1 (a int)|
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN DROP TRIGGER test1; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN load table t1 from master; END |
|
||||
ERROR 0A000: LOAD TABLE is not allowed in stored procedures
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN load table t1 from master; return 1; END |
|
||||
ERROR 0A000: LOAD TABLE is not allowed in stored procedures
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create table t2 (a int); END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create table t2 (a int); return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create index t1_i on t1 (a); END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create index t1_i on t1 (a); return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter table t1 add column b int; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN alter table t1 add column b int; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename table t1 to t2; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN rename table t1 to t2; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN truncate table t1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN truncate table t1; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop table t1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop table t1; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop index t1_i on t1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop index t1_i on t1; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN unlock tables; END |
|
||||
ERROR 0A000: UNLOCK is not allowed in stored procedures
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN unlock tables; return 1; END |
|
||||
ERROR 0A000: UNLOCK is not allowed in stored procedures
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN LOCK TABLE t1 READ; END |
|
||||
ERROR 0A000: LOCK is not allowed in stored procedures
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN LOCK TABLE t1 READ; return 1; END |
|
||||
ERROR 0A000: LOCK is not allowed in stored procedures
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create database mysqltest; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create database mysqltest; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop database mysqltest; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop database mysqltest; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest_1'; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as select 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop view v1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop view v1; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create trigger tr2 before insert on t1 for each row do select 1; END |
|
||||
ERROR 2F003: Can't create a TRIGGER from within another stored routine
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create trigger tr2 before insert on t1 for each row do select 1; return 1; END |
|
||||
ERROR 2F003: Can't create a TRIGGER from within another stored routine
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop function bug_13627_f; END |
|
||||
ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop function bug_13627_f; return 1; END |
|
||||
ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create function f2 () returns int return 1; END |
|
||||
ERROR 2F003: Can't create a FUNCTION from within another stored routine
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create function f2 () returns int return 1; return 1; END |
|
||||
ERROR 2F003: Can't create a FUNCTION from within another stored routine
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
CREATE TEMPORARY TABLE t2 (a int);
|
||||
DROP TEMPORARY TABLE t2;
|
||||
END |
|
||||
CREATE FUNCTION bug_13627_f() returns int
|
||||
BEGIN
|
||||
CREATE TEMPORARY TABLE t2 (a int);
|
||||
DROP TEMPORARY TABLE t2;
|
||||
return 1;
|
||||
END |
|
||||
drop table t1|
|
||||
drop function bug_13627_f|
|
||||
drop function if exists bug12329;
|
||||
create table t1 as select 1 a;
|
||||
create table t2 as select 1 a;
|
||||
create function bug12329() returns int return (select a from t1);
|
||||
prepare stmt1 from 'select bug12329()';
|
||||
execute stmt1;
|
||||
bug12329()
|
||||
1
|
||||
drop function bug12329;
|
||||
create function bug12329() returns int return (select a+100 from t2);
|
||||
select bug12329();
|
||||
bug12329()
|
||||
101
|
||||
execute stmt1;
|
||||
ERROR HY000: Table 't2' was not locked with LOCK TABLES
|
||||
deallocate prepare stmt1;
|
||||
drop function bug12329;
|
||||
drop table t1, t2;
|
||||
create database mysqltest1;
|
||||
use mysqltest1;
|
||||
drop database mysqltest1;
|
||||
|
|
|
@ -3617,4 +3617,54 @@ count(*)
|
|||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
drop function if exists bug14723|
|
||||
drop procedure if exists bug14723|
|
||||
/*!50003 create function bug14723()
|
||||
returns bigint(20)
|
||||
main_loop: begin
|
||||
return 42;
|
||||
end */;;
|
||||
show create function bug14723;;
|
||||
Function sql_mode Create Function
|
||||
bug14723 CREATE FUNCTION `bug14723`() RETURNS bigint(20)
|
||||
main_loop: begin
|
||||
return 42;
|
||||
end
|
||||
select bug14723();;
|
||||
bug14723()
|
||||
42
|
||||
/*!50003 create procedure bug14723()
|
||||
main_loop: begin
|
||||
select 42;
|
||||
end */;;
|
||||
show create procedure bug14723;;
|
||||
Procedure sql_mode Create Procedure
|
||||
bug14723 CREATE PROCEDURE `bug14723`()
|
||||
main_loop: begin
|
||||
select 42;
|
||||
end
|
||||
call bug14723();;
|
||||
42
|
||||
42
|
||||
drop function bug14723|
|
||||
drop procedure bug14723|
|
||||
create procedure bug14845()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select count(*) from t1 where 1 = 0;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
select a;
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14845()|
|
||||
a
|
||||
0
|
||||
drop procedure bug14845|
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -738,3 +738,28 @@ f1
|
|||
1
|
||||
drop trigger t1_bi;
|
||||
drop tables t1, t2;
|
||||
create table t1 (id int);
|
||||
create table t2 (id int);
|
||||
create trigger t1_bi before insert on t1 for each row insert into t2 values (new.id);
|
||||
prepare stmt1 from "insert into t1 values (10)";
|
||||
create procedure p1() insert into t1 values (10);
|
||||
call p1();
|
||||
drop trigger t1_bi;
|
||||
execute stmt1;
|
||||
call p1();
|
||||
deallocate prepare stmt1;
|
||||
drop procedure p1;
|
||||
create table t3 (id int);
|
||||
create trigger t1_bi after insert on t1 for each row insert into t2 values (new.id);
|
||||
prepare stmt1 from "insert into t1 values (10)";
|
||||
create procedure p1() insert into t1 values (10);
|
||||
call p1();
|
||||
drop trigger t1_bi;
|
||||
create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id);
|
||||
execute stmt1;
|
||||
ERROR HY000: Table 't3' was not locked with LOCK TABLES
|
||||
call p1();
|
||||
ERROR HY000: Table 't3' was not locked with LOCK TABLES
|
||||
deallocate prepare stmt1;
|
||||
drop procedure p1;
|
||||
drop table t1, t2, t3;
|
||||
|
|
|
@ -204,6 +204,21 @@ create table t1 (a int);
|
|||
insert into t1 values (1), (2), (3);
|
||||
create view v1 (a) as select a+1 from t1;
|
||||
create view v2 (a) as select a-1 from t1;
|
||||
select * from t1 natural left join v1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
select * from v2 natural left join t1;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
select * from v2 natural left join v1;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
drop view v1, v2;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
|
@ -2323,6 +2338,14 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2,t3;
|
||||
create table t1 (f1 int);
|
||||
create view v1 as select t1.f1 as '123
|
||||
456' from t1;
|
||||
select * from v1;
|
||||
123
|
||||
456
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
create table t1 (f1 int, f2 int);
|
||||
insert into t1 values(1,1),(1,2),(1,3);
|
||||
create view v1 as select f1 ,group_concat(f2 order by f2 asc) from t1 group by f1;
|
||||
|
@ -2385,3 +2408,19 @@ show create view v1;
|
|||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1`
|
||||
drop view v1;
|
||||
create table t1 (id INT, primary key(id));
|
||||
insert into t1 values (1),(2);
|
||||
create view v1 as select * from t1;
|
||||
explain select id from v1 order by id;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
create table t1(f1 int, f2 int);
|
||||
insert into t1 values (null, 10), (null,2);
|
||||
create view v1 as select * from t1;
|
||||
select f1, sum(f2) from v1 group by f1;
|
||||
f1 sum(f2)
|
||||
NULL 12
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -39,4 +39,13 @@ check table t1;
|
|||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# procedure in PS BUG#13673
|
||||
#
|
||||
CREATE TABLE t1 (a int);
|
||||
prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
|
||||
execute stmt1;
|
||||
execute stmt1;
|
||||
deallocate prepare stmt1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -15,5 +15,4 @@ rpl_relayrotate : Unstable test case, bug#12429
|
|||
rpl_until : Unstable test case, bug#12429
|
||||
rpl_deadlock : Unstable test case, bug#12429
|
||||
kill : Unstable test case, bug#9712
|
||||
archive_gis : The test fails on 32bit Linux
|
||||
compress : Magnus will fix
|
||||
|
|
|
@ -348,6 +348,12 @@ INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
|
|||
SET myisam_repair_threads=2;
|
||||
REPAIR TABLE t1;
|
||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
|
||||
#
|
||||
# BUG#5686 - #1034 - Incorrect key file for table - only utf8
|
||||
#
|
||||
INSERT INTO t1 VALUES('testword\'\'');
|
||||
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -390,3 +390,19 @@ SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id;
|
|||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#8568 "GROUP_CONCAT returns string, unless in a UNION in which case
|
||||
# returns BLOB": add a test case, the bug can not be repeated any more.
|
||||
#
|
||||
|
||||
set names latin1;
|
||||
create table t1 (a char, b char);
|
||||
insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b');
|
||||
create table t2 select group_concat(b) as a from t1 where a = 'a';
|
||||
create table t3 (select group_concat(a) as a from t1 where a = 'a') union
|
||||
(select group_concat(b) as a from t1 where a = 'b');
|
||||
select charset(a) from t2;
|
||||
select charset(a) from t3;
|
||||
drop table t1, t2, t3;
|
||||
set names default;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
# simple test of all group functions
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
@ -545,10 +543,12 @@ DROP TABLE t1;
|
|||
# Bug #12882 min/max inconsistent on empty table
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1m (a int) engine=myisam;
|
||||
create table t1i (a int) engine=innodb;
|
||||
create table t2m (a int) engine=myisam;
|
||||
create table t2i (a int) engine=innodb;
|
||||
--enable_warnings
|
||||
insert into t2m values (5);
|
||||
insert into t2i values (5);
|
||||
|
||||
|
|
|
@ -347,4 +347,79 @@ drop table t3;
|
|||
drop table t4;
|
||||
drop table t5;
|
||||
|
||||
#
|
||||
# Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
|
||||
#
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (1);
|
||||
# client 1
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
# client 2
|
||||
connect (con2,localhost,root,,);
|
||||
connection con2;
|
||||
--exec echo send the below to another connection, do not wait for the result
|
||||
send optimize table t1;
|
||||
--sleep 1
|
||||
# client 1
|
||||
--exec echo proceed with the normal connection
|
||||
connection default;
|
||||
handler t1 read next;
|
||||
handler t1 close;
|
||||
# client 2
|
||||
--exec echo read the result from the other connection
|
||||
connection con2;
|
||||
reap;
|
||||
# client 1
|
||||
--exec echo proceed with the normal connection
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Addendum to Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
|
||||
# Show that DROP TABLE can no longer deadlock against
|
||||
# FLUSH TABLES WITH READ LOCK. This is a 5.0 issue.
|
||||
#
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (14397);
|
||||
flush tables with read lock;
|
||||
# The thread with the global read lock cannot drop the table itself:
|
||||
--error 1223
|
||||
drop table t1;
|
||||
#
|
||||
# client 2
|
||||
# We need a second connection to try the drop.
|
||||
# The drop waits for the global read lock to go away.
|
||||
# Without the addendum fix it locked LOCK_open before entering the wait loop.
|
||||
connection con2;
|
||||
--exec echo send the below to another connection, do not wait for the result
|
||||
send drop table t1;
|
||||
--sleep 1
|
||||
#
|
||||
# client 1
|
||||
# Now we need something that wants LOCK_open. A simple table access which
|
||||
# opens the table does the trick.
|
||||
--exec echo proceed with the normal connection
|
||||
connection default;
|
||||
# This would hang on LOCK_open without the 5.0 addendum fix.
|
||||
select * from t1;
|
||||
# Release the read lock. This should make the DROP go through.
|
||||
unlock tables;
|
||||
#
|
||||
# client 2
|
||||
# Read the result of the drop command.
|
||||
connection con2;
|
||||
--exec echo read the result from the other connection
|
||||
reap;
|
||||
#
|
||||
# client 1
|
||||
# Now back to normal operation. The table should not exist any more.
|
||||
--exec echo proceed with the normal connection
|
||||
connection default;
|
||||
--error 1146
|
||||
select * from t1;
|
||||
# Just to be sure and not confuse the next test case writer.
|
||||
drop table if exists t1;
|
||||
|
||||
|
|
|
@ -227,7 +227,37 @@ select (@after:=unix_timestamp())*0; # always give repeatable output
|
|||
# the bug, the reap would return immediately after the insert into t2.
|
||||
select (@after-@before) >= 2;
|
||||
|
||||
# cleanup
|
||||
drop table t1,t2;
|
||||
commit;
|
||||
|
||||
# test for BUG#7947 - DO RELEASE_LOCK() not written to binlog on rollback in the middle
|
||||
# of a transaction
|
||||
|
||||
connection con2;
|
||||
begin;
|
||||
create temporary table ti (a int) engine=innodb;
|
||||
rollback;
|
||||
insert into ti values(1);
|
||||
set autocommit=0;
|
||||
create temporary table t1 (a int) engine=myisam;
|
||||
commit;
|
||||
insert t1 values (1);
|
||||
rollback;
|
||||
create table t0 (n int);
|
||||
insert t0 select * from t1;
|
||||
set autocommit=1;
|
||||
insert into t0 select GET_LOCK("lock1",null);
|
||||
set autocommit=0;
|
||||
create table t2 (n int) engine=innodb;
|
||||
insert into t2 values (3);
|
||||
disconnect con2;
|
||||
connection con3;
|
||||
select get_lock("lock1",60);
|
||||
--replace_column 5 #
|
||||
--replace_result "xid=208" "xid=105" "xid=227" "xid=114" "xid=230" "xid=115" "xid=234" "xid=117" "xid=261" "xid=132"
|
||||
show binlog events from 98;
|
||||
do release_lock("lock1");
|
||||
drop table t0,t2;
|
||||
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -476,6 +476,18 @@ explain select sql_big_result distinct t1.a from t1,t2 order by t2.a;
|
|||
explain select distinct t1.a from t1,t2 order by t2.a;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#14616 - Freshly imported table returns error 124 when using LIMIT
|
||||
#
|
||||
create table t1 (
|
||||
c1 varchar(32),
|
||||
key (c1)
|
||||
) engine=myisam;
|
||||
alter table t1 disable keys;
|
||||
insert into t1 values ('a'), ('b');
|
||||
select c1 from t1 order by c1 limit 1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test RTREE index
|
||||
#
|
||||
|
|
|
@ -237,13 +237,18 @@ drop table t1;
|
|||
#select a,b,length(a),length(b) from t1 where a='c' and b='c';
|
||||
#drop table t1;
|
||||
|
||||
# bug
|
||||
# bug#14007
|
||||
create table t1 (
|
||||
a char(10) primary key
|
||||
) engine=ndb;
|
||||
insert into t1 values ('jonas % ');
|
||||
replace into t1 values ('jonas % ');
|
||||
replace into t1 values ('jonas % ');
|
||||
) engine=ndbcluster default charset=latin1;
|
||||
|
||||
insert into t1 values ('aaabb');
|
||||
select * from t1;
|
||||
replace into t1 set a = 'AAABB';
|
||||
select * from t1;
|
||||
replace into t1 set a = 'aAaBb';
|
||||
select * from t1;
|
||||
replace into t1 set a = 'aaabb';
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
|
|
@ -360,4 +360,40 @@ connection master;
|
|||
drop function fn1;
|
||||
drop database mysqltest1;
|
||||
drop user "zedjzlcsjhd"@127.0.0.1;
|
||||
use test;
|
||||
sync_slave_with_master;
|
||||
use test;
|
||||
|
||||
#
|
||||
# Bug#14077 "Failure to replicate a stored function with a cursor":
|
||||
# verify that stored routines with cursors work on slave.
|
||||
#
|
||||
connection master;
|
||||
--disable_warnings
|
||||
drop function if exists f1;
|
||||
--enable_warnings
|
||||
delimiter |;
|
||||
create function f1() returns int reads sql data
|
||||
begin
|
||||
declare var integer;
|
||||
declare c cursor for select a from v1;
|
||||
open c;
|
||||
fetch c into var;
|
||||
close c;
|
||||
return var;
|
||||
end|
|
||||
delimiter ;|
|
||||
create view v1 as select 1 as a;
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (f1());
|
||||
select * from t1;
|
||||
drop view v1;
|
||||
drop function f1;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from t1;
|
||||
|
||||
# cleanup
|
||||
connection master;
|
||||
drop table t1;
|
||||
reset master;
|
||||
|
|
|
@ -1233,6 +1233,10 @@ begin
|
|||
select password;
|
||||
end|
|
||||
|
||||
# Check that an error message is sent
|
||||
--error ER_PARSE_ERROR
|
||||
set names='foo2'|
|
||||
|
||||
--error ER_SP_BAD_VAR_SHADOW
|
||||
create procedure bug13510_2()
|
||||
begin
|
||||
|
@ -1263,8 +1267,168 @@ call bug13510_4()|
|
|||
|
||||
drop procedure bug13510_3|
|
||||
drop procedure bug13510_4|
|
||||
|
||||
|
||||
#
|
||||
# Test that statements which implicitly commit transaction are prohibited
|
||||
# in stored function and triggers. Attempt to create function or trigger
|
||||
# containing such statement should produce error (includes test for
|
||||
# bug #13627).
|
||||
#
|
||||
--disable_warnings
|
||||
drop function if exists bug_13627_f|
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a int)|
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN DROP TRIGGER test1; return 1; END |
|
||||
|
||||
-- error ER_SP_BADSTATEMENT
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN load table t1 from master; END |
|
||||
-- error ER_SP_BADSTATEMENT
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN load table t1 from master; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create table t2 (a int); END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create table t2 (a int); return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create index t1_i on t1 (a); END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create index t1_i on t1 (a); return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter table t1 add column b int; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN alter table t1 add column b int; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename table t1 to t2; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN rename table t1 to t2; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN truncate table t1; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN truncate table t1; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop table t1; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop table t1; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop index t1_i on t1; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop index t1_i on t1; return 1; END |
|
||||
|
||||
-- error ER_SP_BADSTATEMENT
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN unlock tables; END |
|
||||
-- error ER_SP_BADSTATEMENT
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN unlock tables; return 1; END |
|
||||
|
||||
-- error ER_SP_BADSTATEMENT
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN LOCK TABLE t1 READ; END |
|
||||
-- error ER_SP_BADSTATEMENT
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN LOCK TABLE t1 READ; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create database mysqltest; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create database mysqltest; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop database mysqltest; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop database mysqltest; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest_1'; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as select 1; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END |
|
||||
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop view v1; END |
|
||||
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop view v1; return 1; END |
|
||||
|
||||
-- error ER_SP_NO_RECURSIVE_CREATE
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create trigger tr2 before insert on t1 for each row do select 1; END |
|
||||
-- error ER_SP_NO_RECURSIVE_CREATE
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create trigger tr2 before insert on t1 for each row do select 1; return 1; END |
|
||||
|
||||
-- error ER_SP_NO_DROP_SP
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop function bug_13627_f; END |
|
||||
-- error ER_SP_NO_DROP_SP
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop function bug_13627_f; return 1; END |
|
||||
|
||||
-- error ER_SP_NO_RECURSIVE_CREATE
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create function f2 () returns int return 1; END |
|
||||
-- error ER_SP_NO_RECURSIVE_CREATE
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create function f2 () returns int return 1; return 1; END |
|
||||
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
CREATE TEMPORARY TABLE t2 (a int);
|
||||
DROP TEMPORARY TABLE t2;
|
||||
END |
|
||||
CREATE FUNCTION bug_13627_f() returns int
|
||||
BEGIN
|
||||
CREATE TEMPORARY TABLE t2 (a int);
|
||||
DROP TEMPORARY TABLE t2;
|
||||
return 1;
|
||||
END |
|
||||
|
||||
drop table t1|
|
||||
drop function bug_13627_f|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
# BUG#12329: "Bogus error msg when executing PS with stored procedure after
|
||||
# SP was re-created". See also test for related bug#13399 in trigger.test
|
||||
--disable_warnings
|
||||
drop function if exists bug12329;
|
||||
--enable_warnings
|
||||
create table t1 as select 1 a;
|
||||
create table t2 as select 1 a;
|
||||
create function bug12329() returns int return (select a from t1);
|
||||
prepare stmt1 from 'select bug12329()';
|
||||
execute stmt1;
|
||||
drop function bug12329;
|
||||
create function bug12329() returns int return (select a+100 from t2);
|
||||
select bug12329();
|
||||
# Until we implement proper mechanism for invalidation of PS/SP when table
|
||||
# or SP's are changed the following statement will fail with 'Table ... was
|
||||
# not locked' error (this mechanism should be based on the new TDC).
|
||||
--error 1100
|
||||
execute stmt1;
|
||||
deallocate prepare stmt1;
|
||||
drop function bug12329;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug#13514 "server crash when create a stored procedure before choose a
|
||||
# database" and
|
||||
|
|
|
@ -4541,6 +4541,59 @@ drop table t3, t4|
|
|||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
|
||||
|
||||
#
|
||||
# BUG#1473: Dumping of stored functions seems to cause corruption in
|
||||
# the function body
|
||||
#
|
||||
--disable_warnings
|
||||
drop function if exists bug14723|
|
||||
drop procedure if exists bug14723|
|
||||
--enable_warnings
|
||||
|
||||
delimiter ;;|
|
||||
/*!50003 create function bug14723()
|
||||
returns bigint(20)
|
||||
main_loop: begin
|
||||
return 42;
|
||||
end */;;
|
||||
show create function bug14723;;
|
||||
select bug14723();;
|
||||
|
||||
/*!50003 create procedure bug14723()
|
||||
main_loop: begin
|
||||
select 42;
|
||||
end */;;
|
||||
show create procedure bug14723;;
|
||||
call bug14723();;
|
||||
|
||||
delimiter |;;
|
||||
|
||||
drop function bug14723|
|
||||
drop procedure bug14723|
|
||||
|
||||
#
|
||||
# Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA when COUNT(*) is 0"
|
||||
# Check that when fetching from a cursor, COUNT(*) works properly.
|
||||
#
|
||||
create procedure bug14845()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select count(*) from t1 where 1 = 0;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
select a;
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14845()|
|
||||
drop procedure bug14845|
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
|
|
@ -875,3 +875,42 @@ drop function f1;
|
|||
drop view v1;
|
||||
drop table t1, t2, t3;
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# Test for bug #13399 "Crash when executing PS/SP which should activate
|
||||
# trigger which is now dropped". See also test for similar bug for stored
|
||||
# routines in sp-error.test (#12329).
|
||||
create table t1 (id int);
|
||||
create table t2 (id int);
|
||||
create trigger t1_bi before insert on t1 for each row insert into t2 values (new.id);
|
||||
prepare stmt1 from "insert into t1 values (10)";
|
||||
create procedure p1() insert into t1 values (10);
|
||||
call p1();
|
||||
# Actually it is enough to do FLUSH TABLES instead of DROP TRIGGER
|
||||
drop trigger t1_bi;
|
||||
# Server should not crash on these two statements
|
||||
execute stmt1;
|
||||
call p1();
|
||||
deallocate prepare stmt1;
|
||||
drop procedure p1;
|
||||
|
||||
# Let us test more complex situation when we alter trigger in such way that
|
||||
# it uses different set of tables (or simply add new trigger).
|
||||
create table t3 (id int);
|
||||
create trigger t1_bi after insert on t1 for each row insert into t2 values (new.id);
|
||||
prepare stmt1 from "insert into t1 values (10)";
|
||||
create procedure p1() insert into t1 values (10);
|
||||
call p1();
|
||||
# Altering trigger forcing it use different set of tables
|
||||
drop trigger t1_bi;
|
||||
create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id);
|
||||
# Until we implement proper mechanism for invalidation of PS/SP when table
|
||||
# or SP's are changed these two statements will fail with 'Table ... was
|
||||
# not locked' error (this mechanism should be based on the new TDC).
|
||||
--error 1100
|
||||
execute stmt1;
|
||||
--error 1100
|
||||
call p1();
|
||||
deallocate prepare stmt1;
|
||||
drop procedure p1;
|
||||
drop table t1, t2, t3;
|
||||
|
|
|
@ -147,11 +147,9 @@ insert into t1 values (1), (2), (3);
|
|||
create view v1 (a) as select a+1 from t1;
|
||||
create view v2 (a) as select a-1 from t1;
|
||||
|
||||
--disable_parsing # WL #2486 should enable these tests
|
||||
select * from t1 natural left join v1;
|
||||
select * from v2 natural left join t1;
|
||||
select * from v2 natural left join v1;
|
||||
--enable_parsing
|
||||
|
||||
drop view v1, v2;
|
||||
drop table t1;
|
||||
|
@ -2194,6 +2192,15 @@ DROP VIEW v1,v2;
|
|||
DROP TABLE t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug #13622 Wrong view .frm created if some field's alias contain \n
|
||||
#
|
||||
create table t1 (f1 int);
|
||||
create view v1 as select t1.f1 as '123
|
||||
456' from t1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
# Bug #14466 lost sort order in GROUP_CONCAT() in a view
|
||||
#
|
||||
create table t1 (f1 int, f2 int);
|
||||
|
@ -2257,3 +2264,23 @@ drop view v1;
|
|||
create definer = current_user sql security invoker view v1 as select 1;
|
||||
show create view v1;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# Bug #14816 test_if_order_by_key() expected only Item_fields.
|
||||
#
|
||||
create table t1 (id INT, primary key(id));
|
||||
insert into t1 values (1),(2);
|
||||
create view v1 as select * from t1;
|
||||
explain select id from v1 order by id;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #14850 Item_ref's values wasn't updated
|
||||
#
|
||||
create table t1(f1 int, f2 int);
|
||||
insert into t1 values (null, 10), (null,2);
|
||||
create view v1 as select * from t1;
|
||||
select f1, sum(f2) from v1 group by f1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -249,7 +249,8 @@ ha_archive::ha_archive(TABLE *table_arg)
|
|||
buffer.set((char *)byte_buffer, IO_SIZE, system_charset_info);
|
||||
|
||||
/* The size of the offset value we will use for position() */
|
||||
ref_length = sizeof(z_off_t);
|
||||
ref_length = 2 << ((zlibCompileFlags() >> 6) & 3);
|
||||
DBUG_ASSERT(ref_length <= sizeof(z_off_t));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -141,15 +141,16 @@ uint innobase_init_flags = 0;
|
|||
ulong innobase_cache_size = 0;
|
||||
ulong innobase_large_page_size = 0;
|
||||
|
||||
/* The default values for the following, type long, start-up parameters
|
||||
are declared in mysqld.cc: */
|
||||
/* The default values for the following, type long or longlong, start-up
|
||||
parameters are declared in mysqld.cc: */
|
||||
|
||||
long innobase_mirrored_log_groups, innobase_log_files_in_group,
|
||||
innobase_log_file_size, innobase_log_buffer_size,
|
||||
innobase_buffer_pool_awe_mem_mb,
|
||||
innobase_buffer_pool_size, innobase_additional_mem_pool_size,
|
||||
innobase_file_io_threads, innobase_lock_wait_timeout,
|
||||
innobase_force_recovery, innobase_open_files;
|
||||
innobase_log_buffer_size, innobase_buffer_pool_awe_mem_mb,
|
||||
innobase_additional_mem_pool_size, innobase_file_io_threads,
|
||||
innobase_lock_wait_timeout, innobase_force_recovery,
|
||||
innobase_open_files;
|
||||
|
||||
longlong innobase_buffer_pool_size, innobase_log_file_size;
|
||||
|
||||
/* The default values for the following char* start-up parameters
|
||||
are determined in innobase_init below: */
|
||||
|
@ -1231,6 +1232,25 @@ innobase_init(void)
|
|||
|
||||
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
|
||||
|
||||
/* Check that values don't overflow on 32-bit systems. */
|
||||
if (sizeof(ulint) == 4) {
|
||||
if (innobase_buffer_pool_size > UINT_MAX32) {
|
||||
sql_print_error(
|
||||
"innobase_buffer_pool_size can't be over 4GB"
|
||||
" on 32-bit systems");
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
if (innobase_log_file_size > UINT_MAX32) {
|
||||
sql_print_error(
|
||||
"innobase_log_file_size can't be over 4GB"
|
||||
" on 32-bit systems");
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
}
|
||||
|
||||
os_innodb_umask = (ulint)my_umask;
|
||||
|
||||
/* First calculate the default path for innodb_data_home_dir etc.,
|
||||
|
|
|
@ -218,8 +218,9 @@ extern ulong innobase_large_page_size;
|
|||
extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
|
||||
extern long innobase_lock_scan_time;
|
||||
extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
|
||||
extern long innobase_log_file_size, innobase_log_buffer_size;
|
||||
extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size;
|
||||
extern longlong innobase_buffer_pool_size, innobase_log_file_size;
|
||||
extern long innobase_log_buffer_size;
|
||||
extern long innobase_additional_mem_pool_size;
|
||||
extern long innobase_buffer_pool_awe_mem_mb;
|
||||
extern long innobase_file_io_threads, innobase_lock_wait_timeout;
|
||||
extern long innobase_force_recovery;
|
||||
|
|
|
@ -1603,7 +1603,11 @@ public:
|
|||
void make_field(Send_field *field);
|
||||
bool fix_fields(THD *, Item **);
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); }
|
||||
void save_org_in_field(Field *field)
|
||||
{
|
||||
(*ref)->save_org_in_field(field);
|
||||
null_value= (*ref)->null_value;
|
||||
}
|
||||
enum Item_result result_type () const { return (*ref)->result_type(); }
|
||||
enum_field_types field_type() const { return (*ref)->field_type(); }
|
||||
Field *get_tmp_table_field()
|
||||
|
|
18
sql/lock.cc
18
sql/lock.cc
|
@ -814,10 +814,13 @@ static void print_lock_error(int error, const char *table)
|
|||
|
||||
access to them is protected with a mutex LOCK_global_read_lock
|
||||
|
||||
(XXX: one should never take LOCK_open if LOCK_global_read_lock is taken,
|
||||
otherwise a deadlock may occur - see mysql_rm_table. Other mutexes could
|
||||
be a problem too - grep the code for global_read_lock if you want to use
|
||||
any other mutex here)
|
||||
(XXX: one should never take LOCK_open if LOCK_global_read_lock is
|
||||
taken, otherwise a deadlock may occur. Other mutexes could be a
|
||||
problem too - grep the code for global_read_lock if you want to use
|
||||
any other mutex here) Also one must not hold LOCK_open when calling
|
||||
wait_if_global_read_lock(). When the thread with the global read lock
|
||||
tries to close its tables, it needs to take LOCK_open in
|
||||
close_thread_table().
|
||||
|
||||
How blocking of threads by global read lock is achieved: that's
|
||||
advisory. Any piece of code which should be blocked by global read lock must
|
||||
|
@ -936,6 +939,13 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
|
|||
DBUG_ENTER("wait_if_global_read_lock");
|
||||
|
||||
LINT_INIT(old_message);
|
||||
/*
|
||||
Assert that we do not own LOCK_open. If we would own it, other
|
||||
threads could not close their tables. This would make a pretty
|
||||
deadlock.
|
||||
*/
|
||||
safe_mutex_assert_not_owner(&LOCK_open);
|
||||
|
||||
(void) pthread_mutex_lock(&LOCK_global_read_lock);
|
||||
if ((need_exit_cond= must_wait))
|
||||
{
|
||||
|
|
|
@ -912,7 +912,8 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen);
|
|||
bool mysql_ha_close(THD *thd, TABLE_LIST *tables);
|
||||
bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
|
||||
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
|
||||
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags);
|
||||
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
|
||||
bool is_locked);
|
||||
/* mysql_ha_flush mode_flags bits */
|
||||
#define MYSQL_HA_CLOSE_FINAL 0x00
|
||||
#define MYSQL_HA_REOPEN_ON_USAGE 0x01
|
||||
|
|
|
@ -5529,7 +5529,8 @@ log and this option does nothing anymore.",
|
|||
{"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE,
|
||||
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
|
||||
(gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0,
|
||||
GET_LONG, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, ~0L, 0, 1024*1024L, 0},
|
||||
GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0,
|
||||
1024*1024L, 0},
|
||||
{"innodb_concurrency_tickets", OPT_INNODB_CONCURRENCY_TICKETS,
|
||||
"Number of times a thread is allowed to enter InnoDB within the same \
|
||||
SQL query after it has once got the ticket",
|
||||
|
@ -5553,9 +5554,10 @@ log and this option does nothing anymore.",
|
|||
(gptr*) &innobase_log_buffer_size, (gptr*) &innobase_log_buffer_size, 0,
|
||||
GET_LONG, REQUIRED_ARG, 1024*1024L, 256*1024L, ~0L, 0, 1024, 0},
|
||||
{"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE,
|
||||
"Size of each log file in a log group in megabytes.",
|
||||
"Size of each log file in a log group.",
|
||||
(gptr*) &innobase_log_file_size, (gptr*) &innobase_log_file_size, 0,
|
||||
GET_LONG, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, ~0L, 0, 1024*1024L, 0},
|
||||
GET_LL, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, LONGLONG_MAX, 0,
|
||||
1024*1024L, 0},
|
||||
{"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP,
|
||||
"Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.",
|
||||
(gptr*) &innobase_log_files_in_group, (gptr*) &innobase_log_files_in_group,
|
||||
|
|
|
@ -693,7 +693,7 @@ struct show_var_st init_vars[]= {
|
|||
{"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG },
|
||||
{sys_innodb_autoextend_increment.name, (char*) &sys_innodb_autoextend_increment, SHOW_SYS},
|
||||
{"innodb_buffer_pool_awe_mem_mb", (char*) &innobase_buffer_pool_awe_mem_mb, SHOW_LONG },
|
||||
{"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG },
|
||||
{"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONGLONG },
|
||||
{"innodb_checksums", (char*) &innobase_use_checksums, SHOW_MY_BOOL},
|
||||
{sys_innodb_commit_concurrency.name, (char*) &sys_innodb_commit_concurrency, SHOW_SYS},
|
||||
{sys_innodb_concurrency_tickets.name, (char*) &sys_innodb_concurrency_tickets, SHOW_SYS},
|
||||
|
@ -711,7 +711,7 @@ struct show_var_st init_vars[]= {
|
|||
{"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR},
|
||||
{"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL},
|
||||
{"innodb_log_buffer_size", (char*) &innobase_log_buffer_size, SHOW_LONG },
|
||||
{"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONG},
|
||||
{"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONGLONG},
|
||||
{"innodb_log_files_in_group", (char*) &innobase_log_files_in_group, SHOW_LONG},
|
||||
{"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
|
||||
{sys_innodb_max_dirty_pages_pct.name, (char*) &sys_innodb_max_dirty_pages_pct, SHOW_SYS},
|
||||
|
|
|
@ -120,6 +120,45 @@ sp_get_flags_for_command(LEX *lex)
|
|||
case SQLCOM_DEALLOCATE_PREPARE:
|
||||
flags= sp_head::CONTAINS_DYNAMIC_SQL;
|
||||
break;
|
||||
case SQLCOM_CREATE_TABLE:
|
||||
if (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)
|
||||
flags= 0;
|
||||
else
|
||||
flags= sp_head::HAS_COMMIT_OR_ROLLBACK;
|
||||
break;
|
||||
case SQLCOM_DROP_TABLE:
|
||||
if (lex->drop_temporary)
|
||||
flags= 0;
|
||||
else
|
||||
flags= sp_head::HAS_COMMIT_OR_ROLLBACK;
|
||||
break;
|
||||
case SQLCOM_CREATE_INDEX:
|
||||
case SQLCOM_CREATE_DB:
|
||||
case SQLCOM_CREATE_VIEW:
|
||||
case SQLCOM_CREATE_TRIGGER:
|
||||
case SQLCOM_CREATE_USER:
|
||||
case SQLCOM_ALTER_TABLE:
|
||||
case SQLCOM_BEGIN:
|
||||
case SQLCOM_RENAME_TABLE:
|
||||
case SQLCOM_RENAME_USER:
|
||||
case SQLCOM_DROP_INDEX:
|
||||
case SQLCOM_DROP_DB:
|
||||
case SQLCOM_DROP_USER:
|
||||
case SQLCOM_DROP_VIEW:
|
||||
case SQLCOM_DROP_TRIGGER:
|
||||
case SQLCOM_TRUNCATE:
|
||||
case SQLCOM_COMMIT:
|
||||
case SQLCOM_ROLLBACK:
|
||||
case SQLCOM_LOAD_MASTER_DATA:
|
||||
case SQLCOM_LOCK_TABLES:
|
||||
case SQLCOM_CREATE_PROCEDURE:
|
||||
case SQLCOM_CREATE_SPFUNCTION:
|
||||
case SQLCOM_ALTER_PROCEDURE:
|
||||
case SQLCOM_ALTER_FUNCTION:
|
||||
case SQLCOM_DROP_PROCEDURE:
|
||||
case SQLCOM_DROP_FUNCTION:
|
||||
flags= sp_head::HAS_COMMIT_OR_ROLLBACK;
|
||||
break;
|
||||
default:
|
||||
flags= 0;
|
||||
break;
|
||||
|
@ -476,7 +515,7 @@ void
|
|||
sp_head::init_strings(THD *thd, LEX *lex, sp_name *name)
|
||||
{
|
||||
DBUG_ENTER("sp_head::init_strings");
|
||||
uint n; /* Counter for nul trimming */
|
||||
uchar *endp; /* Used to trim the end */
|
||||
/* During parsing, we must use thd->mem_root */
|
||||
MEM_ROOT *root= thd->mem_root;
|
||||
|
||||
|
@ -509,17 +548,20 @@ sp_head::init_strings(THD *thd, LEX *lex, sp_name *name)
|
|||
(char *)m_param_begin, m_params.length);
|
||||
}
|
||||
|
||||
m_body.length= lex->ptr - m_body_begin;
|
||||
/* Trim nuls at the end */
|
||||
n= 0;
|
||||
while (m_body.length && m_body_begin[m_body.length-1] == '\0')
|
||||
{
|
||||
m_body.length-= 1;
|
||||
n+= 1;
|
||||
}
|
||||
/* If ptr has overrun end_of_query then end_of_query is the end */
|
||||
endp= (lex->ptr > lex->end_of_query ? lex->end_of_query : lex->ptr);
|
||||
/*
|
||||
Trim "garbage" at the end. This is sometimes needed with the
|
||||
"/ * ! VERSION... * /" wrapper in dump files.
|
||||
*/
|
||||
while (m_body_begin < endp &&
|
||||
(endp[-1] <= ' ' || endp[-1] == '*' ||
|
||||
endp[-1] == '/' || endp[-1] == ';'))
|
||||
endp-= 1;
|
||||
|
||||
m_body.length= endp - m_body_begin;
|
||||
m_body.str= strmake_root(root, (char *)m_body_begin, m_body.length);
|
||||
m_defstr.length= lex->ptr - lex->buf;
|
||||
m_defstr.length-= n;
|
||||
m_defstr.length= endp - lex->buf;
|
||||
m_defstr.str= strmake_root(root, (char *)lex->buf, m_defstr.length);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -2864,33 +2906,34 @@ sp_head::add_used_tables_to_table_list(THD *thd,
|
|||
DBUG_ENTER("sp_head::add_used_tables_to_table_list");
|
||||
|
||||
/*
|
||||
Use persistent arena for table list allocation to be PS friendly.
|
||||
Use persistent arena for table list allocation to be PS/SP friendly.
|
||||
Note that we also have to copy database/table names and alias to PS/SP
|
||||
memory since current instance of sp_head object can pass away before
|
||||
next execution of PS/SP for which tables are added to prelocking list.
|
||||
This will be fixed by introducing of proper invalidation mechanism
|
||||
once new TDC is ready.
|
||||
*/
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
|
||||
for (i=0 ; i < m_sptabs.records ; i++)
|
||||
{
|
||||
char *tab_buff;
|
||||
char *tab_buff, *key_buff;
|
||||
TABLE_LIST *table;
|
||||
SP_TABLE *stab= (SP_TABLE *)hash_element(&m_sptabs, i);
|
||||
if (stab->temp)
|
||||
continue;
|
||||
|
||||
if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) *
|
||||
stab->lock_count)))
|
||||
stab->lock_count)) ||
|
||||
!(key_buff= (char*)thd->memdup(stab->qname.str,
|
||||
stab->qname.length + 1)))
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
for (uint j= 0; j < stab->lock_count; j++)
|
||||
{
|
||||
table= (TABLE_LIST *)tab_buff;
|
||||
|
||||
/*
|
||||
It's enough to just copy the pointers as the data will not change
|
||||
during the lifetime of the SP. If the SP is used by PS, we assume
|
||||
that the PS will be invalidated if the functions is deleted or
|
||||
changed.
|
||||
*/
|
||||
table->db= stab->qname.str;
|
||||
table->db= key_buff;
|
||||
table->db_length= stab->db_length;
|
||||
table->table_name= table->db + table->db_length + 1;
|
||||
table->table_name_length= stab->table_name_length;
|
||||
|
|
|
@ -115,10 +115,13 @@ public:
|
|||
MULTI_RESULTS= 8, // Is set if a procedure with SELECT(s)
|
||||
CONTAINS_DYNAMIC_SQL= 16, // Is set if a procedure with PREPARE/EXECUTE
|
||||
IS_INVOKED= 32, // Is set if this sp_head is being used
|
||||
HAS_SET_AUTOCOMMIT_STMT = 64 // Is set if a procedure with 'set autocommit'
|
||||
HAS_SET_AUTOCOMMIT_STMT= 64,// Is set if a procedure with 'set autocommit'
|
||||
/* Is set if a procedure with COMMIT (implicit or explicit) | ROLLBACK */
|
||||
HAS_COMMIT_OR_ROLLBACK= 128
|
||||
};
|
||||
|
||||
int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE
|
||||
/* TYPE_ENUM_FUNCTION, TYPE_ENUM_PROCEDURE or TYPE_ENUM_TRIGGER */
|
||||
int m_type;
|
||||
uint m_flags; // Boolean attributes of a stored routine
|
||||
enum enum_field_types m_returns; // For FUNCTIONs only
|
||||
Field::geometry_type m_geom_returns;
|
||||
|
@ -292,6 +295,12 @@ public:
|
|||
my_error(ER_SP_NO_RETSET, MYF(0), where);
|
||||
else if (m_flags & HAS_SET_AUTOCOMMIT_STMT)
|
||||
my_error(ER_SP_CANT_SET_AUTOCOMMIT, MYF(0));
|
||||
else if (m_type != TYPE_ENUM_PROCEDURE &&
|
||||
(m_flags & sp_head::HAS_COMMIT_OR_ROLLBACK))
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
return TRUE;
|
||||
}
|
||||
return test(m_flags &
|
||||
(CONTAINS_DYNAMIC_SQL|MULTI_RESULTS|HAS_SET_AUTOCOMMIT_STMT));
|
||||
}
|
||||
|
|
|
@ -311,7 +311,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
|
|||
thd->proc_info="Flushing tables";
|
||||
|
||||
close_old_data_files(thd,thd->open_tables,1,1);
|
||||
mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL);
|
||||
mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL,
|
||||
TRUE);
|
||||
bool found=1;
|
||||
/* Wait until all threads has closed all the tables we had locked */
|
||||
DBUG_PRINT("info",
|
||||
|
@ -1238,7 +1239,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
|||
|
||||
/* close handler tables which are marked for flush */
|
||||
if (thd->handler_tables)
|
||||
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE);
|
||||
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE);
|
||||
|
||||
for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ;
|
||||
table && table->in_use ;
|
||||
|
@ -1642,7 +1643,7 @@ bool wait_for_tables(THD *thd)
|
|||
{
|
||||
thd->some_tables_deleted=0;
|
||||
close_old_data_files(thd,thd->open_tables,0,dropping_tables != 0);
|
||||
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE);
|
||||
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE);
|
||||
if (!table_is_used(thd->open_tables,1))
|
||||
break;
|
||||
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
|
||||
|
|
|
@ -376,7 +376,7 @@ void THD::cleanup(void)
|
|||
close_thread_tables(this);
|
||||
}
|
||||
mysql_ha_flush(this, (TABLE_LIST*) 0,
|
||||
MYSQL_HA_CLOSE_FINAL | MYSQL_HA_FLUSH_ALL);
|
||||
MYSQL_HA_CLOSE_FINAL | MYSQL_HA_FLUSH_ALL, FALSE);
|
||||
hash_free(&handler_tables_hash);
|
||||
delete_dynamic(&user_var_events);
|
||||
hash_free(&user_vars);
|
||||
|
|
|
@ -336,6 +336,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||
ha_rows select_limit_cnt, ha_rows offset_limit_cnt)
|
||||
{
|
||||
TABLE_LIST *hash_tables;
|
||||
TABLE **table_ptr;
|
||||
TABLE *table;
|
||||
MYSQL_LOCK *lock;
|
||||
List<Item> list;
|
||||
|
@ -368,6 +369,28 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||
DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p",
|
||||
hash_tables->db, hash_tables->table_name,
|
||||
hash_tables->alias, table));
|
||||
/* Table might have been flushed. */
|
||||
if (table && (table->s->version != refresh_version))
|
||||
{
|
||||
/*
|
||||
We must follow the thd->handler_tables chain, as we need the
|
||||
address of the 'next' pointer referencing this table
|
||||
for close_thread_table().
|
||||
*/
|
||||
for (table_ptr= &(thd->handler_tables);
|
||||
*table_ptr && (*table_ptr != table);
|
||||
table_ptr= &(*table_ptr)->next)
|
||||
{}
|
||||
(*table_ptr)->file->ha_index_or_rnd_end();
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
if (close_thread_table(thd, table_ptr))
|
||||
{
|
||||
/* Tell threads waiting for refresh that something has happened */
|
||||
VOID(pthread_cond_broadcast(&COND_refresh));
|
||||
}
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
table= hash_tables->table= NULL;
|
||||
}
|
||||
if (!table)
|
||||
{
|
||||
/*
|
||||
|
@ -594,6 +617,7 @@ err0:
|
|||
MYSQL_HA_REOPEN_ON_USAGE mark for reopen.
|
||||
MYSQL_HA_FLUSH_ALL flush all tables, not only
|
||||
those marked for flush.
|
||||
is_locked If LOCK_open is locked.
|
||||
|
||||
DESCRIPTION
|
||||
The list of HANDLER tables may be NULL, in which case all HANDLER
|
||||
|
@ -601,7 +625,6 @@ err0:
|
|||
If 'tables' is NULL and MYSQL_HA_FLUSH_ALL is not set,
|
||||
all HANDLER tables marked for flush are closed.
|
||||
Broadcasts a COND_refresh condition, for every table closed.
|
||||
The caller must lock LOCK_open.
|
||||
|
||||
NOTE
|
||||
Since mysql_ha_flush() is called when the base table has to be closed,
|
||||
|
@ -611,10 +634,12 @@ err0:
|
|||
0 ok
|
||||
*/
|
||||
|
||||
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
|
||||
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
|
||||
bool is_locked)
|
||||
{
|
||||
TABLE_LIST *tmp_tables;
|
||||
TABLE **table_ptr;
|
||||
bool did_lock= FALSE;
|
||||
DBUG_ENTER("mysql_ha_flush");
|
||||
DBUG_PRINT("enter", ("tables: %p mode_flags: 0x%02x", tables, mode_flags));
|
||||
|
||||
|
@ -640,6 +665,12 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
|
|||
(*table_ptr)->s->db,
|
||||
(*table_ptr)->s->table_name,
|
||||
(*table_ptr)->alias));
|
||||
/* The first time it is required, lock for close_thread_table(). */
|
||||
if (! did_lock && ! is_locked)
|
||||
{
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
did_lock= TRUE;
|
||||
}
|
||||
mysql_ha_flush_table(thd, table_ptr, mode_flags);
|
||||
continue;
|
||||
}
|
||||
|
@ -658,6 +689,12 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
|
|||
if ((mode_flags & MYSQL_HA_FLUSH_ALL) ||
|
||||
((*table_ptr)->s->version != refresh_version))
|
||||
{
|
||||
/* The first time it is required, lock for close_thread_table(). */
|
||||
if (! did_lock && ! is_locked)
|
||||
{
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
did_lock= TRUE;
|
||||
}
|
||||
mysql_ha_flush_table(thd, table_ptr, mode_flags);
|
||||
continue;
|
||||
}
|
||||
|
@ -665,6 +702,10 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
|
|||
}
|
||||
}
|
||||
|
||||
/* Release the lock if it was taken by this function. */
|
||||
if (did_lock)
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -696,8 +737,8 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
|
|||
table->alias, mode_flags));
|
||||
|
||||
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
|
||||
(byte*) (*table_ptr)->alias,
|
||||
strlen((*table_ptr)->alias) + 1)))
|
||||
(byte*) table->alias,
|
||||
strlen(table->alias) + 1)))
|
||||
{
|
||||
if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE))
|
||||
{
|
||||
|
@ -711,7 +752,9 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
|
|||
}
|
||||
}
|
||||
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
(*table_ptr)->file->ha_index_or_rnd_end();
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
if (close_thread_table(thd, table_ptr))
|
||||
{
|
||||
/* Tell threads waiting for refresh that something has happened */
|
||||
|
|
|
@ -2398,18 +2398,6 @@ mysql_execute_command(THD *thd)
|
|||
reset_one_shot_variables(thd);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#ifndef TO_BE_DELETED
|
||||
/*
|
||||
This is a workaround to deal with the shortcoming in 3.23.44-3.23.46
|
||||
masters in RELEASE_LOCK() logging. We re-write SELECT RELEASE_LOCK()
|
||||
as DO RELEASE_LOCK()
|
||||
*/
|
||||
if (lex->sql_command == SQLCOM_SELECT)
|
||||
{
|
||||
lex->sql_command = SQLCOM_DO;
|
||||
lex->insert_list = &select_lex->item_list;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_REPLICATION */
|
||||
|
|
|
@ -1829,13 +1829,16 @@ static bool init_param_array(Prepared_statement *stmt)
|
|||
|
||||
void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
|
||||
{
|
||||
Prepared_statement *stmt= new Prepared_statement(thd, &thd->protocol_prep);
|
||||
Prepared_statement *stmt;
|
||||
bool error;
|
||||
DBUG_ENTER("mysql_stmt_prepare");
|
||||
|
||||
DBUG_PRINT("prep_query", ("%s", packet));
|
||||
|
||||
if (stmt == 0)
|
||||
/* First of all clear possible warnings from the previous command */
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
|
||||
if (! (stmt= new Prepared_statement(thd, &thd->protocol_prep)))
|
||||
DBUG_VOID_RETURN; /* out of memory: error is set in Sql_alloc */
|
||||
|
||||
if (thd->stmt_map.insert(stmt))
|
||||
|
@ -1844,7 +1847,6 @@ void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
|
|||
DBUG_VOID_RETURN; /* out of memory */
|
||||
}
|
||||
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
/* Reset warnings from previous command */
|
||||
mysql_reset_errors(thd, 0);
|
||||
sp_cache_flush_obsolete(&thd->sp_proc_cache);
|
||||
|
@ -2188,13 +2190,15 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
|
|||
|
||||
packet+= 9; /* stmt_id + 5 bytes of flags */
|
||||
|
||||
/* First of all clear possible warnings from the previous command */
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute")))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
DBUG_PRINT("exec_query", ("%s", stmt->query));
|
||||
DBUG_PRINT("info",("stmt: %p", stmt));
|
||||
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
sp_cache_flush_obsolete(&thd->sp_proc_cache);
|
||||
sp_cache_flush_obsolete(&thd->sp_func_cache);
|
||||
|
||||
|
@ -2314,6 +2318,8 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
|
|||
Server_side_cursor *cursor;
|
||||
DBUG_ENTER("mysql_stmt_fetch");
|
||||
|
||||
/* First of all clear possible warnings from the previous command */
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
statistic_increment(thd->status_var.com_stmt_fetch, &LOCK_status);
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_fetch")))
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -2375,6 +2381,9 @@ void mysql_stmt_reset(THD *thd, char *packet)
|
|||
Prepared_statement *stmt;
|
||||
DBUG_ENTER("mysql_stmt_reset");
|
||||
|
||||
/* First of all clear possible warnings from the previous command */
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
|
||||
statistic_increment(thd->status_var.com_stmt_reset, &LOCK_status);
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset")))
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -2389,7 +2398,6 @@ void mysql_stmt_reset(THD *thd, char *packet)
|
|||
|
||||
stmt->state= Query_arena::PREPARED;
|
||||
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
send_ok(thd);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
|
@ -11011,7 +11011,7 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
|
|||
|
||||
for (; order ; order=order->next, const_key_parts>>=1)
|
||||
{
|
||||
Field *field=((Item_field*) (*order->item))->field;
|
||||
Field *field=((Item_field*) (*order->item)->real_item())->field;
|
||||
int flag;
|
||||
|
||||
/*
|
||||
|
@ -11151,8 +11151,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
|||
DBUG_ENTER("test_if_skip_sort_order");
|
||||
LINT_INIT(ref_key_parts);
|
||||
|
||||
/* Check which keys can be used to resolve ORDER BY */
|
||||
usable_keys.set_all();
|
||||
/*
|
||||
Check which keys can be used to resolve ORDER BY.
|
||||
We must not try to use disabled keys.
|
||||
*/
|
||||
usable_keys= table->s->keys_in_use;
|
||||
|
||||
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
|
||||
{
|
||||
Item *item= (*tmp_order->item)->real_item();
|
||||
|
|
|
@ -1470,7 +1470,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
|||
case SHOW_SLAVE_RUNNING:
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_active_mi);
|
||||
end= strmov(buff, (active_mi->slave_running &&
|
||||
end= strmov(buff, (active_mi && active_mi->slave_running &&
|
||||
active_mi->rli.slave_running) ? "ON" : "OFF");
|
||||
pthread_mutex_unlock(&LOCK_active_mi);
|
||||
break;
|
||||
|
@ -1481,12 +1481,15 @@ static bool show_status_array(THD *thd, const char *wild,
|
|||
TODO: in 5.1 with multimaster, have one such counter per line in
|
||||
SHOW SLAVE STATUS, and have the sum over all lines here.
|
||||
*/
|
||||
pthread_mutex_lock(&LOCK_active_mi);
|
||||
pthread_mutex_lock(&active_mi->rli.data_lock);
|
||||
end= int10_to_str(active_mi->rli.retried_trans, buff, 10);
|
||||
pthread_mutex_unlock(&active_mi->rli.data_lock);
|
||||
pthread_mutex_unlock(&LOCK_active_mi);
|
||||
break;
|
||||
pthread_mutex_lock(&LOCK_active_mi);
|
||||
if (active_mi)
|
||||
{
|
||||
pthread_mutex_lock(&active_mi->rli.data_lock);
|
||||
end= int10_to_str(active_mi->rli.retried_trans, buff, 10);
|
||||
pthread_mutex_unlock(&active_mi->rli.data_lock);
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_active_mi);
|
||||
break;
|
||||
}
|
||||
case SHOW_SLAVE_SKIP_ERRORS:
|
||||
{
|
||||
|
|
|
@ -159,23 +159,28 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
|||
|
||||
/* mark for close and remove all cached entries */
|
||||
|
||||
thd->mysys_var->current_mutex= &LOCK_open;
|
||||
thd->mysys_var->current_cond= &COND_refresh;
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
|
||||
if (!drop_temporary)
|
||||
{
|
||||
if ((error= wait_if_global_read_lock(thd, 0, 1)))
|
||||
{
|
||||
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), tables->table_name);
|
||||
goto err;
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
else
|
||||
need_start_waiters= TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
Acquire LOCK_open after wait_if_global_read_lock(). If we would hold
|
||||
LOCK_open during wait_if_global_read_lock(), other threads could not
|
||||
close their tables. This would make a pretty deadlock.
|
||||
*/
|
||||
thd->mysys_var->current_mutex= &LOCK_open;
|
||||
thd->mysys_var->current_cond= &COND_refresh;
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
|
||||
error= mysql_rm_table_part2(thd, tables, if_exists, drop_temporary, 0, 0);
|
||||
|
||||
err:
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
|
||||
pthread_mutex_lock(&thd->mysys_var->mutex);
|
||||
|
@ -288,7 +293,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||
char *db=table->db;
|
||||
db_type table_type= DB_TYPE_UNKNOWN;
|
||||
|
||||
mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL);
|
||||
mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL, TRUE);
|
||||
if (!close_temporary_table(thd, db, table->table_name))
|
||||
{
|
||||
tmp_table_deleted=1;
|
||||
|
@ -2313,7 +2318,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
mysql_ha_flush(thd, tables, MYSQL_HA_CLOSE_FINAL);
|
||||
mysql_ha_flush(thd, tables, MYSQL_HA_CLOSE_FINAL, FALSE);
|
||||
for (table= tables; table; table= table->next_local)
|
||||
{
|
||||
char table_name[NAME_LEN*2+2];
|
||||
|
@ -3426,8 +3431,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
if (!new_db || !my_strcasecmp(table_alias_charset, new_db, db))
|
||||
new_db= db;
|
||||
used_fields=create_info->used_fields;
|
||||
|
||||
mysql_ha_flush(thd, table_list, MYSQL_HA_CLOSE_FINAL, FALSE);
|
||||
|
||||
mysql_ha_flush(thd, table_list, MYSQL_HA_CLOSE_FINAL);
|
||||
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
|
||||
if (alter_info->tablespace_op != NO_TABLESPACE_OP)
|
||||
DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list,
|
||||
|
|
|
@ -495,7 +495,7 @@ static const int num_view_backups= 3;
|
|||
static File_option view_parameters[]=
|
||||
{{{(char*) STRING_WITH_LEN("query")},
|
||||
offsetof(TABLE_LIST, query),
|
||||
FILE_OPTIONS_STRING},
|
||||
FILE_OPTIONS_ESTRING},
|
||||
{{(char*) STRING_WITH_LEN("md5")},
|
||||
offsetof(TABLE_LIST, md5),
|
||||
FILE_OPTIONS_STRING},
|
||||
|
|
|
@ -1182,11 +1182,6 @@ create:
|
|||
| CREATE opt_unique_or_fulltext INDEX_SYM ident key_alg ON table_ident
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
lex->sql_command= SQLCOM_CREATE_INDEX;
|
||||
if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL,
|
||||
TL_OPTION_UPDATING))
|
||||
|
@ -3831,11 +3826,6 @@ alter:
|
|||
{
|
||||
THD *thd= YYTHD;
|
||||
LEX *lex= thd->lex;
|
||||
if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
lex->sql_command= SQLCOM_ALTER_TABLE;
|
||||
lex->name= 0;
|
||||
lex->duplicates= DUP_ERROR;
|
||||
|
@ -4237,11 +4227,6 @@ start:
|
|||
START_SYM TRANSACTION_SYM start_transaction_opts
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
lex->sql_command= SQLCOM_BEGIN;
|
||||
lex->start_transaction_opt= $3;
|
||||
}
|
||||
|
@ -4426,13 +4411,7 @@ opt_no_write_to_binlog:
|
|||
rename:
|
||||
RENAME table_or_tables
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
lex->sql_command=SQLCOM_RENAME_TABLE;
|
||||
Lex->sql_command= SQLCOM_RENAME_TABLE;
|
||||
}
|
||||
table_to_table_list
|
||||
{}
|
||||
|
@ -6569,21 +6548,10 @@ drop:
|
|||
lex->sql_command = SQLCOM_DROP_TABLE;
|
||||
lex->drop_temporary= $2;
|
||||
lex->drop_if_exists= $4;
|
||||
if (!lex->drop_temporary && lex->sphead &&
|
||||
lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
| DROP INDEX_SYM ident ON table_ident {}
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
lex->sql_command= SQLCOM_DROP_INDEX;
|
||||
lex->alter_info.drop_list.empty();
|
||||
lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
|
||||
|
@ -6629,13 +6597,7 @@ drop:
|
|||
}
|
||||
| DROP VIEW_SYM if_exists table_list opt_restrict
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
LEX *lex= thd->lex;
|
||||
if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
LEX *lex= Lex;
|
||||
lex->sql_command= SQLCOM_DROP_VIEW;
|
||||
lex->drop_if_exists= $3;
|
||||
}
|
||||
|
@ -8612,6 +8574,9 @@ option_value:
|
|||
names.length= 5;
|
||||
if (spc && spc->find_pvar(&names))
|
||||
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str);
|
||||
else
|
||||
yyerror(ER(ER_SYNTAX_ERROR));
|
||||
|
||||
YYABORT;
|
||||
}
|
||||
| NAMES_SYM charset_name_or_default opt_collate
|
||||
|
@ -9301,11 +9266,6 @@ begin:
|
|||
BEGIN_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
lex->sql_command = SQLCOM_BEGIN;
|
||||
lex->start_transaction_opt= 0;
|
||||
}
|
||||
|
@ -9338,11 +9298,6 @@ commit:
|
|||
COMMIT_SYM opt_work opt_chain opt_release
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
lex->sql_command= SQLCOM_COMMIT;
|
||||
lex->tx_chain= $3;
|
||||
lex->tx_release= $4;
|
||||
|
@ -9353,11 +9308,6 @@ rollback:
|
|||
ROLLBACK_SYM opt_work opt_chain opt_release
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
|
||||
YYABORT;
|
||||
}
|
||||
lex->sql_command= SQLCOM_ROLLBACK;
|
||||
lex->tx_chain= $3;
|
||||
lex->tx_release= $4;
|
||||
|
|
|
@ -211,8 +211,10 @@ byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end,
|
|||
for (word->pos=doc; doc<end; length++, mbl=my_mbcharlen(cs, *(uchar *)doc), doc+=(mbl ? mbl : 1))
|
||||
if (true_word_char(cs,*doc))
|
||||
mwc= 0;
|
||||
else if (!misc_word_char(*doc) || mwc++)
|
||||
else if (!misc_word_char(*doc) || mwc)
|
||||
break;
|
||||
else
|
||||
mwc++;
|
||||
|
||||
word->len= (uint)(doc-word->pos) - mwc;
|
||||
|
||||
|
|
|
@ -402,8 +402,12 @@ protected:
|
|||
* @return length
|
||||
*/
|
||||
Uint32 xfrm_key(Uint32 tab, const Uint32* src,
|
||||
Uint32 *dst, Uint32 dstLen,
|
||||
Uint32 *dst, Uint32 dstSize,
|
||||
Uint32 keyPartLen[MAX_ATTRIBUTES_IN_INDEX]) const;
|
||||
|
||||
Uint32 xfrm_attr(Uint32 attrDesc, CHARSET_INFO* cs,
|
||||
const Uint32* src, Uint32 & srcPos,
|
||||
Uint32* dst, Uint32 & dstPos, Uint32 dstSize) const;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -26,24 +26,33 @@ use HTML::Template;
|
|||
# BUGS
|
||||
# ----
|
||||
# - enum/set is 0 byte storage! Woah - efficient!
|
||||
# - DECIMAL is 0 byte storage. A bit too efficient.
|
||||
# - some float stores come out weird (when there's a comma e.g. 'float(4,1)')
|
||||
# - no disk data values
|
||||
# - computes the storage requirements of views (and probably MERGE)
|
||||
# - ignores character sets.
|
||||
|
||||
my $template = HTML::Template->new(filename => 'ndb_size.tmpl',
|
||||
die_on_bad_params => 0);
|
||||
die_on_bad_params => 0)
|
||||
or die "Could not open ndb_size.tmpl.";
|
||||
|
||||
my $dbh;
|
||||
|
||||
if(@ARGV < 3 || $ARGV[0] eq '--usage' || $ARGV[0] eq '--help')
|
||||
{
|
||||
print STDERR "Usage:\n";
|
||||
print STDERR "\tndb_size.pl database hostname user password\n\n";
|
||||
print STDERR "If you need to specify a port number, use host:port\n\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
{
|
||||
my $database= $ARGV[0];
|
||||
my $hostname= $ARGV[1];
|
||||
my $port= $ARGV[2];
|
||||
my $user= $ARGV[3];
|
||||
my $password= $ARGV[4];
|
||||
my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
|
||||
$dbh= DBI->connect($dsn, $user, $password);
|
||||
my $user= $ARGV[2];
|
||||
my $password= $ARGV[3];
|
||||
my $dsn = "DBI:mysql:database=$database;host=$hostname";
|
||||
$dbh= DBI->connect($dsn, $user, $password) or exit(1);
|
||||
$template->param(db => $database);
|
||||
$template->param(dsn => $dsn);
|
||||
}
|
||||
|
@ -55,6 +64,14 @@ my $tables = $dbh->selectall_arrayref("show tables");
|
|||
|
||||
my @table_size;
|
||||
|
||||
my @dbDataMemory;
|
||||
my @dbIndexMemory;
|
||||
my @NoOfAttributes;
|
||||
my @NoOfIndexes;
|
||||
my @NoOfTables;
|
||||
$NoOfTables[$_]{val} = @{$tables} foreach 0..$#releases;
|
||||
|
||||
|
||||
sub align {
|
||||
my($to,@unaligned) = @_;
|
||||
my @aligned;
|
||||
|
@ -68,9 +85,8 @@ foreach(@{$tables})
|
|||
{
|
||||
my $table= @{$_}[0];
|
||||
my @columns;
|
||||
my $info= $dbh->selectall_hashref("describe ".$dbh->quote($table),"Field");
|
||||
my @count = $dbh->selectrow_array("select count(*) from "
|
||||
.$dbh->quote($table));
|
||||
my $info= $dbh->selectall_hashref('describe `'.$table.'`',"Field");
|
||||
my @count = $dbh->selectrow_array('select count(*) from `'.$table.'`');
|
||||
my %columnsize; # used for index calculations
|
||||
|
||||
# We now work out the DataMemory usage
|
||||
|
@ -132,14 +148,17 @@ foreach(@{$tables})
|
|||
my $fixed= 1+$size;
|
||||
my @dynamic=$dbh->selectrow_array("select avg(length("
|
||||
.$dbh->quote($name)
|
||||
.")) from ".$dbh->quote($table));
|
||||
.")) from `".$table.'`');
|
||||
$dynamic[0]=0 if !$dynamic[0];
|
||||
@realsize= ($fixed,$fixed,ceil($dynamic[0]));
|
||||
}
|
||||
elsif($type =~ /binary/ || $type =~ /char/)
|
||||
{@realsize=($size,$size,$size)}
|
||||
elsif($type =~ /text/ || $type =~ /blob/)
|
||||
{@realsize=(256,256,1)} # FIXME check if 5.1 is correct
|
||||
{
|
||||
@realsize=(256,256,1);
|
||||
$NoOfTables[$_]{val} += 1 foreach 0..$#releases; # blob uses table
|
||||
} # FIXME check if 5.1 is correct
|
||||
|
||||
@realsize= align(4,@realsize);
|
||||
|
||||
|
@ -166,7 +185,7 @@ foreach(@{$tables})
|
|||
# we can still connect to pre-5.0 mysqlds.
|
||||
my %indexes;
|
||||
{
|
||||
my $sth= $dbh->prepare("show index from "$dbh->quote($table));
|
||||
my $sth= $dbh->prepare("show index from `".$table.'`');
|
||||
$sth->execute;
|
||||
while(my $i = $sth->fetchrow_hashref)
|
||||
{
|
||||
|
@ -257,7 +276,51 @@ foreach(@{$tables})
|
|||
IndexMemory=>\@IndexMemory,
|
||||
|
||||
};
|
||||
|
||||
$dbDataMemory[$_]{val} += $DataMemory[$_]{val} foreach 0..$#releases;
|
||||
$dbIndexMemory[$_]{val} += $IndexMemory[$_]{val} foreach 0..$#releases;
|
||||
$NoOfAttributes[$_]{val} += @columns foreach 0..$#releases;
|
||||
$NoOfIndexes[$_]{val} += @indexes foreach 0..$#releases;
|
||||
}
|
||||
|
||||
my @NoOfTriggers;
|
||||
# for unique hash indexes
|
||||
$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val}*3 foreach 0..$#releases;
|
||||
# for ordered index
|
||||
$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val} foreach 0..$#releases;
|
||||
|
||||
my @ParamMemory;
|
||||
foreach (0..$#releases) {
|
||||
$ParamMemory[0]{releases}[$_]{val}= POSIX::ceil(200*$NoOfAttributes[$_]{val}/1024);
|
||||
$ParamMemory[0]{name}= 'Attributes';
|
||||
|
||||
$ParamMemory[1]{releases}[$_]{val}= 20*$NoOfTables[$_]{val};
|
||||
$ParamMemory[1]{name}= 'Tables';
|
||||
|
||||
$ParamMemory[2]{releases}[$_]{val}= 10*$NoOfIndexes[$_]{val};
|
||||
$ParamMemory[2]{name}= 'OrderedIndexes';
|
||||
|
||||
$ParamMemory[3]{releases}[$_]{val}= 15*$NoOfIndexes[$_]{val};
|
||||
$ParamMemory[3]{name}= 'UniqueHashIndexes';
|
||||
}
|
||||
|
||||
$template->param(tables => \@table_size);
|
||||
$template->param(Parameters => [{name=>'DataMemory (kb)',
|
||||
releases=>\@dbDataMemory},
|
||||
{name=>'IndexMemory (kb)',
|
||||
releases=>\@dbIndexMemory},
|
||||
{name=>'MaxNoOfTables',
|
||||
releases=>\@NoOfTables},
|
||||
{name=>'MaxNoOfAttributes',
|
||||
releases=>\@NoOfAttributes},
|
||||
{name=>'MaxNoOfOrderedIndexes',
|
||||
releases=>\@NoOfIndexes},
|
||||
{name=>'MaxNoOfUniqueHashIndexes',
|
||||
releases=>\@NoOfIndexes},
|
||||
{name=>'MaxNoOfTriggers',
|
||||
releases=>\@NoOfTriggers}
|
||||
]
|
||||
);
|
||||
$template->param(ParamMemory => \@ParamMemory);
|
||||
|
||||
print $template->output;
|
||||
|
|
|
@ -13,18 +13,58 @@ td,th { border: 1px solid black }
|
|||
<h1>MySQL Cluster analysis for <TMPL_VAR NAME="db" escape="html"></h1>
|
||||
<p>This is an automated analysis of the <TMPL_VAR NAME="DSN" escape="html"> database for migration into <a href="http://www.mysql.com/">MySQL</a> Cluster. No warranty is made to the accuracy of the information.</p>
|
||||
|
||||
<p>This information should be valid for MySQL 4.1</p>
|
||||
<p>This information should be valid for MySQL 4.1 and 5.0. Since 5.1 is not a final release yet, the numbers should be used as a guide only.</p>
|
||||
|
||||
<h2>Parameter Settings</h2>
|
||||
<p><b>NOTE</b> the configuration parameters below do not take into account system tables and other requirements.</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<TMPL_LOOP NAME=releases>
|
||||
<th><TMPL_VAR NAME=rel></th>
|
||||
</TMPL_LOOP>
|
||||
</tr>
|
||||
<TMPL_LOOP NAME=Parameters>
|
||||
<tr>
|
||||
<td><TMPL_VAR NAME=name></td>
|
||||
<TMPL_LOOP NAME=releases>
|
||||
<td><TMPL_VAR NAME=val></td>
|
||||
</TMPL_LOOP>
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</table>
|
||||
|
||||
<h2>Memory usage because of parameters</h2>
|
||||
|
||||
<p>Usage is in kilobytes. Actual usage will vary as you should set the parameters larger than those listed in the table above.</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<TMPL_LOOP NAME=releases>
|
||||
<th><TMPL_VAR NAME=rel></th>
|
||||
</TMPL_LOOP>
|
||||
</tr>
|
||||
<TMPL_LOOP NAME=ParamMemory>
|
||||
<tr>
|
||||
<td><TMPL_VAR NAME=name></td>
|
||||
<TMPL_LOOP NAME=releases>
|
||||
<td><TMPL_VAR NAME=val></td>
|
||||
</TMPL_LOOP>
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</table>
|
||||
|
||||
<h2>Table List</h2>
|
||||
<ul>
|
||||
<TMPL_LOOP NAME="tables">
|
||||
<li><TMPL_VAR NAME="table"></li>
|
||||
<li><a href="#<TMPL_VAR NAME="table">"><TMPL_VAR NAME="table"></a></li>
|
||||
</TMPL_LOOP>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
|
||||
<TMPL_LOOP NAME="tables">
|
||||
<h2><TMPL_VAR NAME="table"></h2>
|
||||
<h2><a name="<TMPL_VAR NAME="table">"><TMPL_VAR NAME="table"></a></h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Column</th>
|
||||
|
|
|
@ -14419,7 +14419,7 @@ static void test_bug14210()
|
|||
myquery(rc);
|
||||
}
|
||||
|
||||
/* Bug#13488 */
|
||||
/* Bug#13488: wrong column metadata when fetching from cursor */
|
||||
|
||||
static void test_bug13488()
|
||||
{
|
||||
|
@ -14487,6 +14487,109 @@ static void test_bug13488()
|
|||
myquery(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
Bug#13524: warnings of a previous command are not reset when fetching
|
||||
from a cursor.
|
||||
*/
|
||||
|
||||
static void test_bug13524()
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
int rc;
|
||||
unsigned int warning_count;
|
||||
const ulong type= CURSOR_TYPE_READ_ONLY;
|
||||
const char *query= "select * from t1";
|
||||
|
||||
myheader("test_bug13524");
|
||||
|
||||
rc= mysql_query(mysql, "drop table if exists t1, t2");
|
||||
myquery(rc);
|
||||
rc= mysql_query(mysql, "create table t1 (a int not null primary key)");
|
||||
myquery(rc);
|
||||
rc= mysql_query(mysql, "insert into t1 values (1), (2), (3), (4)");
|
||||
myquery(rc);
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
rc= mysql_stmt_prepare(stmt, query, strlen(query));
|
||||
check_execute(stmt, rc);
|
||||
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
rc= mysql_stmt_fetch(stmt);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
warning_count= mysql_warning_count(mysql);
|
||||
DIE_UNLESS(warning_count == 0);
|
||||
|
||||
/* Check that DROP TABLE produced a warning (no such table) */
|
||||
rc= mysql_query(mysql, "drop table if exists t2");
|
||||
myquery(rc);
|
||||
warning_count= mysql_warning_count(mysql);
|
||||
DIE_UNLESS(warning_count == 1);
|
||||
|
||||
/*
|
||||
Check that fetch from a cursor cleared the warning from the previous
|
||||
command.
|
||||
*/
|
||||
rc= mysql_stmt_fetch(stmt);
|
||||
check_execute(stmt, rc);
|
||||
warning_count= mysql_warning_count(mysql);
|
||||
DIE_UNLESS(warning_count == 0);
|
||||
|
||||
/* Cleanup */
|
||||
mysql_stmt_close(stmt);
|
||||
rc= mysql_query(mysql, "drop table t1");
|
||||
myquery(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA when COUNT(*) is 0"
|
||||
*/
|
||||
|
||||
static void test_bug14845()
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
int rc;
|
||||
const ulong type= CURSOR_TYPE_READ_ONLY;
|
||||
const char *query= "select count(*) from t1 where 1 = 0";
|
||||
|
||||
myheader("test_bug14845");
|
||||
|
||||
rc= mysql_query(mysql, "drop table if exists t1");
|
||||
myquery(rc);
|
||||
rc= mysql_query(mysql, "create table t1 (id int(11) default null, "
|
||||
"name varchar(20) default null)"
|
||||
"engine=MyISAM DEFAULT CHARSET=utf8");
|
||||
myquery(rc);
|
||||
rc= mysql_query(mysql, "insert into t1 values (1,'abc'),(2,'def')");
|
||||
myquery(rc);
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
rc= mysql_stmt_prepare(stmt, query, strlen(query));
|
||||
check_execute(stmt, rc);
|
||||
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
rc= mysql_stmt_fetch(stmt);
|
||||
DIE_UNLESS(rc == 0);
|
||||
|
||||
rc= mysql_stmt_fetch(stmt);
|
||||
DIE_UNLESS(rc == MYSQL_NO_DATA);
|
||||
|
||||
/* Cleanup */
|
||||
mysql_stmt_close(stmt);
|
||||
rc= mysql_query(mysql, "drop table t1");
|
||||
myquery(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
Read and parse arguments and MySQL options from my.cnf
|
||||
*/
|
||||
|
@ -14744,6 +14847,8 @@ static struct my_tests_st my_tests[]= {
|
|||
{ "test_bug12243", test_bug12243 },
|
||||
{ "test_bug14210", test_bug14210 },
|
||||
{ "test_bug13488", test_bug13488 },
|
||||
{ "test_bug13524", test_bug13524 },
|
||||
{ "test_bug14845", test_bug14845 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue