Skip to content

Commit d9ec0d1

Browse files
committed
Additional fixes
1 parent c7dd040 commit d9ec0d1

17 files changed

+26
-33
lines changed

ext/pdo_mysql/tests/bug63185.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
1616

1717
$procedure = 'test_procedure_error_at_second_63185';
1818

19-
$pdo->exec("DROP PROCEDURE IF EXISTS {$procedure}");
2019
$pdo->exec("CREATE PROCEDURE {$procedure} ()
2120
BEGIN
2221
SELECT 'x' AS foo;

ext/pdo_mysql/tests/bug76815.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
1717
$func = 'bug76815_pdo_mysql_f';
1818
$procedure = 'bug76815_pdo_mysql_p';
1919

20-
$pdo->query("DROP FUNCTION IF EXISTS {$func}");
21-
$pdo->query("DROP PROCEDURE IF EXISTS {$procedure}");
2220
$pdo->query("CREATE FUNCTION {$func}() RETURNS VARCHAR(5) DETERMINISTIC BEGIN RETURN 'x12345'; END");
2321
$pdo->query("CREATE PROCEDURE {$procedure}() BEGIN SELECT {$func}(); END");
2422

ext/pdo_mysql/tests/bug_39858.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(50000);
109
?>
1110
--FILE--
1211
<?php
@@ -17,7 +16,6 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
1716
function bug_39858($db) {
1817
$procedure = 'bug_39858_pdo_mysql_p';
1918

20-
$db->exec("DROP PROCEDURE IF EXISTS {$procedure}");
2119
$db->exec("
2220
CREATE PROCEDURE {$procedure}()
2321
NOT DETERMINISTIC

ext/pdo_mysql/tests/bug_41125.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(40100);
109
?>
1110
--FILE--
1211
<?php

ext/pdo_mysql/tests/bug_41997.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(50000);
109
?>
1110
--FILE--
1211
<?php
@@ -16,7 +15,6 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
1615

1716
$procedure = 'bug_41997_pdo_mysql_p';
1817

19-
$db->exec("DROP PROCEDURE IF EXISTS {$procedure}");
2018
$db->exec("CREATE PROCEDURE {$procedure}() BEGIN SELECT 1 AS 'one'; END");
2119

2220
$stmt = $db->query("CALL {$procedure}()");

ext/pdo_mysql/tests/bug_42499.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(40100);
109
?>
1110
--FILE--
1211
<?php

ext/pdo_mysql/tests/bug_44707.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(40100);
109
?>
1110
--FILE--
1211
<?php

ext/pdo_mysql/tests/bug_50323.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ MySQLPDOTest::skip();
5454
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
5555
$db = MySQLPDOTest::factory();
5656

57-
@$db->exec('DROP DATABASE IF EXISTS `crazy;dbname`');
57+
$db->exec('DROP DATABASE IF EXISTS `crazy;dbname`');
5858
?>
5959
--EXPECT--
6060
done!

ext/pdo_mysql/tests/bug_61411.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(40106);
109
?>
1110
--FILE--
1211
<?php

ext/pdo_mysql/tests/bug_pecl_7976.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(50000);
109
?>
1110
--FILE--
1211
<?php
@@ -15,7 +14,6 @@ $db = MySQLPDOTest::factory();
1514

1615
function bug_pecl_7976($db) {
1716
$procedure = 'bug_pecl_7976_pdo_mysql_p';
18-
$db->exec("DROP PROCEDURE IF EXISTS {$procedure}");
1917
$db->exec("CREATE PROCEDURE {$procedure}() BEGIN SELECT '1' AS _one; END;");
2018

2119
$stmt = $db->query("CALL {$procedure}()");

ext/pdo_mysql/tests/inc/mysql_pdo_test.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
require_once __DIR__ . '/config.inc';
3-
require_once __DIR__ . '/../../../../ext/pdo/tests/pdo_test.inc';
3+
require_once dirname(__DIR__, 4) . '/ext/pdo/tests/pdo_test.inc';
44

55
foreach ($env as $k => $v) {
66
define($k, $v);

ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ MySQLPDOTest::skip();
1212
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
1313
$db = MySQLPDOTest::factory();
1414

15+
$procedure = 'pdo_mysql_attr_oracle_nulls_p';
16+
1517
try {
1618
$db->setAttribute(PDO::ATTR_ORACLE_NULLS, []);
1719
} catch (\TypeError $e) {
@@ -47,10 +49,10 @@ MySQLPDOTest::skip();
4749
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
4850
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
4951

50-
if ($have_procedures && (false !== $db->exec('DROP PROCEDURE IF EXISTS p')) &&
51-
(false !== $db->exec("CREATE PROCEDURE p() BEGIN SELECT NULL as z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, ' e' AS e; END;"))) {
52+
if ($have_procedures && (false !== $db->exec("DROP PROCEDURE IF EXISTS {$procedure}")) &&
53+
(false !== $db->exec("CREATE PROCEDURE {$procedure}() BEGIN SELECT NULL as z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, ' e' AS e; END;"))) {
5254
// requires MySQL 5+
53-
$stmt = $db->prepare('CALL p()');
55+
$stmt = $db->prepare("CALL {$procedure}()");
5456
$stmt->execute();
5557
do {
5658
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
@@ -63,11 +65,14 @@ MySQLPDOTest::skip();
6365

6466
}
6567

66-
if ($have_procedures)
67-
@$db->exec('DROP PROCEDURE IF EXISTS p');
68-
6968
print "done!";
7069
?>
70+
--CLEAN--
71+
<?php
72+
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
73+
$db = MySQLPDOTest::factory();
74+
$db->exec("DROP PROCEDURE IF EXISTS pdo_mysql_attr_oracle_nulls_p");
75+
?>
7176
--EXPECTF--
7277
Attribute value must be of type int for selected attribute, array given
7378
Attribute value must be of type int for selected attribute, stdClass given

ext/pdo_mysql/tests/pdo_mysql_exec.phpt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ MySQLPDOTest::skip();
3030
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
3131
$db = MySQLPDOTest::factory();
3232

33+
$procedure = 'pdo_mysql_exec_p';
34+
3335
/* affected rows related */
3436
try {
3537
exec_and_count(2, $db, 'DROP TABLE IF EXISTS test_mysql_exec', 0);
@@ -66,11 +68,11 @@ MySQLPDOTest::skip();
6668
// let's try to play with stored procedures
6769
try {
6870
$ignore_exception = true;
69-
exec_and_count(18, $db, 'DROP PROCEDURE IF EXISTS p', 0);
70-
exec_and_count(19, $db, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INTO ver_param; END;', 0);
71+
exec_and_count(18, $db, "DROP PROCEDURE IF EXISTS {$procedure}", 0);
72+
exec_and_count(19, $db, "CREATE PROCEDURE {$procedure}(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INTO ver_param; END;", 0);
7173
// we got this far without problems. If there's an issue from now on, its a failure
7274
$ignore_exception = false;
73-
exec_and_count(20, $db, 'CALL p(@version)', 1);
75+
exec_and_count(20, $db, "CALL {$procedure}(@version)", 1);
7476
$stmt = $db->query('SELECT @version AS p_version');
7577
$tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
7678
if (count($tmp) > 1 || !isset($tmp[0]['p_version'])) {
@@ -92,7 +94,7 @@ MySQLPDOTest::skip();
9294
$tmp[0]['_version'], gettype($tmp[0]['_version']));
9395
}
9496
}
95-
exec_and_count(25, $db, 'DROP PROCEDURE IF EXISTS p', 0);
97+
exec_and_count(25, $db, "DROP PROCEDURE IF EXISTS {$procedure}", 0);
9698

9799
} catch (PDOException $e) {
98100
// ignore it, we might not have sufficient permissions
@@ -103,13 +105,14 @@ MySQLPDOTest::skip();
103105
}
104106

105107
// stored function
108+
$func = 'pdo_mysql_exec_f';
106109
try {
107110
$ignore_exception = true;
108-
exec_and_count(27, $db, 'DROP FUNCTION IF EXISTS f', 0);
109-
exec_and_count(28, $db, 'CREATE FUNCTION f( ver_param VARCHAR(255)) RETURNS VARCHAR(255) DETERMINISTIC RETURN ver_param;', 0);
111+
exec_and_count(27, $db, "DROP FUNCTION IF EXISTS {$func}", 0);
112+
exec_and_count(28, $db, "CREATE FUNCTION {$func}( ver_param VARCHAR(255)) RETURNS VARCHAR(255) DETERMINISTIC RETURN ver_param;", 0);
110113
// we got this far without problems. If there's an issue from now on, its a failure
111114
$ignore_exception = false;
112-
$stmt = $db->query('SELECT f(VERSION()) AS f_version');
115+
$stmt = $db->query("SELECT {$func}(VERSION()) AS f_version");
113116
$tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
114117
if (count($tmp) > 1 || !isset($tmp[0]['f_version'])) {
115118
printf("[029] Data seems wrong, dumping\n");
@@ -129,7 +132,7 @@ MySQLPDOTest::skip();
129132
$tmp[0]['_version'], gettype($tmp[0]['_version']));
130133
}
131134
}
132-
exec_and_count(32, $db, 'DROP FUNCTION IF EXISTS f', 0);
135+
exec_and_count(32, $db, "DROP FUNCTION IF EXISTS {$func}", 0);
133136

134137
} catch (PDOException $e) {
135138
// ignore it, we might not have sufficient permissions
@@ -169,6 +172,8 @@ MySQLPDOTest::skip();
169172
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
170173
$db = MySQLPDOTest::factory();
171174
$db->query('DROP TABLE IF EXISTS test_mysql_exec');
175+
$db->query('DROP PROCEDURE IF EXISTS pdo_mysql_exec_p');
176+
$db->query('DROP FUNCTION IF EXISTS pdo_mysql_exec_f');
172177
?>
173178
--EXPECTF--
174179
Warning: PDO::exec(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'THIS IS NOT VALID SQL, I HOPE' at line 1 in %s on line %d

ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(50000);
109
?>
1110
--FILE--
1211
<?php

ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(50100);
109
?>
1110
--FILE--
1211
<?php

ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(50000);
109
MySQLPDOTest::skipNotMySQLnd();
1110
?>
1211
--FILE--

ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pdo_mysql
66
<?php
77
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
88
MySQLPDOTest::skip();
9-
MySQLPDOTest::skipVersionThanLess(50000);
109
?>
1110
--FILE--
1211
<?php

0 commit comments

Comments
 (0)