Skip to content

Commit 327f69d

Browse files
committed
Add some tests
1 parent a2ca7c7 commit 327f69d

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

tests/1000rows_001.phpt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
--TEST--
2+
Test 1000+ rows to trigger "Too many concurrent executions of the same request" bug #101
3+
--SKIPIF--
4+
<?php include("skipif.inc"); ?>
5+
--FILE--
6+
<?php
7+
8+
require("interbase.inc");
9+
ibase_connect($test_base);
10+
11+
(function(){
12+
ibase_query(
13+
"CREATE TABLE ITEMS (
14+
ID INTEGER NOT null,
15+
CODE1 VARCHAR(32) CHARACTER SET NONE,
16+
CODE10 VARCHAR(32) CHARACTER SET NONE,
17+
MAN_ID INTEGER
18+
)"
19+
);
20+
ibase_commit_ret();
21+
22+
$data = [
23+
[1, "CODE1 1", "CODE10 1", null],
24+
[2, null, "CODE10 2", 101],
25+
[3, "CODE1 3", null, null],
26+
[4, null, null, 104],
27+
[5, "CODE1 5", null, 105],
28+
[6, "CODE1 6", "CODE10 6", null],
29+
[7, null, "CODE10 7", 107],
30+
[8, null, null, null],
31+
[9, "CODE1 8", "CODE10 9", 109],
32+
];
33+
34+
$sql =
35+
"INSERT INTO ITEMS (
36+
ID, CODE1, CODE10, MAN_ID
37+
) VALUES (
38+
?, ?, ?, ?
39+
)";
40+
41+
$c = 0;
42+
$total_data = count($data);
43+
for ($i = 0; $i < 1001; $i++) {
44+
ibase_query($sql, ...$data[$i % $total_data]);
45+
}
46+
47+
print "OK";
48+
})();
49+
50+
?>
51+
--EXPECT--
52+
OK

tests/recursion_001.phpt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
--TEST--
2+
Test tigger recursion causing large error message
3+
--SKIPIF--
4+
<?php include("skipif.inc"); ?>
5+
--FILE--
6+
<?php
7+
8+
require("interbase.inc");
9+
ibase_connect($test_base);
10+
11+
(function(){
12+
$data = [];
13+
for ($i = 0; $i < 100; $i++) {
14+
$data["key$i"] = $i;
15+
}
16+
17+
ibase_query(
18+
"CREATE TABLE T1 (
19+
ID INTEGER NOT NULL,
20+
CODE VARCHAR(100)
21+
)"
22+
);
23+
ibase_query(
24+
"CREATE TABLE T2 (
25+
ID INTEGER NOT NULL,
26+
CODE VARCHAR(100)
27+
)"
28+
);
29+
ibase_commit_ret();
30+
31+
for ($i = 0; $i < 100; $i++) {
32+
ibase_query("INSERT INTO T1 (ID, CODE) VALUES ($i, '$i-$i-$i-$i')");
33+
ibase_query("INSERT INTO T2 (ID, CODE) VALUES ($i, '$i-$i-$i-$i')");
34+
}
35+
36+
ibase_query(
37+
"CREATE OR ALTER TRIGGER T1_TRIGGER FOR T1
38+
BEFORE INSERT
39+
AS BEGIN
40+
INSERT INTO T2 (ID) VALUES (NULL);
41+
END"
42+
);
43+
ibase_query(
44+
"CREATE OR ALTER TRIGGER T2_TRIGGER FOR T2
45+
BEFORE INSERT
46+
AS BEGIN
47+
INSERT INTO T1 (ID) VALUES (NULL);
48+
END"
49+
);
50+
ibase_commit_ret();
51+
52+
ibase_query("INSERT INTO T1 (ID) VALUES (NULL)");
53+
})();
54+
55+
?>
56+
--EXPECTF--
57+
Warning: ibase_query(): Too many concurrent executions of the same request At trigger '%s' line: %d, col: %d
58+
At trigger 'T1_TRIGGER' line: %d, col: %d
59+
At trigger 'T2_TRIGGER' line: %d, col: %d
60+
%a

0 commit comments

Comments
 (0)