⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ps.test

📁 这是linux下运行的mysql软件包,可用于linux 下安装 php + mysql + apach 的网络配置
💻 TEST
📖 第 1 页 / 共 2 页
字号:
drop table t1, t2;## Bug#6102 "Server crash with prepared statement and blank after# function name"# ensure that stored functions are cached when preparing a statement# before we open tables#create table t1 (a varchar(20)); insert into t1 values ('foo'); --error 1305prepare stmt FROM 'SELECT char_length (a) FROM t1'; drop table t1;## Bug #6089: FOUND_ROWS returns wrong values when no table/view is used #prepare stmt from "SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0";execute stmt;SELECT FOUND_ROWS();execute stmt;                                                                   SELECT FOUND_ROWS();                                                            deallocate prepare stmt;## Bug#8115: equality propagation and prepared statements#create table t1 (a char(3) not null, b char(3) not null,                 c char(3) not null, primary key  (a, b, c));create table t2 like t1;# reduced queryprepare stmt from  "select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)  where t1.a=1";execute stmt;execute stmt;execute stmt;# original queryprepare stmt from"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from(t1 left outer join t2 on t2.a=? and t1.b=t2.b)left outer join t2 t3 on t3.a=? where t1.a=?";set @a:=1, @b:=1, @c:=1;execute stmt using @a, @b, @c;execute stmt using @a, @b, @c;execute stmt using @a, @b, @c;deallocate prepare stmt;drop table t1,t2;## Bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement#eval SET @aux= "SELECT COUNT(*)                FROM INFORMATION_SCHEMA.COLUMNS A,                INFORMATION_SCHEMA.COLUMNS B                WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA                AND A.TABLE_NAME = B.TABLE_NAME                AND A.COLUMN_NAME = B.COLUMN_NAME AND                A.TABLE_NAME = 'user'";let $exec_loop_count= 3;eval prepare my_stmt from @aux;while ($exec_loop_count){  eval execute my_stmt;  dec $exec_loop_count;}deallocate prepare my_stmt;# Test CALL in prepared modedelimiter |;--disable_warningsdrop procedure if exists p1|drop table if exists t1|--enable_warningscreate table t1 (id int)|insert into t1 values(1)|create procedure p1(a int, b int)begin  declare c int;  select max(id)+1 into c from t1;  insert into t1 select a+b;  insert into t1 select a-b;  insert into t1 select a-c;end|set @a= 3, @b= 4|prepare stmt from "call p1(?, ?)"|execute stmt using @a, @b|execute stmt using @a, @b|select * from t1|deallocate prepare stmt|drop procedure p1|drop table t1|delimiter ;|## Bug#9096 "select doesn't return all matched records if prepared statements# is used"# The bug was is bad co-operation of the optimizer's algorithm which determines# which keys can be used to execute a query, constants propagation# part of the optimizer and parameter markers used by prepared statements.drop table if exists t1;create table t1 (c1 int(11) not null, c2 int(11) not null,             primary key  (c1,c2), key c2 (c2), key c1 (c1));insert into t1 values (200887, 860);insert into t1 values (200887, 200887);select * from t1 where (c1=200887 and c2=200887) or c2=860;prepare stmt from"select * from t1 where (c1=200887 and c2=200887) or c2=860";execute stmt;prepare stmt from"select * from t1 where (c1=200887 and c2=?) or c2=?";set @a=200887, @b=860;# this query did not return all matching rowsexecute stmt using @a, @b;deallocate prepare stmt;drop table t1;## Bug#9777 - another occurrence of the problem stated in Bug#9096:# we can not compare basic constants by their names, because a placeholder# is a basic constant while his name is always '?'#create table t1 (   id bigint(20) not null auto_increment,   code varchar(20) character set utf8 collate utf8_bin not null default '',   company_name varchar(250) character set utf8 collate utf8_bin default null,   setup_mode tinyint(4) default null,   start_date datetime default null,   primary key  (id), unique key code (code));create table t2 (   id bigint(20) not null auto_increment,   email varchar(250) character set utf8 collate utf8_bin default null,   name varchar(250) character set utf8 collate utf8_bin default null,   t1_id bigint(20) default null,   password varchar(250) character set utf8 collate utf8_bin default null,   primary_contact tinyint(4) not null default '0',   email_opt_in tinyint(4) not null default '1',   primary key  (id), unique key email (email), key t1_id (t1_id),   constraint t2_fk1 foreign key (t1_id) references t1 (id));insert into t1 values(1, 'demo', 'demo s', 0, current_date()),(2, 'code2', 'name 2', 0, current_date()),(3, 'code3', 'name 3', 0, current_date());insert into t2 values(2, 'email1', 'name1', 3, 'password1', 0, 0),(3, 'email2', 'name1', 1, 'password2', 1, 0),(5, 'email3', 'name3', 2, 'password3', 0, 0);prepare stmt from 'select t2.id from t2, t1 where (t1.id=? and t2.t1_id=t1.id)';set @a=1;execute stmt using @a;select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id);deallocate prepare stmt;drop table t1, t2;## Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement# support for placeholders in LIMIT clause."# Add basic test coverage for the feature.# create table t1 (a int);insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);prepare stmt from "select * from t1 limit ?, ?";set @offset=0, @limit=1;execute stmt using @offset, @limit;select * from t1 limit 0, 1;set @offset=3, @limit=2;execute stmt using @offset, @limit;select * from t1 limit 3, 2;prepare stmt from "select * from t1 limit ?";execute stmt using @limit;--error 1235prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";set @offset=9;set @limit=2;execute stmt using @offset, @limit;prepare stmt from "(select * from t1 limit ?, ?) union all                   (select * from t1 limit ?, ?) order by a limit ?";execute stmt using @offset, @limit, @offset, @limit, @limit;drop table t1;deallocate prepare stmt;## Bug#11060 "Server crashes on calling stored procedure with INSERT SELECT# UNION SELECT" aka "Server crashes on re-execution of prepared INSERT ...# SELECT with UNION".#create table t1 (id int);prepare stmt from "insert into t1 (id) select id from t1 union select id from t1";execute stmt;execute stmt;deallocate prepare stmt;drop table t1;## Bug#11458 "Prepared statement with subselects return random data":# drop PARAM_TABLE_BIT from the list of tables used by a subquery#create table t1 (  id int(11) unsigned not null primary key auto_increment,  partner_id varchar(35) not null,  t1_status_id int(10) unsigned);insert into t1 values ("1", "partner1", "10"), ("2", "partner2", "10"),                      ("3", "partner3", "10"), ("4", "partner4", "10");create table t2 (  id int(11) unsigned not null default '0',  t1_line_id int(11) unsigned not null default '0',  article_id varchar(20),  sequence int(11) not null default '0',  primary key  (id,t1_line_id));insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"),                      ("2", "2", "sup", "2"), ("2", "3", "sup", "3"),                      ("2", "4", "imp", "4"), ("3", "1", "sup", "0"),                      ("4", "1", "sup", "0");create table t3 (  id int(11) not null default '0',  preceeding_id int(11) not null default '0',  primary key  (id,preceeding_id));create table t4 (  user_id varchar(50) not null,  article_id varchar(20) not null,  primary key  (user_id,article_id));insert into t4 values("nicke", "imp");prepare stmt from'select distinct t1.partner_idfrom t1 left join t3 on t1.id = t3.id     left join t1 pp on pp.id = t3.preceeding_idwhere  exists (    select *    from t2 as pl_inner    where pl_inner.id = t1.id    and pl_inner.sequence <= (      select min(sequence) from t2 pl_seqnr      where pl_seqnr.id = t1.id    )    and exists (      select * from t4      where t4.article_id = pl_inner.article_id      and t4.user_id = ?    )  )  and t1.id = ?group by t1.idhaving count(pp.id) = 0';set @user_id = 'nicke';set @id = '2';execute stmt using @user_id, @id;execute stmt using @user_id, @id;deallocate prepare stmt;drop table t1, t2, t3, t4;## Bug#9379: make sure that Item::collation is reset when one sets# a parameter marker from a string variable.#prepare stmt from 'select ?=?';set @a='CHRISTINE           ';set @b='CHRISTINE';execute stmt using @a, @b;execute stmt using @a, @b;set @a=1, @b=2;execute stmt using @a, @b;set @a='CHRISTINE           ';set @b='CHRISTINE';execute stmt using @a, @b;deallocate prepare stmt;## Bug#11299 "prepared statement makes wrong SQL syntax in binlog which stops# replication": check that errouneous queries with placeholders are not# allowed#create table t1 (a int);--error 1064prepare stmt from "select ??";--error 1064prepare stmt from "select ?FROM t1";--error 1064prepare stmt from "select FROM t1 WHERE?=1";--error 1064prepare stmt from "update t1 set a=a+?WHERE 1";--disable_ps_protocol--error 1064select ?;--error 1064select ??;--error 1064select ? from t1;--enable_ps_protocoldrop table t1;## Bug#12651# (Crash on a PS including a subquery which is a select from a simple view)#CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;CREATE VIEW  b12651_V1 as SELECT b FROM b12651_T2;PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';EXECUTE b12651;DROP VIEW b12651_V1;DROP TABLE b12651_T1, b12651_T2;## Bug#9359 "Prepared statements take snapshot of system vars at PREPARE# time"#prepare stmt from "select @@time_zone";execute stmt;set @@time_zone:='Japan';execute stmt;prepare stmt from "select @@tx_isolation";execute stmt;set transaction isolation level read committed;execute stmt;set transaction isolation level serializable;execute stmt;set @@tx_isolation=default;execute stmt;deallocate prepare stmt;## Bug#14410 "Crash in Enum or Set type in CREATE TABLE and PS/SP"## Part I. Make sure the typelib for ENUM is created in the statement memory# root.prepare stmt from "create temporary table t1 (letter enum('','a','b','c')not null)";execute stmt;drop table t1;execute stmt;drop table t1;execute stmt;drop table t1;# Part II. Make sure that when the default value is converted to UTF-8,# the new item is # created in the statement memory root.set names latin1;prepare stmt from "create table t1 (a enum('test') default 'test') character set utf8";execute stmt;drop table t1;execute stmt;drop table t1;execute stmt;drop table t1;# Cleanupset names default;deallocate prepare stmt;## A test case for Bug#12734 "prepared statement may return incorrect result# set for a select SQL request": test that canDoTurboBM is reset for each# execute of a prepared statement.#create table t1 (  word_id mediumint(8) unsigned not null default '0',  formatted varchar(20) not null default '');insert into t1 values  (80,'pendant'), (475,'pretendants'), (989,'tendances'),  (1019,'cependant'),(1022,'abondance'),(1205,'independants'),  (13,'lessiver'),(25,'lambiner'),(46,'situer'),(71,'terminer'),  (82,'decrocher');select count(*) from t1 where formatted like '%NDAN%';select count(*) from t1 where formatted like '%ER';prepare stmt from "select count(*) from t1 where formatted like ?";set @like="%NDAN%";execute stmt using @like;set @like="%ER";execute stmt using @like;set @like="%NDAN%";execute stmt using @like;set @like="%ER";execute stmt using @like;deallocate prepare stmt;drop table t1;## Bug#13134 "Length of VARCHAR() utf8 column is increasing when table is# recreated with PS/SP"#prepare stmt from 'create table t1 (a varchar(10) character set utf8)';execute stmt;--disable_warningsinsert into t1 (a) values (repeat('a', 20));--enable_warningsselect length(a) from t1;drop table t1;execute stmt;--disable_warningsinsert into t1 (a) values (repeat('a', 20));--enable_warnings# Check that the data is truncated to the same lengthselect length(a) from t1;drop table t1;deallocate prepare stmt;# End of 4.1 tests## Bug #14956: ROW_COUNT() returns incorrect result after EXECUTE of prepared# statement#create table t1 (id int);prepare ins_call from "insert into t1 (id) values (1)";execute ins_call;select row_count();drop table t1;## BUG#16474: SP crashed MySQL# (when using "order by localvar", where 'localvar' is just that.# The actual bug test is in sp.test, this is just testing that we get the# expected result for prepared statements too, i.e. place holders work as# textual substitution. If it's a single integer, it works as the (deprecated)# "order by column#", otherwise it's an expression.#create table t1 (a int, b int);insert into t1 (a,b) values (2,8),(1,9),(3,7);# Will order by indexprepare stmt from "select * from t1 order by ?";execute stmt using @a;set @a=1;execute stmt using @a;set @a=2;execute stmt using @a;deallocate prepare stmt;# For reference:select * from t1 order by 1;# Will not order by index.prepare stmt from "select * from t1 order by ?+1";set @a=0;execute stmt using @a;set @a=1;execute stmt using @a;deallocate prepare stmt;# For reference:select * from t1 order by 1+1;drop table t1;# End of 5.0 tests

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -