Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
abb50b38
Commit
abb50b38
authored
Nov 30, 2004
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ps_7ndb.result, ps_7ndb.test:
ndb now runs ps tests just like the others
parent
2d1458ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
421 deletions
+91
-421
mysql-test/r/ps_7ndb.result
mysql-test/r/ps_7ndb.result
+89
-65
mysql-test/t/ps_7ndb.test
mysql-test/t/ps_7ndb.test
+2
-356
No files found.
mysql-test/r/ps_7ndb.result
View file @
abb50b38
...
...
@@ -2,20 +2,19 @@ use test;
drop table if exists t1, t9 ;
create table t1
(
a int
not null
, b varchar(30),
a int, b varchar(30),
primary key(a)
) engine = 'NDB' ;
drop table if exists t9;
create table t9
(
c1 tinyint
not null
, c2 smallint, c3 mediumint, c4 int,
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp(14), c16 time,
c17 year, c18 bit, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23
char(100), c24 char(100)
,
c25
char(100), c26 char(100), c27 char(100), c28 char(100)
,
c29
char(100), c30 char(100)
, c31 enum('one', 'two', 'three'),
c21 char(10), c22 varchar(30), c23
tinyblob, c24 tinytext
,
c25
blob, c26 text, c27 mediumblob, c28 mediumtext
,
c29
longblob, c30 longtext
, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) engine = 'NDB' ;
...
...
@@ -72,14 +71,14 @@ def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
def test t9 t9 c20 c20 254 1 1 Y 0 0 8
def test t9 t9 c21 c21 253 10 10 Y 0 0 8
def test t9 t9 c22 c22 253 30 30 Y 0 0 8
def test t9 t9 c23 c23 25
3 100 8 Y 0 0 8
def test t9 t9 c24 c24 25
3 100 8 Y 0
0 8
def test t9 t9 c25 c25 25
3 100 4 Y 0 0 8
def test t9 t9 c26 c26 25
3 100 4 Y 0
0 8
def test t9 t9 c27 c27 25
3 100 10 Y 0 0 8
def test t9 t9 c28 c28 25
3 100 10 Y 0
0 8
def test t9 t9 c29 c29 25
3 100 8 Y 0 0 8
def test t9 t9 c30 c30 25
3 100 8 Y 0
0 8
def test t9 t9 c23 c23 25
2 255 8 Y 144 0 63
def test t9 t9 c24 c24 25
2 255 8 Y 16
0 8
def test t9 t9 c25 c25 25
2 65535 4 Y 144 0 63
def test t9 t9 c26 c26 25
2 65535 4 Y 16
0 8
def test t9 t9 c27 c27 25
2 16777215 10 Y 144 0 63
def test t9 t9 c28 c28 25
2 16777215 10 Y 16
0 8
def test t9 t9 c29 c29 25
2 16777215 8 Y 144 0 63
def test t9 t9 c30 c30 25
2 16777215 8 Y 16
0 8
def test t9 t9 c31 c31 254 5 3 Y 256 0 8
def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
...
...
@@ -1188,7 +1187,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2
order by b
;
select a,b from t1 where a=2;
a b
execute stmt1;
insert into t1 values(0,NULL);
...
...
@@ -1270,18 +1269,23 @@ execute stmt1 using @arg00, @arg00;
select a,b from t1 where a=@arg00;
a b
2 two
execute stmt1 using @arg01, @arg00;
select a,b from t1 where a=@arg01;
a b
22 two
execute stmt1 using @arg00, @arg01;
select a,b from t1 where a=@arg00;
a b
2 two
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
select a,b from t1 order by a;
a b
0 two
1 one
2 two
3 three
4 four
set @arg00=0;
...
...
@@ -1302,15 +1306,19 @@ create table t2 as select a,b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
affected rows:
0
info: Rows matched:
0 Changed: 0
Warnings: 0
select a,b from t1 order by a;
affected rows:
1
info: Rows matched:
1 Changed: 1
Warnings: 0
select a,b from t1 order by a
;
a b
1 one
2 two
...
...
@@ -1319,21 +1327,25 @@ a b
drop table t2 ;
create table t2
(
a int
not null
, b varchar(30),
a int, b varchar(30),
primary key(a)
) engine = 'NDB' ;
insert into t2(a,b) select a, b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
affected rows:
0
info: Rows matched:
0 Changed: 0
Warnings: 0
affected rows:
1
info: Rows matched:
1 Changed: 1
Warnings: 0
select a,b from t1 order by a ;
a b
1 one
...
...
@@ -1474,7 +1486,7 @@ set @arg02=82 ;
set @arg03='8-2' ;
prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
select a,b from t1 where a in (@arg00,@arg02)
order by a
;
select a,b from t1 where a in (@arg00,@arg02) ;
a b
81 8-1
82 8-2
...
...
@@ -1489,6 +1501,7 @@ set @arg00=6 ;
set @arg01=1 ;
prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
on duplicate key update a=a + ?, b=concat(b,''modified'') ';
execute stmt1 using @arg00, @arg01;
select * from t1 order by a;
a b
0 NULL
...
...
@@ -1497,13 +1510,15 @@ a b
3 three
4 four
5 five
6 six
7 sixmodified
8 eight
9 nine
81 8-1
82 8-2
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'NDB' ;
...
...
@@ -1526,23 +1541,32 @@ set @x1100="x1100" ;
set @100=100 ;
set @updated="updated" ;
insert into t1 values(1000,'x1000_1') ;
insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
on duplicate key update a = a + @100, b = concat(b,@updated) ;
select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_1
1000 x1000_3
1100 x1000_1updated
delete from t1 where a >= 1000 ;
insert into t1 values(1000,'x1000_1') ;
prepare stmt1 from ' insert into t1 values(?,?),(?,?)
on duplicate key update a = a + ?, b = concat(b,?) ';
execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_1
1000 x1000_3
1100 x1000_1updated
delete from t1 where a >= 1000 ;
insert into t1 values(1000,'x1000_1') ;
execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
select a,b from t1 where a >= 1000 order by a ;
a b
1
000 x1000_1
1
200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
execute stmt1;
execute stmt1;
execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
...
...
@@ -1891,13 +1915,13 @@ def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y
0 31 8
def @arg23 254 8192 8 Y
128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y
0 31 8
def @arg25 254 8192 4 Y
128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y
0 31 8
def @arg27 254 8192 10 Y
128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y
0 31 8
def @arg29 254 8192 8 Y
128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
...
...
@@ -1938,13 +1962,13 @@ def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 0 31 8
def @arg21 254 8192 0 Y 0 31 8
def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y
0 31 8
def @arg23 254 8192 0 Y
128 31 63
def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y
0 31 8
def @arg25 254 8192 0 Y
128 31 63
def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y
0 31 8
def @arg27 254 8192 0 Y
128 31 63
def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y
0 31 8
def @arg29 254 8192 0 Y
128 31 63
def @arg30 254 8192 0 Y 0 31 8
def @arg31 254 8192 0 Y 0 31 8
def @arg32 254 8192 0 Y 0 31 8
...
...
@@ -1988,13 +2012,13 @@ def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y
0 31 8
def @arg23 254 8192 8 Y
128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y
0 31 8
def @arg25 254 8192 4 Y
128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y
0 31 8
def @arg27 254 8192 10 Y
128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y
0 31 8
def @arg29 254 8192 8 Y
128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
...
...
@@ -2028,13 +2052,13 @@ def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 0 31 8
def @arg21 254 8192 0 Y 0 31 8
def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y
0 31 8
def @arg23 254 8192 0 Y
128 31 63
def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y
0 31 8
def @arg25 254 8192 0 Y
128 31 63
def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y
0 31 8
def @arg27 254 8192 0 Y
128 31 63
def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y
0 31 8
def @arg29 254 8192 0 Y
128 31 63
def @arg30 254 8192 0 Y 0 31 8
def @arg31 254 8192 0 Y 0 31 8
def @arg32 254 8192 0 Y 0 31 8
...
...
@@ -2076,13 +2100,13 @@ def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y
0 31 8
def @arg23 254 8192 8 Y
128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y
0 31 8
def @arg25 254 8192 4 Y
128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y
0 31 8
def @arg27 254 8192 10 Y
128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y
0 31 8
def @arg29 254 8192 8 Y
128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
...
...
@@ -2120,13 +2144,13 @@ def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 0 31 8
def @arg21 254 8192 0 Y 0 31 8
def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y
0 31 8
def @arg23 254 8192 0 Y
128 31 63
def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y
0 31 8
def @arg25 254 8192 0 Y
128 31 63
def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y
0 31 8
def @arg27 254 8192 0 Y
128 31 63
def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y
0 31 8
def @arg29 254 8192 0 Y
128 31 63
def @arg30 254 8192 0 Y 0 31 8
def @arg31 254 8192 0 Y 0 31 8
def @arg32 254 8192 0 Y 0 31 8
...
...
@@ -2166,13 +2190,13 @@ def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y
0 31 8
def @arg23 254 8192 8 Y
128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y
0 31 8
def @arg25 254 8192 4 Y
128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y
0 31 8
def @arg27 254 8192 10 Y
128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y
0 31 8
def @arg29 254 8192 8 Y
128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
...
...
@@ -2204,13 +2228,13 @@ def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 0 31 8
def @arg21 254 8192 0 Y 0 31 8
def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y
0 31 8
def @arg23 254 8192 0 Y
128 31 63
def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y
0 31 8
def @arg25 254 8192 0 Y
128 31 63
def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y
0 31 8
def @arg27 254 8192 0 Y
128 31 63
def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y
0 31 8
def @arg29 254 8192 0 Y
128 31 63
def @arg30 254 8192 0 Y 0 31 8
def @arg31 254 8192 0 Y 0 31 8
def @arg32 254 8192 0 Y 0 31 8
...
...
@@ -2770,14 +2794,14 @@ c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
41 4 41 41 41 41 41 41 41 41 41 41
42 4 42 42 42 42 42 42 42 42 42 42
43 4 43 43 43 43 43 43 43 43 43 43
50 5 50 50 50
50 50 50 50 50 50 5
0
50 5 50 50 50
.00 50.00 50.00 50.00 50.00 50.00 50.00 50.0
0
51 5 51 51 51 51 51 51 51 51 51 51
52 5 52 52 52
52 52 52 52 52 52 52
53 5 53 53 53
53 53 53 53 53 53 53
54 5 54 54 54
54 54 54 54 54 54 54
52 5 52 52 52
.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
53 5 53 53 53
.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
54 5 54 54 54
.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
55 5 55 55 55 55 55 55 55 55 55 55
56 6 56 56 56
56 56 56 56 56 56 56
57 6 57 57 57
57 57 57 57 57 57 57
56 6 56 56 56
.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
57 6 57 57 57
.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
...
...
mysql-test/t/ps_7ndb.test
View file @
abb50b38
...
...
@@ -12,365 +12,11 @@ use test;
--
source
include
/
have_ndb
.
inc
let
$type
=
'NDB'
;
--
disable_warnings
drop
table
if
exists
t1
,
t9
;
--
enable_warnings
eval
create
table
t1
(
a
int
not
null
,
b
varchar
(
30
),
primary
key
(
a
)
)
engine
=
$type
;
--
disable_warnings
drop
table
if
exists
t9
;
--
enable_warnings
# The used table type doesn't support BLOB/TEXT columns.
# (The server would send error 1163 .)
# So we use char(100) instead.
eval
create
table
t9
(
c1
tinyint
not
null
,
c2
smallint
,
c3
mediumint
,
c4
int
,
c5
integer
,
c6
bigint
,
c7
float
,
c8
double
,
c9
double
precision
,
c10
real
,
c11
decimal
(
7
,
4
),
c12
numeric
(
8
,
4
),
c13
date
,
c14
datetime
,
c15
timestamp
(
14
),
c16
time
,
c17
year
,
c18
bit
,
c19
bool
,
c20
char
,
c21
char
(
10
),
c22
varchar
(
30
),
c23
char
(
100
),
c24
char
(
100
),
c25
char
(
100
),
c26
char
(
100
),
c27
char
(
100
),
c28
char
(
100
),
c29
char
(
100
),
c30
char
(
100
),
c31
enum
(
'one'
,
'two'
,
'three'
),
c32
set
(
'monday'
,
'tuesday'
,
'wednesday'
),
primary
key
(
c1
)
)
engine
=
$type
;
--
source
include
/
ps_create
.
inc
--
source
include
/
ps_renew
.
inc
--
source
include
/
ps_query
.
inc
# The following line is deactivated, because the ndb storage engine is not able
# to do primary key column updates .
#-- source include/ps_modify.inc
# let's include all statements which will work
--
disable_query_log
select
'------ delete tests ------'
as
test_sequence
;
--
enable_query_log
--
source
include
/
ps_renew
.
inc
## delete without parameter
prepare
stmt1
from
'delete from t1 where a=2'
;
execute
stmt1
;
select
a
,
b
from
t1
where
a
=
2
order
by
b
;
# delete with row not found
execute
stmt1
;
## delete with one parameter in the where clause
insert
into
t1
values
(
0
,
NULL
);
set
@
arg00
=
NULL
;
prepare
stmt1
from
'delete from t1 where b=?'
;
execute
stmt1
using
@
arg00
;
select
a
,
b
from
t1
where
b
is
NULL
;
set
@
arg00
=
'one'
;
execute
stmt1
using
@
arg00
;
select
a
,
b
from
t1
where
b
=@
arg00
;
## truncate a table
--
error
1295
prepare
stmt1
from
'truncate table t1'
;
--
disable_query_log
select
'------ update tests ------'
as
test_sequence
;
--
enable_query_log
--
source
include
/
ps_renew
.
inc
## update without parameter
prepare
stmt1
from
'update t1 set b=''a=two'' where a=2'
;
execute
stmt1
;
select
a
,
b
from
t1
where
a
=
2
;
# dummy update
execute
stmt1
;
select
a
,
b
from
t1
where
a
=
2
;
## update with one parameter in the set clause
set
@
arg00
=
NULL
;
prepare
stmt1
from
'update t1 set b=? where a=2'
;
execute
stmt1
using
@
arg00
;
select
a
,
b
from
t1
where
a
=
2
;
set
@
arg00
=
'two'
;
execute
stmt1
using
@
arg00
;
select
a
,
b
from
t1
where
a
=
2
;
## update with one parameter in the where cause
set
@
arg00
=
2
;
prepare
stmt1
from
'update t1 set b=NULL where a=?'
;
execute
stmt1
using
@
arg00
;
select
a
,
b
from
t1
where
a
=@
arg00
;
update
t1
set
b
=
'two'
where
a
=@
arg00
;
# row not found in update
set
@
arg00
=
2000
;
execute
stmt1
using
@
arg00
;
select
a
,
b
from
t1
where
a
=@
arg00
;
## update on primary key column (two parameters)
set
@
arg00
=
2
;
set
@
arg01
=
22
;
prepare
stmt1
from
'update t1 set a=? where a=?'
;
# dummy update
execute
stmt1
using
@
arg00
,
@
arg00
;
select
a
,
b
from
t1
where
a
=@
arg00
;
# deactivated primary key column update
# execute stmt1 using @arg01, @arg00;
select
a
,
b
from
t1
where
a
=@
arg01
;
execute
stmt1
using
@
arg00
,
@
arg01
;
select
a
,
b
from
t1
where
a
=@
arg00
;
set
@
arg00
=
NULL
;
set
@
arg01
=
2
;
# deactivated primary key column update
# execute stmt1 using @arg00, @arg01;
select
a
,
b
from
t1
order
by
a
;
set
@
arg00
=
0
;
execute
stmt1
using
@
arg01
,
@
arg00
;
select
a
,
b
from
t1
order
by
a
;
## update with subquery and several parameters
set
@
arg00
=
23
;
set
@
arg01
=
'two'
;
set
@
arg02
=
2
;
set
@
arg03
=
'two'
;
set
@
arg04
=
2
;
--
disable_warnings
drop
table
if
exists
t2
;
--
enable_warnings
# t2 will be of table type 'MYISAM'
create
table
t2
as
select
a
,
b
from
t1
;
prepare
stmt1
from
'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)'
;
--
enable_info
# deactivated primary key column update
# execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
--
disable_info
select
a
,
b
from
t1
where
a
=
@
arg00
;
prepare
stmt1
from
'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)'
;
--
enable_info
execute
stmt1
using
@
arg04
,
@
arg01
,
@
arg02
,
@
arg03
,
@
arg00
;
--
disable_info
select
a
,
b
from
t1
order
by
a
;
drop
table
t2
;
# t2 is now of table type '$type'
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
eval
create
table
t2
(
a
int
not
null
,
b
varchar
(
30
),
primary
key
(
a
)
)
engine
=
$type
;
insert
into
t2
(
a
,
b
)
select
a
,
b
from
t1
;
prepare
stmt1
from
'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)'
;
--
enable_info
# deactivated primary key column update
# execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
--
disable_info
select
a
,
b
from
t1
where
a
=
@
arg00
;
prepare
stmt1
from
'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)'
;
--
enable_info
execute
stmt1
using
@
arg04
,
@
arg01
,
@
arg02
,
@
arg03
,
@
arg00
;
--
disable_info
select
a
,
b
from
t1
order
by
a
;
drop
table
t2
;
## update with parameters in limit
set
@
arg00
=
1
;
prepare
stmt1
from
'update t1 set b=''bla''
where a=2
limit 1'
;
execute
stmt1
;
select
a
,
b
from
t1
where
b
=
'bla'
;
# currently (May 2004, Version 4.1) it is impossible
--
error
1064
prepare
stmt1
from
'update t1 set b=''bla''
where a=2
limit ?'
;
--
disable_query_log
select
'------ insert tests ------'
as
test_sequence
;
--
enable_query_log
--
source
include
/
ps_renew
.
inc
## insert without parameter
prepare
stmt1
from
'insert into t1 values(5, ''five'' )'
;
execute
stmt1
;
select
a
,
b
from
t1
where
a
=
5
;
## insert with one parameter in values part
set
@
arg00
=
'six'
;
prepare
stmt1
from
'insert into t1 values(6, ? )'
;
execute
stmt1
using
@
arg00
;
select
a
,
b
from
t1
where
b
=
@
arg00
;
# the second insert fails, because the first column is primary key
--
error
1062
execute
stmt1
using
@
arg00
;
set
@
arg00
=
NULL
;
prepare
stmt1
from
'insert into t1 values(0, ? )'
;
execute
stmt1
using
@
arg00
;
select
a
,
b
from
t1
where
b
is
NULL
;
## insert with two parameter in values part
set
@
arg00
=
8
;
set
@
arg01
=
'eight'
;
prepare
stmt1
from
'insert into t1 values(?, ? )'
;
execute
stmt1
using
@
arg00
,
@
arg01
;
select
a
,
b
from
t1
where
b
=
@
arg01
;
# cases derived from client_test.c: test_null()
set
@
NULL
=
null
;
set
@
arg00
=
'abc'
;
# execute must fail, because first column is primary key (-> not null)
--
error
1048
execute
stmt1
using
@
NULL
,
@
NULL
;
--
error
1048
execute
stmt1
using
@
NULL
,
@
NULL
;
--
error
1048
execute
stmt1
using
@
NULL
,
@
arg00
;
--
error
1048
execute
stmt1
using
@
NULL
,
@
arg00
;
let
$
1
=
2
;
while
(
$
1
)
{
eval
set
@
arg01
=
10000
+
$
1
;
execute
stmt1
using
@
arg01
,
@
arg00
;
dec
$
1
;
}
select
*
from
t1
where
a
>
10000
order
by
a
;
delete
from
t1
where
a
>
10000
;
let
$
1
=
2
;
while
(
$
1
)
{
eval
set
@
arg01
=
10000
+
$
1
;
execute
stmt1
using
@
arg01
,
@
NULL
;
dec
$
1
;
}
select
*
from
t1
where
a
>
10000
order
by
a
;
delete
from
t1
where
a
>
10000
;
let
$
1
=
10
;
while
(
$
1
)
{
eval
set
@
arg01
=
10000
+
$
1
;
execute
stmt1
using
@
arg01
,
@
arg01
;
dec
$
1
;
}
select
*
from
t1
where
a
>
10000
order
by
a
;
delete
from
t1
where
a
>
10000
;
## insert with two rows in values part
set
@
arg00
=
81
;
set
@
arg01
=
'8-1'
;
set
@
arg02
=
82
;
set
@
arg03
=
'8-2'
;
prepare
stmt1
from
'insert into t1 values(?,?),(?,?)'
;
execute
stmt1
using
@
arg00
,
@
arg01
,
@
arg02
,
@
arg03
;
select
a
,
b
from
t1
where
a
in
(
@
arg00
,
@
arg02
)
order
by
a
;
## insert with two parameter in the set part
set
@
arg00
=
9
;
set
@
arg01
=
'nine'
;
prepare
stmt1
from
'insert into t1 set a=?, b=? '
;
execute
stmt1
using
@
arg00
,
@
arg01
;
select
a
,
b
from
t1
where
a
=
@
arg00
;
## insert with parameters in the ON DUPLICATE KEY part
set
@
arg00
=
6
;
set
@
arg01
=
1
;
prepare
stmt1
from
'insert into t1 set a=?, b=''sechs''
on duplicate key update a=a + ?, b=concat(b,''modified'') '
;
# There is no primary key collision, so there will be no key column update
# If a key column update would be necessary occurs BUG#4312
# deactivated, activate when BUG#4312: is solved
# execute stmt1 using @arg00, @arg01;
select
*
from
t1
order
by
a
;
set
@
arg00
=
81
;
set
@
arg01
=
1
;
# deactivated, activate when BUG#4312: is solved
# execute stmt1 using @arg00, @arg01;
## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '
# cases derived from client_test.c: test_bug3117()
--
disable_warnings
drop
table
if
exists
t2
;
--
enable_warnings
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
eval
create
table
t2
(
id
int
auto_increment
primary
key
)
ENGINE
=
$type
;
prepare
stmt1
from
' select last_insert_id() '
;
insert
into
t2
values
(
NULL
)
;
execute
stmt1
;
insert
into
t2
values
(
NULL
)
;
execute
stmt1
;
drop
table
t2
;
## many parameters
set
@
1000
=
1000
;
set
@
x1000_2
=
"x1000_2"
;
set
@
x1000_3
=
"x1000_3"
;
set
@
x1000
=
"x1000"
;
set
@
1100
=
1100
;
set
@
x1100
=
"x1100"
;
set
@
100
=
100
;
set
@
updated
=
"updated"
;
insert
into
t1
values
(
1000
,
'x1000_1'
)
;
# deactivated, activate when BUG#4312: is solved
# insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
# on duplicate key update a = a + @100, b = concat(b,@updated) ;
select
a
,
b
from
t1
where
a
>=
1000
order
by
a
;
delete
from
t1
where
a
>=
1000
;
insert
into
t1
values
(
1000
,
'x1000_1'
)
;
prepare
stmt1
from
' insert into t1 values(?,?),(?,?)
on duplicate key update a = a + ?, b = concat(b,?) '
;
# deactivated, activate when BUG#4312: is solved
# execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
select
a
,
b
from
t1
where
a
>=
1000
order
by
a
;
delete
from
t1
where
a
>=
1000
;
insert
into
t1
values
(
1000
,
'x1000_1'
)
;
# deactivated, activate when BUG#4312: is solved
# execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
select
a
,
b
from
t1
where
a
>=
1000
order
by
a
;
delete
from
t1
where
a
>=
1000
;
## replace
prepare
stmt1
from
' replace into t1 (a,b) select 100, ''hundred'' '
;
--
error
1031
## multi table statements
--
disable_query_log
select
'------ multi table tests ------'
as
test_sequence
;
--
enable_query_log
# cases derived from client_test.c: test_multi
delete
from
t1
;
delete
from
t9
;
insert
into
t1
(
a
,
b
)
values
(
1
,
'one'
),
(
2
,
'two'
),
(
3
,
'three'
)
;
insert
into
t9
(
c1
,
c21
)
values
(
1
,
'one'
),
(
2
,
'two'
),
(
3
,
'three'
)
;
prepare
stmt_delete
from
" delete t1, t9
from t1, t9 where t1.a=t9.c1 and t1.b='updated' "
;
prepare
stmt_update
from
" update t1, t9
set t1.b='updated', t9.c21='updated'
where t1.a=t9.c1 and t1.a=? "
;
prepare
stmt_select1
from
" select a, b from t1 order by a"
;
prepare
stmt_select2
from
" select c1, c21 from t9 order by c1"
;
set
@
arg00
=
1
;
let
$
1
=
3
;
while
(
$
1
)
{
execute
stmt_update
using
@
arg00
;
execute
stmt_delete
;
execute
stmt_select1
;
execute
stmt_select2
;
set
@
arg00
=
@
arg00
+
1
;
dec
$
1
;
}
--
source
include
/
ps_modify
.
inc
--
source
include
/
ps_modify1
.
inc
--
source
include
/
ps_conv
.
inc
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment