Skip to content

Commit db5b7da

Browse files
committed
Additional fixes
1 parent c7dd040 commit db5b7da

24 files changed

+27
-43
lines changed

ext/pdo_mysql/tests/bug53551.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ $createSql = "CREATE TABLE `bug53551` (
1818
`count` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'
1919
)";
2020

21-
$db->exec('DROP TABLE IF EXISTS bug53551');
2221
$db->exec($createSql);
2322
$db->exec("INSERT INTO bug53551 SET `count` = 1 ");
2423
$db->exec("SET sql_mode = 'Traditional'");

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 & 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/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 & 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/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_init_command.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ error_reporting=E_ALL
1919

2020
$table = 'pdo_mysql_attr_init_command';
2121
$db = new PDO($dsn, $user, $pass);
22-
$db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
2322

2423
$create = sprintf('CREATE TABLE %s(id INT)', $table);
2524
var_dump($create);
@@ -33,7 +32,6 @@ error_reporting=E_ALL
3332
$stmt = $db->query(sprintf('SELECT id FROM %s', $table));
3433
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
3534

36-
$db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
3735
print "done!";
3836
?>
3937
--CLEAN--

ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ error_reporting=E_ALL
2222
$db = new PDO($dsn, $user, $pass);
2323
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
2424
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
25-
$db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
25+
2626
$create = sprintf('CREATE TABLE %s(id INT)', $table);
2727
$db->exec($create);
2828
$db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table));

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_commit.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ MySQLPDOTest::skipNotTransactionalEngine();
2222
}
2323

2424
// DDL will issue an implicit commit
25-
$db->exec(sprintf('DROP TABLE IF EXISTS %s', $table2));
2625
$db->exec(sprintf('CREATE TABLE %s (id INT) ENGINE=%s', $table2, MySQLPDOTest::detect_transactional_mysql_engine($db)));
2726
try {
2827
$db->commit();

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_exec_ddl.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,11 @@ MySQLPDOTest::skip();
4141
$table2 = 'pdo_mysql_exec_ddl_2';
4242
/* affected rows related */
4343
try {
44-
@$db->exec("DROP DATABASE IF EXISTS {$db_name}");
45-
@$db->exec("DROP DATABASE IF EXISTS {$db_name_2}");
4644
if (1 === @$db->exec("CREATE DATABASE {$db_name}")) {
4745
// yippie - we can create databases etc.
4846
exec_and_count(3, $db, "ALTER DATABASE {$db_name} CHARACTER SET latin1", 1);
4947
}
5048

51-
exec_and_count(4, $db, "DROP TABLE IF EXISTS {$table}", 0);
52-
exec_and_count(5, $db, "DROP TABLE IF EXISTS {$table2}", 0);
5349
if (0 === $db->exec("CREATE TABLE {$table} (id INT, col1 CHAR(2))")) {
5450
exec_and_count(5, $db, "CREATE INDEX idx1 ON {$table} (id)", 0);
5551
exec_and_count(6, $db, "DROP INDEX idx1 ON {$table}", 0);

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_rollback.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ MySQLPDOTest::skipNotTransactionalEngine();
3636

3737
$db->beginTransaction();
3838
$db->query("INSERT INTO {$table}(id, label) VALUES (100, 'z')");
39-
$db->query("DROP TABLE IF EXISTS {$table2}");
4039
$db->query("CREATE TABLE {$table2}(id INT)");
4140
$num++;
4241
try {

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 & 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
@@ -39,7 +38,6 @@ MySQLPDOTest::skipVersionThanLess(50000);
3938
try {
4039
// What will happen if a PS returns a different number of result set column upon each execution?
4140
// Lets try with a SP accepting parameters...
42-
$db->exec("DROP PROCEDURE IF EXISTS {$procedure}");
4341
$db->exec("CREATE PROCEDURE {$procedure}(IN cols INT) BEGIN IF cols < 2 THEN SELECT cols AS 'one'; ELSE SELECT 1 AS 'one', cols AS 'two'; END IF; END;");
4442

4543
// Emulates PS first

ext/pdo_mysql/tests/unsigned_bigint.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ require_once __DIR__ . '/inc/mysql_pdo_test.inc';
1515
$pdo = MySQLPDOTest::factory();
1616

1717
$tbl = "unsigned_bigint_pdo_mysql";
18-
$pdo->query("DROP TABLE IF EXISTS $tbl");
1918
$pdo->query("CREATE TABLE $tbl (`ubigint` bigint unsigned NOT NULL) ENGINE=InnoDB");
2019
$pdo->query("INSERT INTO $tbl (`ubigint`) VALUES (18446744073709551615)");
2120
$pdo->query("INSERT INTO $tbl (`ubigint`) VALUES (9223372036854775808)");

0 commit comments

Comments
 (0)