From fca4593545dd6d44b44a54cdb2e746ae8b0ed531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Tue, 10 Oct 2023 09:39:03 +0200 Subject: [PATCH 01/14] Parallelize pdo tests (dblib, firebird, oci, odbc, pgsql) It becomes possibly by using different symbols in all tests. --- ext/pdo/tests/bug_34630.phpt | 16 +++-- ext/pdo/tests/bug_35671.phpt | 12 +++- ext/pdo/tests/bug_36428.phpt | 12 +++- ext/pdo/tests/bug_36798.phpt | 14 ++-- ext/pdo/tests/bug_38253.phpt | 14 ++-- ext/pdo/tests/bug_38394.phpt | 12 +++- ext/pdo/tests/bug_39398.phpt | 12 +++- ext/pdo/tests/bug_39656.phpt | 14 ++-- ext/pdo/tests/bug_40285.phpt | 10 ++- ext/pdo/tests/bug_42917.phpt | 12 +++- ext/pdo/tests/bug_43130.phpt | 12 +++- ext/pdo/tests/bug_44173.phpt | 22 +++--- ext/pdo/tests/bug_44409.phpt | 12 +++- ext/pdo/tests/bug_50458.phpt | 12 +++- ext/pdo/tests/bug_52098.phpt | 17 +++-- ext/pdo/tests/bug_64172.phpt | 17 +++-- ext/pdo/tests/bug_65946.phpt | 16 +++-- ext/pdo/tests/bug_71447.phpt | 24 ++++--- ext/pdo/tests/bug_71885.phpt | 10 ++- ext/pdo/tests/bug_73234.phpt | 14 ++-- ext/pdo/tests/gh8626.phpt | 12 +++- ext/pdo/tests/pdo_001.phpt | 16 +++-- ext/pdo/tests/pdo_002.phpt | 16 +++-- ext/pdo/tests/pdo_003.phpt | 16 +++-- ext/pdo/tests/pdo_004.phpt | 16 +++-- ext/pdo/tests/pdo_005.phpt | 14 ++-- ext/pdo/tests/pdo_006.phpt | 16 +++-- ext/pdo/tests/pdo_007.phpt | 16 +++-- ext/pdo/tests/pdo_008.phpt | 16 +++-- ext/pdo/tests/pdo_009.phpt | 27 +++++--- ext/pdo/tests/pdo_010.phpt | 27 +++++--- ext/pdo/tests/pdo_011.phpt | 22 +++--- ext/pdo/tests/pdo_012.phpt | 14 ++-- ext/pdo/tests/pdo_013.phpt | 14 ++-- ext/pdo/tests/pdo_014.phpt | 14 ++-- ext/pdo/tests/pdo_015.phpt | 16 +++-- ext/pdo/tests/pdo_016.phpt | 22 +++--- ext/pdo/tests/pdo_016a.phpt | 22 +++--- ext/pdo/tests/pdo_017.phpt | 18 +++-- ext/pdo/tests/pdo_018.phpt | 35 ++++++---- ext/pdo/tests/pdo_019.phpt | 20 ++++-- ext/pdo/tests/pdo_020.phpt | 22 +++--- ext/pdo/tests/pdo_021.phpt | 14 ++-- ext/pdo/tests/pdo_022.phpt | 14 ++-- ext/pdo/tests/pdo_023.phpt | 16 +++-- ext/pdo/tests/pdo_024.phpt | 14 ++-- ext/pdo/tests/pdo_025.phpt | 12 +++- ext/pdo/tests/pdo_026.phpt | 12 +++- ext/pdo/tests/pdo_027.phpt | 14 ++-- ext/pdo/tests/pdo_028.phpt | 12 +++- ext/pdo/tests/pdo_029.phpt | 12 +++- ext/pdo/tests/pdo_030.phpt | 12 +++- ext/pdo/tests/pdo_031.phpt | 12 +++- ext/pdo/tests/pdo_032.phpt | 18 +++-- ext/pdo/tests/pdo_033.phpt | 17 ++--- ext/pdo/tests/pdo_034.phpt | 18 +++-- ext/pdo/tests/pdo_test.inc | 15 +--- ext/pdo/tests/pecl_bug_5217.phpt | 8 ++- ext/pdo/tests/pecl_bug_5772.phpt | 12 +++- ext/pdo/tests/pecl_bug_5809.phpt | 12 +++- ext/pdo_dblib/tests/CONFLICTS | 1 - ext/pdo_dblib/tests/batch_stmt_ins_exec.phpt | 16 ++--- .../tests/batch_stmt_ins_sel_up_del.phpt | 14 ++-- ext/pdo_dblib/tests/batch_stmt_ins_up.phpt | 10 +-- ext/pdo_dblib/tests/batch_stmt_rowcount.phpt | 14 ++-- .../tests/batch_stmt_transaction.phpt | 14 ++-- ext/pdo_dblib/tests/batch_stmt_try.phpt | 14 ++-- ext/pdo_dblib/tests/bug_38955.phpt | 27 ++++---- ext/pdo_dblib/tests/bug_47588.phpt | 16 +++-- ext/pdo_firebird/tests/CONFLICTS | 1 - ext/pdo_firebird/tests/bug_47415.phpt | 15 ++-- ext/pdo_firebird/tests/bug_48877.phpt | 22 +++--- ext/pdo_firebird/tests/bug_53280.phpt | 18 ++--- ext/pdo_firebird/tests/bug_62024.phpt | 14 ++-- ext/pdo_firebird/tests/bug_64037.phpt | 20 +++--- ext/pdo_firebird/tests/bug_72583.phpt | 11 ++- ext/pdo_firebird/tests/bug_72931.phpt | 9 ++- ext/pdo_firebird/tests/bug_73087.phpt | 9 ++- ext/pdo_firebird/tests/bug_74462.phpt | 15 ++-- ext/pdo_firebird/tests/bug_aaa.phpt | 11 ++- ext/pdo_firebird/tests/ddl.phpt | 43 ++++++------ ext/pdo_firebird/tests/dialect_1.phpt | 68 ++++++++++--------- ext/pdo_firebird/tests/execute.phpt | 52 +++++++------- ext/pdo_firebird/tests/rowCount.phpt | 22 +++--- ext/pdo_oci/tests/CONFLICTS | 2 - ext/pdo_oci/tests/bug46274.phpt | 20 +++--- ext/pdo_oci/tests/bug46274_2.phpt | 19 +++--- ext/pdo_oci/tests/bug54379.phpt | 11 +-- ext/pdo_oci/tests/bug57702.phpt | 31 ++++----- ext/pdo_oci/tests/bug60994.phpt | 7 +- .../tests/pdo_oci_attr_autocommit_1.phpt | 16 +++-- .../tests/pdo_oci_attr_autocommit_2.phpt | 8 ++- .../tests/pdo_oci_attr_autocommit_3.phpt | 17 ++--- ext/pdo_oci/tests/pdo_oci_fread_1.phpt | 24 +++---- ext/pdo_oci/tests/pdo_oci_quote1.phpt | 18 ++--- .../tests/pdo_oci_stmt_getcolumnmeta.phpt | 39 +++++------ ext/pdo_oci/tests/pdo_oci_stream_1.phpt | 29 +++----- ext/pdo_oci/tests/pdo_oci_stream_2.phpt | 23 +++---- ext/pdo_oci/tests/pecl_bug_6364.phpt | 22 +++--- ext/pdo_odbc/tests/CONFLICTS | 1 - ext/pdo_odbc/tests/bug80783.phpt | 2 +- ext/pdo_odbc/tests/bug80783a.phpt | 2 +- ext/pdo_odbc/tests/long_columns.phpt | 16 +++-- ext/pdo_odbc/tests/max_columns.phpt | 16 +++-- ext/pdo_pgsql/tests/CONFLICTS | 1 - ext/pdo_pgsql/tests/bug36727.phpt | 8 ++- ext/pdo_pgsql/tests/bug43925.phpt | 21 +++--- ext/pdo_pgsql/tests/bug62479.phpt | 16 +++-- ext/pdo_pgsql/tests/bug62498-32bit.phpt | 30 ++++---- ext/pdo_pgsql/tests/bug62498.phpt | 29 ++++---- ext/pdo_pgsql/tests/bug66584.phpt | 10 +-- ext/pdo_pgsql/tests/bug67462.phpt | 6 +- ext/pdo_pgsql/tests/bug69362.phpt | 16 ++--- ext/pdo_pgsql/tests/bug69752.phpt | 4 +- ext/pdo_pgsql/tests/bug70861.phpt | 8 +-- ext/pdo_pgsql/tests/bug72294.phpt | 4 +- ext/pdo_pgsql/tests/bug72633.phpt | 8 +-- 117 files changed, 1135 insertions(+), 744 deletions(-) delete mode 100644 ext/pdo_dblib/tests/CONFLICTS delete mode 100644 ext/pdo_firebird/tests/CONFLICTS delete mode 100644 ext/pdo_oci/tests/CONFLICTS delete mode 100644 ext/pdo_odbc/tests/CONFLICTS delete mode 100644 ext/pdo_pgsql/tests/CONFLICTS diff --git a/ext/pdo/tests/bug_34630.phpt b/ext/pdo/tests/bug_34630.phpt index 5eb4ce27f3895..052aebea64fb2 100644 --- a/ext/pdo/tests/bug_34630.phpt +++ b/ext/pdo/tests/bug_34630.phpt @@ -19,9 +19,9 @@ $driver = $db->getAttribute(PDO::ATTR_DRIVER_NAME); $is_oci = $driver == 'oci'; if ($is_oci) { - $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val BLOB)'); + $db->exec('CREATE TABLE test34630 (id int NOT NULL PRIMARY KEY, val BLOB)'); } else { - $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(256))'); + $db->exec('CREATE TABLE test34630 (id int NOT NULL PRIMARY KEY, val VARCHAR(256))'); } $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -34,17 +34,23 @@ if ($is_oci) { * the empty blob will be committed implicitly when the statement is * executed */ $db->beginTransaction(); - $insert = $db->prepare("insert into test (id, val) values (1, EMPTY_BLOB()) RETURNING val INTO :blob"); + $insert = $db->prepare("insert into test34630 (id, val) values (1, EMPTY_BLOB()) RETURNING val INTO :blob"); } else { - $insert = $db->prepare("insert into test (id, val) values (1, :blob)"); + $insert = $db->prepare("insert into test34630 (id, val) values (1, :blob)"); } $insert->bindValue(':blob', $fp, PDO::PARAM_LOB); $insert->execute(); $insert = null; $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); -var_dump($db->query("SELECT * from test")->fetchAll(PDO::FETCH_ASSOC)); +var_dump($db->query("SELECT * from test34630")->fetchAll(PDO::FETCH_ASSOC)); +?> +--CLEAN-- +exec("DROP TABLE test34630"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_35671.phpt b/ext/pdo/tests/bug_35671.phpt index 82a05385bad5c..025073e80fccd 100644 --- a/ext/pdo/tests/bug_35671.phpt +++ b/ext/pdo/tests/bug_35671.phpt @@ -15,10 +15,10 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test (field1 VARCHAR(32), field2 VARCHAR(32), field3 VARCHAR(32))'); +$db->exec('CREATE TABLE test35671 (field1 VARCHAR(32), field2 VARCHAR(32), field3 VARCHAR(32))'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$insert = $db->prepare("insert into test (field1, field2, field3) values (:value1, :value2, :value3)"); +$insert = $db->prepare("insert into test35671 (field1, field2, field3) values (:value1, :value2, :value3)"); $parm = array( ":value1" => 15, @@ -29,8 +29,14 @@ $parm = array( $insert->execute($parm); $insert = null; -var_dump($db->query("SELECT * from test")->fetchAll(PDO::FETCH_ASSOC)); +var_dump($db->query("SELECT * from test35671")->fetchAll(PDO::FETCH_ASSOC)); +?> +--CLEAN-- +exec("DROP TABLE test35671"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_36428.phpt b/ext/pdo/tests/bug_36428.phpt index 70dc662591136..6f3d25ac35e17 100644 --- a/ext/pdo/tests/bug_36428.phpt +++ b/ext/pdo/tests/bug_36428.phpt @@ -16,11 +16,17 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (a VARCHAR(10))"); -$db->exec("INSERT INTO test (a) VALUES ('xyz')"); -$res = $db->query("SELECT a FROM test"); +$db->exec("CREATE TABLE test36428 (a VARCHAR(10))"); +$db->exec("INSERT INTO test36428 (a) VALUES ('xyz')"); +$res = $db->query("SELECT a FROM test36428"); var_dump($res->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'SimpleXMLElement', array(''))); +?> +--CLEAN-- +exec("DROP TABLE test36428"); ?> --EXPECTF-- array(1) { diff --git a/ext/pdo/tests/bug_36798.phpt b/ext/pdo/tests/bug_36798.phpt index da258bc87d34d..d7d982bcf1c53 100644 --- a/ext/pdo/tests/bug_36798.phpt +++ b/ext/pdo/tests/bug_36798.phpt @@ -26,18 +26,24 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); @$db->exec("SET NAMES 'LATIN1'"); // needed for PostgreSQL -$db->exec("CREATE TABLE test (id INTEGER)"); -$db->exec("INSERT INTO test (id) VALUES (1)"); +$db->exec("CREATE TABLE test36798 (id INTEGER)"); +$db->exec("INSERT INTO test36798 (id) VALUES (1)"); -$stmt = $db->prepare("SELECT 'ร' as test FROM test WHERE id = :id"); +$stmt = $db->prepare("SELECT '๏ฟฝ' as test FROM test36798 WHERE id = :id"); $stmt->execute(array(":id" => 1)); $row = $stmt->fetch(PDO::FETCH_NUM); var_dump( $row ); +?> +--CLEAN-- +exec("DROP TABLE test36798"); ?> --EXPECT-- array(1) { [0]=> - string(1) "ร" + string(1) "๏ฟฝ" } diff --git a/ext/pdo/tests/bug_38253.phpt b/ext/pdo/tests/bug_38253.phpt index ccd28a90f6896..8a6ec89a8070e 100644 --- a/ext/pdo/tests/bug_38253.phpt +++ b/ext/pdo/tests/bug_38253.phpt @@ -15,19 +15,25 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $pdo = PDOTest::factory(); -$pdo->exec ("create table test (id integer primary key, n varchar(255))"); -$pdo->exec ("INSERT INTO test (id, n) VALUES (1, 'hi')"); +$pdo->exec ("create table test38253 (id integer primary key, n varchar(255))"); +$pdo->exec ("INSERT INTO test38253 (id, n) VALUES (1, 'hi')"); $pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_CLASS); -$stmt = $pdo->prepare ("SELECT * FROM test"); +$stmt = $pdo->prepare ("SELECT * FROM test38253"); $stmt->execute(); var_dump($stmt->fetchAll()); $pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_FUNC); -$stmt = $pdo->prepare ("SELECT * FROM test"); +$stmt = $pdo->prepare ("SELECT * FROM test38253"); $stmt->execute(); var_dump($stmt->fetchAll()); +?> +--CLEAN-- +exec("DROP TABLE test38253"); ?> --EXPECTF-- Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: No fetch class specified in %s on line %d diff --git a/ext/pdo/tests/bug_38394.phpt b/ext/pdo/tests/bug_38394.phpt index 56bcb0dc1fa35..d545cc24b2c5e 100644 --- a/ext/pdo/tests/bug_38394.phpt +++ b/ext/pdo/tests/bug_38394.phpt @@ -16,8 +16,8 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (a INT, b INT, c INT)"); -$s = $db->prepare("INSERT INTO test (a,b,c) VALUES (:a,:b,:c)"); +$db->exec("CREATE TABLE test38394 (a INT, b INT, c INT)"); +$s = $db->prepare("INSERT INTO test38394 (a,b,c) VALUES (:a,:b,:c)"); $s->execute(array('a' => 1, 'b' => 2, 'c' => 3)); @@ -25,7 +25,13 @@ $s->execute(array('a' => 1, 'b' => 2, 'c' => 3)); $s->execute(array('a' => 9, 'b' => 10, 'c' => 11)); -var_dump($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_ASSOC)); +var_dump($db->query("SELECT * FROM test38394")->fetchAll(PDO::FETCH_ASSOC)); +?> +--CLEAN-- +exec("DROP TABLE test38394"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo/tests/bug_39398.phpt b/ext/pdo/tests/bug_39398.phpt index 5bb05cec2fe3c..91f490db64354 100644 --- a/ext/pdo/tests/bug_39398.phpt +++ b/ext/pdo/tests/bug_39398.phpt @@ -15,14 +15,20 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (test INT)"); +$db->exec("CREATE TABLE test39398 (test INT)"); $boolean = 1; -$stmt = $db->prepare('INSERT INTO test VALUES (:boolean)'); +$stmt = $db->prepare('INSERT INTO test39398 VALUES (:boolean)'); $stmt->bindValue(':boolean', isset($boolean), PDO::PARAM_INT); $stmt->execute(); -var_dump($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_ASSOC)); +var_dump($db->query("SELECT * FROM test39398")->fetchAll(PDO::FETCH_ASSOC)); +?> +--CLEAN-- +exec("DROP TABLE test39398"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_39656.phpt b/ext/pdo/tests/bug_39656.phpt index 0ab218556fabd..e0aa11c700e94 100644 --- a/ext/pdo/tests/bug_39656.phpt +++ b/ext/pdo/tests/bug_39656.phpt @@ -16,13 +16,12 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -@$db->exec("DROP TABLE test"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$db->exec("CREATE TABLE test (id INTEGER NOT NULL PRIMARY KEY, usr VARCHAR( 256 ) NOT NULL)"); -$db->exec("INSERT INTO test (id, usr) VALUES (1, 'user')"); +$db->exec("CREATE TABLE test39656 (id INTEGER NOT NULL PRIMARY KEY, usr VARCHAR( 256 ) NOT NULL)"); +$db->exec("INSERT INTO test39656 (id, usr) VALUES (1, 'user')"); -$stmt = $db->prepare("SELECT * FROM test WHERE id = ?"); +$stmt = $db->prepare("SELECT * FROM test39656 WHERE id = ?"); $stmt->bindValue(1, 1, PDO::PARAM_INT ); $stmt->execute(); $row = $stmt->fetch(); @@ -33,9 +32,14 @@ $stmt->closeCursor(); $row = $stmt->fetch(); // this line will crash CLI var_dump( $row ); -@$db->exec("DROP TABLE test"); echo "Done\n"; ?> +--CLEAN-- +exec("DROP TABLE test39656"); +?> --EXPECT-- array(4) { ["id"]=> diff --git a/ext/pdo/tests/bug_40285.phpt b/ext/pdo/tests/bug_40285.phpt index 3dac06aa4b4a4..d8bd72f22a629 100644 --- a/ext/pdo/tests/bug_40285.phpt +++ b/ext/pdo/tests/bug_40285.phpt @@ -16,13 +16,19 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test (field1 VARCHAR(32), field2 VARCHAR(32), field3 VARCHAR(32), field4 INT)'); +$db->exec('CREATE TABLE test40285 (field1 VARCHAR(32), field2 VARCHAR(32), field3 VARCHAR(32), field4 INT)'); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); -$s = $db->prepare("INSERT INTO test VALUES( ':id', 'name', 'section', 22)" ); +$s = $db->prepare("INSERT INTO test40285 VALUES( ':id', 'name', 'section', 22)" ); $s->execute(); echo "Done\n"; ?> +--CLEAN-- +exec("DROP TABLE test40285"); +?> --EXPECT-- Done diff --git a/ext/pdo/tests/bug_42917.phpt b/ext/pdo/tests/bug_42917.phpt index 39ef42ed87d4a..e2350cc21e646 100644 --- a/ext/pdo/tests/bug_42917.phpt +++ b/ext/pdo/tests/bug_42917.phpt @@ -15,16 +15,22 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))"); +$db->exec("CREATE TABLE test42917 (a varchar(100), b varchar(100), c varchar(100))"); for ($i = 0; $i < 5; $i++) { - $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); + $db->exec("INSERT INTO test42917 (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); } -$res = $db->query("SELECT a,b FROM test"); +$res = $db->query("SELECT a,b FROM test42917"); $res->setFetchMode(PDO::FETCH_KEY_PAIR); var_dump($res->fetchAll()); +?> +--CLEAN-- +exec("DROP TABLE test42917"); ?> --EXPECT-- array(5) { diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt index 541e1b15a5a53..b483b0448303c 100644 --- a/ext/pdo/tests/bug_43130.phpt +++ b/ext/pdo/tests/bug_43130.phpt @@ -23,18 +23,24 @@ $db = PDOTest::factory(); if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); -$db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))"); +$db->exec("CREATE TABLE test43130 (a varchar(100), b varchar(100), c varchar(100))"); for ($i = 0; $i < 5; $i++) { - $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); + $db->exec("INSERT INTO test43130 (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); } -$stmt = $db->prepare("SELECT a FROM test WHERE b=:id-value"); +$stmt = $db->prepare("SELECT a FROM test43130 WHERE b=:id-value"); $stmt->bindParam(':id-value', $id); $id = '1'; $stmt->execute(); var_dump($stmt->fetch(PDO::FETCH_COLUMN)); ?> +--CLEAN-- +exec("DROP TABLE test43130"); +?> --EXPECTF-- Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in %s on line %d bool(false) diff --git a/ext/pdo/tests/bug_44173.phpt b/ext/pdo/tests/bug_44173.phpt index 52188a9d31ade..a8856f7005f0e 100644 --- a/ext/pdo/tests/bug_44173.phpt +++ b/ext/pdo/tests/bug_44173.phpt @@ -15,13 +15,13 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (x int)"); -$db->exec("INSERT INTO test VALUES (1)"); +$db->exec("CREATE TABLE test44173 (x int)"); +$db->exec("INSERT INTO test44173 VALUES (1)"); // Bug entry [2] -- 1 is PDO::FETCH_LAZY try { - $stmt = $db->query("SELECT * FROM test", PDO::FETCH_LAZY, 0, []); + $stmt = $db->query("SELECT * FROM test44173", PDO::FETCH_LAZY, 0, []); var_dump($stmt); } catch (\TypeError $e) { echo $e->getMessage(), \PHP_EOL; @@ -30,14 +30,14 @@ try { // Bug entry [3] try { - $stmt = $db->query("SELECT * FROM test", 'abc'); + $stmt = $db->query("SELECT * FROM test44173", 'abc'); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } // Bug entry [4] try { - $stmt = $db->query("SELECT * FROM test", PDO::FETCH_CLASS, 0, 0, 0); + $stmt = $db->query("SELECT * FROM test44173", PDO::FETCH_CLASS, 0, 0, 0); var_dump($stmt); } catch (\ArgumentCountError $e) { echo $e->getMessage(), \PHP_EOL; @@ -46,7 +46,7 @@ try { // Bug entry [5] try { - $stmt = $db->query("SELECT * FROM test", PDO::FETCH_INTO); + $stmt = $db->query("SELECT * FROM test44173", PDO::FETCH_INTO); var_dump($stmt); } catch (\ArgumentCountError $e) { echo $e->getMessage(), \PHP_EOL; @@ -55,7 +55,7 @@ try { // Bug entry [6] try { - $stmt = $db->query("SELECT * FROM test", PDO::FETCH_COLUMN); + $stmt = $db->query("SELECT * FROM test44173", PDO::FETCH_COLUMN); var_dump($stmt); } catch (\ArgumentCountError $e) { echo $e->getMessage(), \PHP_EOL; @@ -64,13 +64,19 @@ try { // Bug entry [7] try { - $stmt = $db->query("SELECT * FROM test", PDO::FETCH_CLASS); + $stmt = $db->query("SELECT * FROM test44173", PDO::FETCH_CLASS); var_dump($stmt); } catch (\ArgumentCountError $e) { echo $e->getMessage(), \PHP_EOL; } +?> +--CLEAN-- +exec("DROP TABLE test44173"); ?> --EXPECT-- PDO::query() expects exactly 2 arguments for the fetch mode provided, 4 given diff --git a/ext/pdo/tests/bug_44409.phpt b/ext/pdo/tests/bug_44409.phpt index 6d2f2218d65ef..cdb08cb589551 100644 --- a/ext/pdo/tests/bug_44409.phpt +++ b/ext/pdo/tests/bug_44409.phpt @@ -15,8 +15,8 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (dat varchar(100))"); -$db->exec("INSERT INTO test (dat) VALUES ('Data from DB')"); +$db->exec("CREATE TABLE test44409 (dat varchar(100))"); +$db->exec("INSERT INTO test44409 (dat) VALUES ('Data from DB')"); class bug44409 implements Serializable { @@ -36,10 +36,16 @@ class bug44409 implements Serializable } } -$stmt = $db->query("SELECT * FROM test"); +$stmt = $db->query("SELECT * FROM test44409"); print_r($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, "bug44409")); +?> +--CLEAN-- +exec("DROP TABLE test44409"); ?> --EXPECTF-- Deprecated: %s implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d diff --git a/ext/pdo/tests/bug_50458.phpt b/ext/pdo/tests/bug_50458.phpt index bb94c5a74928b..ea67b71f1bc0c 100644 --- a/ext/pdo/tests/bug_50458.phpt +++ b/ext/pdo/tests/bug_50458.phpt @@ -15,11 +15,17 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (a VARCHAR(10))"); -$db->exec("INSERT INTO test (a) VALUES ('xyz')"); -$res = $db->query("SELECT a FROM test"); +$db->exec("CREATE TABLE test50458 (a VARCHAR(10))"); +$db->exec("INSERT INTO test50458 (a) VALUES ('xyz')"); +$res = $db->query("SELECT a FROM test50458"); var_dump($res->fetchAll(PDO::FETCH_FUNC, function($a) { return strtoupper($a); })); +?> +--CLEAN-- +exec("DROP TABLE test50458"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_52098.phpt b/ext/pdo/tests/bug_52098.phpt index b147a6104849d..17bbf847774d0 100644 --- a/ext/pdo/tests/bug_52098.phpt +++ b/ext/pdo/tests/bug_52098.phpt @@ -15,9 +15,8 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -@$db->exec("DROP TABLE test"); -$db->exec("CREATE TABLE test (x int)"); -$db->exec("INSERT INTO test VALUES (1)"); +$db->exec("CREATE TABLE test52098 (x int)"); +$db->exec("INSERT INTO test52098 VALUES (1)"); class MyStatement extends PDOStatement { @@ -29,7 +28,7 @@ class MyStatement extends PDOStatement /* Test prepared statement with PDOStatement class. */ -$derived = $db->prepare('SELECT * FROM test', array(PDO::ATTR_STATEMENT_CLASS=>array('MyStatement'))); +$derived = $db->prepare('SELECT * FROM test52098', array(PDO::ATTR_STATEMENT_CLASS=>array('MyStatement'))); $derived->execute(); $derived->foo(); $derived->fetchAll(); @@ -39,7 +38,7 @@ $derived = null; Test regular statement with PDOStatement class. */ $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('MyStatement')); -$r = $db->query('SELECT * FROM test'); +$r = $db->query('SELECT * FROM test52098'); echo $r->bar(); $r->fetchAll(); $r = null; @@ -49,8 +48,12 @@ Test object instance of PDOStatement class. */ $obj = new MyStatement; echo $obj->lucky(); - -$db->exec("DROP TABLE test"); +?> +--CLEAN-- +exec("DROP TABLE test52098"); ?> --EXPECT-- Calling object method 'foo' diff --git a/ext/pdo/tests/bug_64172.phpt b/ext/pdo/tests/bug_64172.phpt index 63f2a19271da4..17d66eb9c4a15 100644 --- a/ext/pdo/tests/bug_64172.phpt +++ b/ext/pdo/tests/bug_64172.phpt @@ -16,9 +16,8 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -@$db->exec("DROP TABLE test"); -$db->exec("CREATE TABLE test (x int)"); -$db->exec("INSERT INTO test VALUES (1)"); +$db->exec("CREATE TABLE test64172 (x int)"); +$db->exec("INSERT INTO test64172 VALUES (1)"); echo "===FAIL===\n"; $db->query('SELECT * FROM bad_table'); @@ -28,7 +27,7 @@ var_dump(is_string($db->errorInfo()[0])) . "\n"; var_dump(is_int($db->errorInfo()[1])) . "\n"; var_dump(is_string($db->errorInfo()[2])) . "\n"; echo "===GOOD===\n"; -$stmt = $db->query('SELECT * FROM test'); +$stmt = $db->query('SELECT * FROM test64172'); $stmt->fetchAll(); $stmt = null; var_dump($db->errorInfo()); @@ -41,10 +40,14 @@ var_dump(is_string($db->errorInfo()[0])) . "\n"; var_dump(is_int($db->errorInfo()[1])) . "\n"; var_dump(is_string($db->errorInfo()[2])) . "\n"; echo "===GOOD===\n"; -$db->exec("INSERT INTO test VALUES (2)"); +$db->exec("INSERT INTO test64172 VALUES (2)"); var_dump($db->errorInfo()); - -$db->exec("DROP TABLE test"); +?> +--CLEAN-- +exec("DROP TABLE test64172"); ?> --EXPECTF-- ===FAIL=== diff --git a/ext/pdo/tests/bug_65946.phpt b/ext/pdo/tests/bug_65946.phpt index ea73835502d89..79a1f7158be4f 100644 --- a/ext/pdo/tests/bug_65946.phpt +++ b/ext/pdo/tests/bug_65946.phpt @@ -15,8 +15,8 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); -$db->exec('CREATE TABLE test(id int)'); -$db->exec('INSERT INTO test VALUES(1)'); +$db->exec('CREATE TABLE test65946(id int)'); +$db->exec('INSERT INTO test65946 VALUES(1)'); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': $sql = 'SELECT TOP :limit * FROM test'; @@ -28,11 +28,11 @@ switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { $sql = 'SELECT FIRST :limit * FROM test'; break; case 'oci': - //$sql = 'SELECT * FROM test FETCH FIRST :limit ROWS ONLY'; // Oracle 12c syntax - $sql = "select id from (select a.*, rownum rnum from (SELECT * FROM test) a where rownum <= :limit)"; + //$sql = 'SELECT * FROM test65946 FETCH FIRST :limit ROWS ONLY'; // Oracle 12c syntax + $sql = "select id from (select a.*, rownum rnum from (SELECT * FROM test65946) a where rownum <= :limit)"; break; default: - $sql = 'SELECT * FROM test LIMIT :limit'; + $sql = 'SELECT * FROM test65946 LIMIT :limit'; break; } $stmt = $db->prepare($sql); @@ -41,6 +41,12 @@ if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); ?> +--CLEAN-- +exec("DROP TABLE test65946"); +?> --EXPECT-- array(1) { [0]=> diff --git a/ext/pdo/tests/bug_71447.phpt b/ext/pdo/tests/bug_71447.phpt index b820444935253..e23374d9b3f7f 100644 --- a/ext/pdo/tests/bug_71447.phpt +++ b/ext/pdo/tests/bug_71447.phpt @@ -18,14 +18,14 @@ $db = PDOTest::factory(); $db->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING); $db->setAttribute (\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_NUM); $db->setAttribute (\PDO::ATTR_EMULATE_PREPARES, false); -$db->exec('CREATE TABLE test(id int)'); -$db->exec('INSERT INTO test VALUES(1)'); +$db->exec('CREATE TABLE test71447(id int)'); +$db->exec('INSERT INTO test71447 VALUES(1)'); // Comment without quotes or placeholders $stmt = $db->prepare(" SELECT -- That's all folks! '\"abc\":8000' - FROM test + FROM test71447 "); $stmt->execute(); @@ -35,7 +35,7 @@ var_dump($stmt->fetchColumn()); $stmt = $db->prepare(" SELECT '\"abc\":8001 -- Wat?' - FROM test + FROM test71447 "); $stmt->execute(); @@ -45,7 +45,7 @@ var_dump($stmt->fetchColumn()); $stmt = $db->prepare(" SELECT -- That's all folks! '\"abc\":8002' - FROM test + FROM test71447 "); $stmt->execute(); @@ -55,7 +55,7 @@ var_dump($stmt->fetchColumn()); $stmt = $db->prepare(" SELECT /* That's all folks! */ '\"abc\":8003' - FROM test + FROM test71447 "); $stmt->execute(); @@ -65,7 +65,7 @@ var_dump($stmt->fetchColumn()); $stmt = $db->prepare(" SELECT -- Is it only \"single quotes? '\"abc\":8004' - FROM test + FROM test71447 "); $stmt->execute(); @@ -75,7 +75,7 @@ var_dump($stmt->fetchColumn()); $stmt = $db->prepare(" SELECT -- What about question marks here? * - FROM test + FROM test71447 WHERE id = ? "); @@ -86,7 +86,7 @@ var_dump($stmt->fetchColumn()); $stmt = $db->prepare(" SELECT -- What about placeholders :bar * - FROM test + FROM test71447 WHERE id = :id "); @@ -94,6 +94,12 @@ $stmt->execute(['id' => 1]); var_dump($stmt->fetchColumn()); +?> +--CLEAN-- +exec("DROP TABLE test71447"); ?> --EXPECT-- string(10) ""abc":8000" diff --git a/ext/pdo/tests/bug_71885.phpt b/ext/pdo/tests/bug_71885.phpt index 9281de8d89a0d..d13457768310b 100644 --- a/ext/pdo/tests/bug_71885.phpt +++ b/ext/pdo/tests/bug_71885.phpt @@ -19,9 +19,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$db->exec("CREATE TABLE test (a int)"); +$db->exec("CREATE TABLE test71885 (a int)"); -$sql = "SELECT * FROM test WHERE a ?? 1"; +$sql = "SELECT * FROM test71885 WHERE a ?? 1"; try { $db->exec($sql); @@ -47,6 +47,12 @@ try { var_dump(strpos($e->getMessage(), "?") !== false); } +?> +--CLEAN-- +exec("DROP TABLE test71885"); ?> --EXPECT-- bool(true) diff --git a/ext/pdo/tests/bug_73234.phpt b/ext/pdo/tests/bug_73234.phpt index 5f8f620cad80a..5ccd4c52e9ae4 100644 --- a/ext/pdo/tests/bug_73234.phpt +++ b/ext/pdo/tests/bug_73234.phpt @@ -25,15 +25,15 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': - $sql = 'CREATE TABLE test(id INT NULL)'; + $sql = 'CREATE TABLE test73234(id INT NULL)'; break; default: - $sql = 'CREATE TABLE test(id INT)'; + $sql = 'CREATE TABLE test73234(id INT)'; break; } $db->exec($sql); -$stmt = $db->prepare('INSERT INTO test VALUES(:value)'); +$stmt = $db->prepare('INSERT INTO test73234 VALUES(:value)'); $stmt->bindValue(':value', 0, PDO::PARAM_NULL); $stmt->execute(); @@ -41,9 +41,15 @@ $stmt->execute(); $stmt->bindValue(':value', null, PDO::PARAM_NULL); $stmt->execute(); -$stmt = $db->query('SELECT * FROM test'); +$stmt = $db->query('SELECT * FROM test73234'); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); ?> +--CLEAN-- +exec("DROP TABLE test73234"); +?> --EXPECT-- array(2) { [0]=> diff --git a/ext/pdo/tests/gh8626.phpt b/ext/pdo/tests/gh8626.phpt index 0a6f81b6a9c00..0a7d7712f9f76 100644 --- a/ext/pdo/tests/gh8626.phpt +++ b/ext/pdo/tests/gh8626.phpt @@ -21,10 +21,10 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -$db->exec('DROP TABLE test'); -$db->exec('CREATE TABLE test (x int NOT NULL)'); +$db->exec('DROP TABLE test8626'); +$db->exec('CREATE TABLE test8626 (x int NOT NULL)'); -$stmt = $db->prepare('INSERT INTO test VALUES(?)'); +$stmt = $db->prepare('INSERT INTO test8626 VALUES(?)'); // fail var_dump($stmt->execute([null]), $stmt->errorCode()); @@ -39,6 +39,12 @@ $errorInfo = $stmt->errorInfo(); var_dump(array_slice($errorInfo, 0, 3)); // odbc, dblib ?> ===DONE=== +--CLEAN-- +exec("DROP TABLE test8626"); +?> --EXPECTF-- bool(false) string(%d) "%s" diff --git a/ext/pdo/tests/pdo_001.phpt b/ext/pdo/tests/pdo_001.phpt index 2c8d27f093689..a751ac562a747 100644 --- a/ext/pdo/tests/pdo_001.phpt +++ b/ext/pdo/tests/pdo_001.phpt @@ -15,16 +15,22 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test VALUES(1, 'A')"); -$db->exec("INSERT INTO test VALUES(2, 'B')"); -$db->exec("INSERT INTO test VALUES(3, 'C')"); +$db->exec('CREATE TABLE test001(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); +$db->exec("INSERT INTO test001 VALUES(1, 'A')"); +$db->exec("INSERT INTO test001 VALUES(2, 'B')"); +$db->exec("INSERT INTO test001 VALUES(3, 'C')"); -$stmt = $db->prepare('SELECT * from test'); +$stmt = $db->prepare('SELECT * from test001'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); ?> +--CLEAN-- +exec("DROP TABLE test001"); +?> --EXPECT-- array(3) { [0]=> diff --git a/ext/pdo/tests/pdo_002.phpt b/ext/pdo/tests/pdo_002.phpt index dd452480aaf35..9f6666b943c62 100644 --- a/ext/pdo/tests/pdo_002.phpt +++ b/ext/pdo/tests/pdo_002.phpt @@ -15,16 +15,22 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test VALUES(1, 'A')"); -$db->exec("INSERT INTO test VALUES(2, 'B')"); -$db->exec("INSERT INTO test VALUES(3, 'C')"); +$db->exec('CREATE TABLE test002(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); +$db->exec("INSERT INTO test002 VALUES(1, 'A')"); +$db->exec("INSERT INTO test002 VALUES(2, 'B')"); +$db->exec("INSERT INTO test002 VALUES(3, 'C')"); -$stmt = $db->prepare('SELECT * from test'); +$stmt = $db->prepare('SELECT * from test002'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_NUM)); ?> +--CLEAN-- +exec("DROP TABLE test002"); +?> --EXPECT-- array(3) { [0]=> diff --git a/ext/pdo/tests/pdo_003.phpt b/ext/pdo/tests/pdo_003.phpt index 25f51a6133ddd..4810b89ed7f25 100644 --- a/ext/pdo/tests/pdo_003.phpt +++ b/ext/pdo/tests/pdo_003.phpt @@ -15,16 +15,22 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test VALUES(1, 'A')"); -$db->exec("INSERT INTO test VALUES(2, 'B')"); -$db->exec("INSERT INTO test VALUES(3, 'C')"); +$db->exec('CREATE TABLE test003(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); +$db->exec("INSERT INTO test003 VALUES(1, 'A')"); +$db->exec("INSERT INTO test003 VALUES(2, 'B')"); +$db->exec("INSERT INTO test003 VALUES(3, 'C')"); -$stmt = $db->prepare('SELECT * from test'); +$stmt = $db->prepare('SELECT * from test003'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); ?> +--CLEAN-- +exec("DROP TABLE test003"); +?> --EXPECT-- array(3) { [0]=> diff --git a/ext/pdo/tests/pdo_004.phpt b/ext/pdo/tests/pdo_004.phpt index 25acfb34b92d4..e10542b9174b1 100644 --- a/ext/pdo/tests/pdo_004.phpt +++ b/ext/pdo/tests/pdo_004.phpt @@ -15,16 +15,22 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test VALUES(1, 'A')"); -$db->exec("INSERT INTO test VALUES(2, 'B')"); -$db->exec("INSERT INTO test VALUES(3, 'C')"); +$db->exec('CREATE TABLE test004(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); +$db->exec("INSERT INTO test004 VALUES(1, 'A')"); +$db->exec("INSERT INTO test004 VALUES(2, 'B')"); +$db->exec("INSERT INTO test004 VALUES(3, 'C')"); -$stmt = $db->prepare('SELECT * from test'); +$stmt = $db->prepare('SELECT * from test004'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_OBJ)); ?> +--CLEAN-- +exec("DROP TABLE test004"); +?> --EXPECTF-- array(3) { [0]=> diff --git a/ext/pdo/tests/pdo_005.phpt b/ext/pdo/tests/pdo_005.phpt index efcd335f76845..44957d1f3fcab 100644 --- a/ext/pdo/tests/pdo_005.phpt +++ b/ext/pdo/tests/pdo_005.phpt @@ -15,10 +15,10 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(10))'); -$db->exec("INSERT INTO test VALUES(1, 'A', 'AA')"); -$db->exec("INSERT INTO test VALUES(2, 'B', 'BB')"); -$db->exec("INSERT INTO test VALUES(3, 'C', 'CC')"); +$db->exec('CREATE TABLE test005(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(10))'); +$db->exec("INSERT INTO test005 VALUES(1, 'A', 'AA')"); +$db->exec("INSERT INTO test005 VALUES(2, 'B', 'BB')"); +$db->exec("INSERT INTO test005 VALUES(3, 'C', 'CC')"); $stmt = $db->prepare('SELECT id, val, val2 from test'); @@ -50,6 +50,12 @@ var_dump($stmt->fetchAll(PDO::FETCH_CLASS, 'TestBase')); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_CLASS, 'TestDerived', array(0))); +?> +--CLEAN-- +exec("DROP TABLE test005"); ?> --EXPECTF-- array(3) { diff --git a/ext/pdo/tests/pdo_006.phpt b/ext/pdo/tests/pdo_006.phpt index ea81fbfaf03be..7e0d931a7b66b 100644 --- a/ext/pdo/tests/pdo_006.phpt +++ b/ext/pdo/tests/pdo_006.phpt @@ -15,12 +15,12 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test VALUES(1, 'A')"); -$db->exec("INSERT INTO test VALUES(2, 'A')"); -$db->exec("INSERT INTO test VALUES(3, 'C')"); +$db->exec('CREATE TABLE test006(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); +$db->exec("INSERT INTO test006 VALUES(1, 'A')"); +$db->exec("INSERT INTO test006 VALUES(2, 'A')"); +$db->exec("INSERT INTO test006 VALUES(3, 'C')"); -$stmt = $db->prepare('SELECT val, id from test'); +$stmt = $db->prepare('SELECT val, id from test006'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_GROUP)); @@ -28,6 +28,12 @@ var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_GROUP)); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC|PDO::FETCH_GROUP)); +?> +--CLEAN-- +exec("DROP TABLE test006"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo/tests/pdo_007.phpt b/ext/pdo/tests/pdo_007.phpt index 08ad7bac2110c..6ec0980185976 100644 --- a/ext/pdo/tests/pdo_007.phpt +++ b/ext/pdo/tests/pdo_007.phpt @@ -15,12 +15,12 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test VALUES('A', 'A')"); -$db->exec("INSERT INTO test VALUES('B', 'A')"); -$db->exec("INSERT INTO test VALUES('C', 'C')"); +$db->exec('CREATE TABLE test007(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); +$db->exec("INSERT INTO test007 VALUES('A', 'A')"); +$db->exec("INSERT INTO test007 VALUES('B', 'A')"); +$db->exec("INSERT INTO test007 VALUES('C', 'C')"); -$stmt = $db->prepare('SELECT id, val from test'); +$stmt = $db->prepare('SELECT id, val from test007'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_UNIQUE)); @@ -28,6 +28,12 @@ var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_UNIQUE)); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC|PDO::FETCH_UNIQUE)); +?> +--CLEAN-- +exec("DROP TABLE test007"); ?> --EXPECT-- array(3) { diff --git a/ext/pdo/tests/pdo_008.phpt b/ext/pdo/tests/pdo_008.phpt index 1197a735d2748..ef1a0838ae476 100644 --- a/ext/pdo/tests/pdo_008.phpt +++ b/ext/pdo/tests/pdo_008.phpt @@ -15,16 +15,22 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test VALUES('A', 'A')"); -$db->exec("INSERT INTO test VALUES('B', 'A')"); -$db->exec("INSERT INTO test VALUES('C', 'C')"); +$db->exec('CREATE TABLE test008(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); +$db->exec("INSERT INTO test008 VALUES('A', 'A')"); +$db->exec("INSERT INTO test008 VALUES('B', 'A')"); +$db->exec("INSERT INTO test008 VALUES('C', 'C')"); -$stmt = $db->prepare('SELECT val, id from test'); +$stmt = $db->prepare('SELECT val, id from test008'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_UNIQUE)); +?> +--CLEAN-- +exec("DROP TABLE test008"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo/tests/pdo_009.phpt b/ext/pdo/tests/pdo_009.phpt index 6e98b71ff355d..8c2de1368d989 100644 --- a/ext/pdo/tests/pdo_009.phpt +++ b/ext/pdo/tests/pdo_009.phpt @@ -15,17 +15,17 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE classtypes(id int NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)'); -$db->exec('INSERT INTO classtypes VALUES(0, \'stdClass\')'); -$db->exec('INSERT INTO classtypes VALUES(1, \'Test1\')'); -$db->exec('INSERT INTO classtypes VALUES(2, \'Test2\')'); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10))'); -$db->exec('INSERT INTO test VALUES(1, 0, \'A\')'); -$db->exec('INSERT INTO test VALUES(2, 1, \'B\')'); -$db->exec('INSERT INTO test VALUES(3, 2, \'C\')'); -$db->exec('INSERT INTO test VALUES(4, 3, \'D\')'); +$db->exec('CREATE TABLE classtypes009(id int NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)'); +$db->exec('INSERT INTO classtypes009 VALUES(0, \'stdClass\')'); +$db->exec('INSERT INTO classtypes009 VALUES(1, \'Test1\')'); +$db->exec('INSERT INTO classtypes009 VALUES(2, \'Test2\')'); +$db->exec('CREATE TABLE test009(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10))'); +$db->exec('INSERT INTO test009 VALUES(1, 0, \'A\')'); +$db->exec('INSERT INTO test009 VALUES(2, 1, \'B\')'); +$db->exec('INSERT INTO test009 VALUES(3, 2, \'C\')'); +$db->exec('INSERT INTO test009 VALUES(4, 3, \'D\')'); -$stmt = $db->prepare('SELECT classtypes.name, test.id AS id, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id'); +$stmt = $db->prepare('SELECT classtypes.name, test.id AS id, test.val AS val FROM test009 LEFT JOIN classtypes009 ON test.classtype=classtypes.id'); class Test1 { @@ -66,6 +66,13 @@ var_dump($stmt->fetchAll(PDO::FETCH_NUM)); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE, 'Test3')); +?> +--CLEAN-- +exec("DROP TABLE test009"); +$db->exec("DROP TABLE classtypes009"); ?> --EXPECTF-- array(4) { diff --git a/ext/pdo/tests/pdo_010.phpt b/ext/pdo/tests/pdo_010.phpt index 1d47741b38644..cbb2d537e3302 100644 --- a/ext/pdo/tests/pdo_010.phpt +++ b/ext/pdo/tests/pdo_010.phpt @@ -15,17 +15,17 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE classtypes(id int NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)'); -$db->exec('INSERT INTO classtypes VALUES(0, \'stdClass\')'); -$db->exec('INSERT INTO classtypes VALUES(1, \'Test1\')'); -$db->exec('INSERT INTO classtypes VALUES(2, \'Test2\')'); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test VALUES(1, 0, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test VALUES(2, 1, \'B\', \'Group1\')'); -$db->exec('INSERT INTO test VALUES(3, 2, \'C\', \'Group2\')'); -$db->exec('INSERT INTO test VALUES(4, 3, \'D\', \'Group2\')'); +$db->exec('CREATE TABLE classtypes010(id int NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)'); +$db->exec('INSERT INTO classtypes010 VALUES(0, \'stdClass\')'); +$db->exec('INSERT INTO classtypes010 VALUES(1, \'Test1\')'); +$db->exec('INSERT INTO classtypes010 VALUES(2, \'Test2\')'); +$db->exec('CREATE TABLE test010(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10), grp VARCHAR(10))'); +$db->exec('INSERT INTO test010 VALUES(1, 0, \'A\', \'Group1\')'); +$db->exec('INSERT INTO test010 VALUES(2, 1, \'B\', \'Group1\')'); +$db->exec('INSERT INTO test010 VALUES(3, 2, \'C\', \'Group2\')'); +$db->exec('INSERT INTO test010 VALUES(4, 3, \'D\', \'Group2\')'); -$stmt = $db->prepare('SELECT classtypes.name, test.grp AS grp, test.id AS id, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id'); +$stmt = $db->prepare('SELECT classtypes.name, test.grp AS grp, test.id AS id, test.val AS val FROM test010 LEFT JOIN classtypes010 ON test.classtype=classtypes.id'); class Test1 { @@ -67,6 +67,13 @@ var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_GROUP, $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_UNIQUE, 'Test3')); +?> +--CLEAN-- +exec("DROP TABLE test010"); +$db->exec("DROP TABLE classtypes010"); ?> --EXPECTF-- Test1::__construct() diff --git a/ext/pdo/tests/pdo_011.phpt b/ext/pdo/tests/pdo_011.phpt index 53bf34d442a04..bd6a1be2f29dc 100644 --- a/ext/pdo/tests/pdo_011.phpt +++ b/ext/pdo/tests/pdo_011.phpt @@ -15,11 +15,11 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test VALUES(1, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test VALUES(2, \'B\', \'Group1\')'); -$db->exec('INSERT INTO test VALUES(3, \'C\', \'Group2\')'); -$db->exec('INSERT INTO test VALUES(4, \'D\', \'Group2\')'); +$db->exec('CREATE TABLE test011(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); +$db->exec('INSERT INTO test011 VALUES(1, \'A\', \'Group1\')'); +$db->exec('INSERT INTO test011 VALUES(2, \'B\', \'Group1\')'); +$db->exec('INSERT INTO test011 VALUES(3, \'C\', \'Group2\')'); +$db->exec('INSERT INTO test011 VALUES(4, \'D\', \'Group2\')'); class DerivedStatement extends PDOStatement { @@ -34,9 +34,9 @@ class DerivedStatement extends PDOStatement } } -$select1 = $db->prepare('SELECT grp, id FROM test'); -$select2 = $db->prepare('SELECT id, val FROM test'); -$derived = $db->prepare('SELECT id, val FROM test', array(PDO::ATTR_STATEMENT_CLASS=>array('DerivedStatement', array('Overloaded', $db)))); +$select1 = $db->prepare('SELECT grp, id FROM test011'); +$select2 = $db->prepare('SELECT id, val FROM test011'); +$derived = $db->prepare('SELECT id, val FROM test011', array(PDO::ATTR_STATEMENT_CLASS=>array('DerivedStatement', array('Overloaded', $db)))); class Test1 { @@ -80,6 +80,12 @@ var_dump($derived->fetchAll(PDO::FETCH_FUNC, array($derived, 'reTrieve'))); $derived->execute(); var_dump($derived->fetchAll(PDO::FETCH_FUNC, array($derived, 'RETRIEVE'))); +?> +--CLEAN-- +exec("DROP TABLE test011"); ?> --EXPECTF-- DerivedStatement::__construct(Overloaded) diff --git a/ext/pdo/tests/pdo_012.phpt b/ext/pdo/tests/pdo_012.phpt index 9c5cf51d24f4e..b5b810d53154b 100644 --- a/ext/pdo/tests/pdo_012.phpt +++ b/ext/pdo/tests/pdo_012.phpt @@ -15,11 +15,11 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test VALUES(1, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test VALUES(2, \'B\', \'Group2\')'); +$db->exec('CREATE TABLE test012(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); +$db->exec('INSERT INTO test012 VALUES(1, \'A\', \'Group1\')'); +$db->exec('INSERT INTO test012 VALUES(2, \'B\', \'Group2\')'); -$SELECT = 'SELECT val, grp FROM test'; +$SELECT = 'SELECT val, grp FROM test012'; $stmt = $db->query($SELECT, PDO::FETCH_NUM); var_dump($stmt->fetchAll()); @@ -46,6 +46,12 @@ $stmt = $db->query($SELECT, PDO::FETCH_NUM); $stmt->setFetchMode(PDO::FETCH_CLASS, 'Test', array('Changed')); var_dump($stmt->fetchAll()); +?> +--CLEAN-- +exec("DROP TABLE test012"); ?> --EXPECTF-- array(2) { diff --git a/ext/pdo/tests/pdo_013.phpt b/ext/pdo/tests/pdo_013.phpt index df43d20527f23..45785987cb247 100644 --- a/ext/pdo/tests/pdo_013.phpt +++ b/ext/pdo/tests/pdo_013.phpt @@ -15,11 +15,11 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test VALUES(1, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test VALUES(2, \'B\', \'Group2\')'); +$db->exec('CREATE TABLE test013(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); +$db->exec('INSERT INTO test013 VALUES(1, \'A\', \'Group1\')'); +$db->exec('INSERT INTO test013 VALUES(2, \'B\', \'Group2\')'); -$SELECT = 'SELECT val, grp FROM test'; +$SELECT = 'SELECT val, grp FROM test013'; $stmt = $db->prepare($SELECT); @@ -57,6 +57,12 @@ foreach($stmt as $data) var_dump($data); } ?> +--CLEAN-- +exec("DROP TABLE test013"); +?> --EXPECTF-- array(2) { [0]=> diff --git a/ext/pdo/tests/pdo_014.phpt b/ext/pdo/tests/pdo_014.phpt index d607481e92c77..cf6c1e37c01e1 100644 --- a/ext/pdo/tests/pdo_014.phpt +++ b/ext/pdo/tests/pdo_014.phpt @@ -15,10 +15,10 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test VALUES(1, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test VALUES(2, \'B\', \'Group2\')'); -$SELECT = 'SELECT val, grp FROM test'; +$db->exec('CREATE TABLE test014(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); +$db->exec('INSERT INTO test014 VALUES(1, \'A\', \'Group1\')'); +$db->exec('INSERT INTO test014 VALUES(2, \'B\', \'Group2\')'); +$SELECT = 'SELECT val, grp FROM test014'; class Test { @@ -70,6 +70,12 @@ foreach($stmt as $data) var_dump($data); } +?> +--CLEAN-- +exec("DROP TABLE test014"); ?> --EXPECTF-- Test::__construct(WOW) diff --git a/ext/pdo/tests/pdo_015.phpt b/ext/pdo/tests/pdo_015.phpt index ee982a02e1a5c..02c673871bf58 100644 --- a/ext/pdo/tests/pdo_015.phpt +++ b/ext/pdo/tests/pdo_015.phpt @@ -15,12 +15,12 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(20))'); -$db->exec('INSERT INTO test VALUES(1, \'A\', \'A2\')'); -$db->exec('INSERT INTO test VALUES(2, \'A\', \'B2\')'); +$db->exec('CREATE TABLE test015(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(20))'); +$db->exec('INSERT INTO test015 VALUES(1, \'A\', \'A2\')'); +$db->exec('INSERT INTO test015 VALUES(2, \'A\', \'B2\')'); -$select1 = $db->prepare('SELECT id, val, val2 FROM test'); -$select2 = $db->prepare('SELECT val, val2 FROM test'); +$select1 = $db->prepare('SELECT id, val, val2 FROM test015'); +$select2 = $db->prepare('SELECT val, val2 FROM test015'); $select1->execute(); var_dump($select1->fetchAll(PDO::FETCH_COLUMN)); @@ -40,6 +40,12 @@ var_dump($select1->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE, 2)); $select2->execute(); var_dump($select2->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP)); +?> +--CLEAN-- +exec("DROP TABLE test015"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo/tests/pdo_016.phpt b/ext/pdo/tests/pdo_016.phpt index 09e713a64fda7..3afd3caf7de74 100644 --- a/ext/pdo/tests/pdo_016.phpt +++ b/ext/pdo/tests/pdo_016.phpt @@ -20,13 +20,13 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } -$db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$db->exec('INSERT INTO test VALUES(0, \'String0\')'); -$db->exec('INSERT INTO test VALUES(1, \'String1\')'); -$db->exec('INSERT INTO test VALUES(2, \'String2\')'); +$db->exec('CREATE TABLE test016(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); +$db->exec('INSERT INTO test016 VALUES(0, \'String0\')'); +$db->exec('INSERT INTO test016 VALUES(1, \'String1\')'); +$db->exec('INSERT INTO test016 VALUES(2, \'String2\')'); -$stmt1 = $db->prepare('SELECT COUNT(idx) FROM test'); -$stmt2 = $db->prepare('SELECT idx, txt FROM test ORDER by idx'); +$stmt1 = $db->prepare('SELECT COUNT(idx) FROM test016'); +$stmt2 = $db->prepare('SELECT idx, txt FROM test016 ORDER by idx'); $stmt1->execute(); var_dump($stmt1->fetchColumn()); @@ -48,10 +48,10 @@ while($stmt2->fetch(PDO::FETCH_BOUND)) { echo "===ALONE===\n"; -$stmt3 = $db->prepare('SELECT txt FROM test WHERE idx=:inp'); +$stmt3 = $db->prepare('SELECT txt FROM test016 WHERE idx=:inp'); $stmt3->bindParam(':inp', $idx); /* by foreign name */ -$stmt4 = $db->prepare('SELECT idx FROM test WHERE txt=:txt'); +$stmt4 = $db->prepare('SELECT idx FROM test016 WHERE txt=:txt'); $stmt4->bindParam(':txt', $txt); /* using same name */ foreach($cont as $idx => $txt) @@ -107,6 +107,12 @@ while($stmt2->fetch(PDO::FETCH_BOUND)) } +?> +--CLEAN-- +exec("DROP TABLE test016"); ?> --EXPECT-- string(1) "3" diff --git a/ext/pdo/tests/pdo_016a.phpt b/ext/pdo/tests/pdo_016a.phpt index e1239157cbd02..fcdbdf548df7b 100644 --- a/ext/pdo/tests/pdo_016a.phpt +++ b/ext/pdo/tests/pdo_016a.phpt @@ -20,13 +20,13 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } -$db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$db->exec('INSERT INTO test VALUES(0, \'String0\')'); -$db->exec('INSERT INTO test VALUES(1, \'String1\')'); -$db->exec('INSERT INTO test VALUES(2, \'String2\')'); +$db->exec('CREATE TABLE test016a(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); +$db->exec('INSERT INTO test016a VALUES(0, \'String0\')'); +$db->exec('INSERT INTO test016a VALUES(1, \'String1\')'); +$db->exec('INSERT INTO test016a VALUES(2, \'String2\')'); -$stmt1 = $db->prepare('SELECT COUNT(idx) FROM test'); -$stmt2 = $db->prepare('SELECT idx, txt FROM test ORDER by idx'); +$stmt1 = $db->prepare('SELECT COUNT(idx) FROM test016a'); +$stmt2 = $db->prepare('SELECT idx, txt FROM test016a ORDER by idx'); $stmt1->execute(); var_dump($stmt1->fetchColumn()); @@ -48,10 +48,10 @@ while($stmt2->fetch(PDO::FETCH_BOUND)) { echo "===ALONE===\n"; -$stmt3 = $db->prepare('SELECT txt FROM test WHERE idx=:inp'); +$stmt3 = $db->prepare('SELECT txt FROM test016a WHERE idx=:inp'); $stmt3->bindParam('inp', $idx); /* by foreign name */ -$stmt4 = $db->prepare('SELECT idx FROM test WHERE txt=:txt'); +$stmt4 = $db->prepare('SELECT idx FROM test016a WHERE txt=:txt'); $stmt4->bindParam('txt', $txt); /* using same name */ foreach($cont as $idx => $txt) @@ -107,6 +107,12 @@ while($stmt2->fetch(PDO::FETCH_BOUND)) } +?> +--CLEAN-- +exec("DROP TABLE test016a"); ?> --EXPECT-- string(1) "3" diff --git a/ext/pdo/tests/pdo_017.phpt b/ext/pdo/tests/pdo_017.phpt index 74392553bc5b0..8a27e3f16a09c 100644 --- a/ext/pdo/tests/pdo_017.phpt +++ b/ext/pdo/tests/pdo_017.phpt @@ -36,15 +36,15 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { $suf = ''; } -$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'.$suf); -$db->exec("INSERT INTO test VALUES(1, 'A')"); -$db->exec("INSERT INTO test VALUES(2, 'B')"); -$db->exec("INSERT INTO test VALUES(3, 'C')"); -$delete = $db->prepare('DELETE FROM test'); +$db->exec('CREATE TABLE test017(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'.$suf); +$db->exec("INSERT INTO test017 VALUES(1, 'A')"); +$db->exec("INSERT INTO test017 VALUES(2, 'B')"); +$db->exec("INSERT INTO test017 VALUES(3, 'C')"); +$delete = $db->prepare('DELETE FROM test017'); function countRows($action) { global $db; - $select = $db->prepare('SELECT COUNT(*) FROM test'); + $select = $db->prepare('SELECT COUNT(*) FROM test017'); $select->execute(); $res = $select->fetchColumn(); return "Counted $res rows after $action.\n"; @@ -66,6 +66,12 @@ $db->commit(); echo countRows('commit'); +?> +--CLEAN-- +exec("DROP TABLE test017"); ?> --EXPECT-- Counted 3 rows after insert. diff --git a/ext/pdo/tests/pdo_018.phpt b/ext/pdo/tests/pdo_018.phpt index 2b512b1f3f583..6ae537185e8a1 100644 --- a/ext/pdo/tests/pdo_018.phpt +++ b/ext/pdo/tests/pdo_018.phpt @@ -67,27 +67,27 @@ class TestLeaf extends TestDerived { } -$db->exec('CREATE TABLE classtypes(id int NOT NULL PRIMARY KEY, name VARCHAR(20) NOT NULL UNIQUE)'); -$db->exec('INSERT INTO classtypes VALUES(0, \'stdClass\')'); -$db->exec('INSERT INTO classtypes VALUES(1, \'TestBase\')'); -$db->exec('INSERT INTO classtypes VALUES(2, \'TestDerived\')'); +$db->exec('CREATE TABLE classtypes018(id int NOT NULL PRIMARY KEY, name VARCHAR(20) NOT NULL UNIQUE)'); +$db->exec('INSERT INTO classtypes018 VALUES(0, \'stdClass\')'); +$db->exec('INSERT INTO classtypes018 VALUES(1, \'TestBase\')'); +$db->exec('INSERT INTO classtypes018 VALUES(2, \'TestDerived\')'); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': // environment settings can influence how the table is created if specifics are missing // https://msdn.microsoft.com/en-us/library/ms174979.aspx#Nullability Rules Within a Table Definition - $sql = 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, classtype int NULL, val VARCHAR(255) NULL)'; + $sql = 'CREATE TABLE test018(id int NOT NULL PRIMARY KEY, classtype int NULL, val VARCHAR(255) NULL)'; break; default: - $sql = 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(255))'; + $sql = 'CREATE TABLE test018(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(255))'; break; } $db->exec($sql); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -var_dump($db->query('SELECT COUNT(*) FROM classtypes')->fetchColumn()); -var_dump($db->query('SELECT id, name FROM classtypes ORDER by id')->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE)); +var_dump($db->query('SELECT COUNT(*) FROM classtypes018')->fetchColumn()); +var_dump($db->query('SELECT id, name FROM classtypes018 ORDER by id')->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE)); $objs = array(); $objs[0] = new stdClass; @@ -95,7 +95,7 @@ $objs[1] = new TestBase; $objs[2] = new TestDerived; $objs[3] = new TestLeaf; -$stmt = $db->prepare('SELECT id FROM classtypes WHERE name=:cname'); +$stmt = $db->prepare('SELECT id FROM classtypes018 WHERE name=:cname'); $stmt->bindParam(':cname', $cname); $ctypes = array(); @@ -116,7 +116,7 @@ var_dump($ctypes); unset($stmt); echo "===INSERT===\n"; -$stmt = $db->prepare('INSERT INTO test VALUES(:id, :classtype, :val)'); +$stmt = $db->prepare('INSERT INTO test018 VALUES(:id, :classtype, :val)'); $stmt->bindParam(':id', $idx); $stmt->bindParam(':classtype', $ctype); $stmt->bindParam(':val', $val); @@ -138,7 +138,7 @@ foreach($objs as $idx => $obj) unset($stmt); echo "===DATA===\n"; -$res = $db->query('SELECT test.val FROM test')->fetchAll(PDO::FETCH_COLUMN); +$res = $db->query('SELECT test.val FROM test018')->fetchAll(PDO::FETCH_COLUMN); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': @@ -160,7 +160,7 @@ var_dump($res); echo "===FAILURE===\n"; try { - $db->query('SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id')->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf', array()); + $db->query('SELECT classtypes.name AS name, test.val AS val FROM test018 LEFT JOIN classtypes ON test.classtype=classtypes.id')->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf', array()); } catch (PDOException $e) { @@ -169,10 +169,10 @@ catch (PDOException $e) } echo "===COUNT===\n"; -var_dump($db->query('SELECT COUNT(*) FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)')->fetchColumn()); +var_dump($db->query('SELECT COUNT(*) FROM test018 LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)')->fetchColumn()); echo "===DATABASE===\n"; -$stmt = $db->prepare('SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)'); +$stmt = $db->prepare('SELECT classtypes.name AS name, test.val AS val FROM test018 LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); @@ -182,6 +182,13 @@ $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf')); +?> +--CLEAN-- +exec("DROP TABLE test018"); +$db->exec("DROP TABLE classtypes018"); ?> --EXPECTF-- Deprecated: %s implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d diff --git a/ext/pdo/tests/pdo_019.phpt b/ext/pdo/tests/pdo_019.phpt index dda7ca02268b4..bbc76ceb74577 100644 --- a/ext/pdo/tests/pdo_019.phpt +++ b/ext/pdo/tests/pdo_019.phpt @@ -15,16 +15,16 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$db->exec('INSERT INTO test VALUES(0, \'String0\')'); -$db->exec('INSERT INTO test VALUES(1, \'String1\')'); -$db->exec('INSERT INTO test VALUES(2, \'String2\')'); -$db->exec('INSERT INTO test VALUES(3, \'String3\')'); +$db->exec('CREATE TABLE test019(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); +$db->exec('INSERT INTO test019 VALUES(0, \'String0\')'); +$db->exec('INSERT INTO test019 VALUES(1, \'String1\')'); +$db->exec('INSERT INTO test019 VALUES(2, \'String2\')'); +$db->exec('INSERT INTO test019 VALUES(3, \'String3\')'); -var_dump($db->query('SELECT COUNT(*) FROM test')->fetchColumn()); +var_dump($db->query('SELECT COUNT(*) FROM test019')->fetchColumn()); -$stmt = $db->prepare('SELECT idx, txt FROM test ORDER by idx'); +$stmt = $db->prepare('SELECT idx, txt FROM test019 ORDER by idx'); $stmt->execute(); $cont = $stmt->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE); @@ -40,6 +40,12 @@ while($stmt->fetch(PDO::FETCH_BOUND)) { var_dump(array($idx=>$txt)); } +?> +--CLEAN-- +exec("DROP TABLE test019"); ?> --EXPECT-- string(1) "4" diff --git a/ext/pdo/tests/pdo_020.phpt b/ext/pdo/tests/pdo_020.phpt index 1d88a17727e26..e569f3aa10e53 100644 --- a/ext/pdo/tests/pdo_020.phpt +++ b/ext/pdo/tests/pdo_020.phpt @@ -15,12 +15,12 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -$db->exec("INSERT INTO test VALUES(1, 'A', 'A')"); -$db->exec("INSERT INTO test VALUES(2, 'B', 'B')"); -$db->exec("INSERT INTO test VALUES(3, 'C', 'C')"); +$db->exec('CREATE TABLE test020(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); +$db->exec("INSERT INTO test020 VALUES(1, 'A', 'A')"); +$db->exec("INSERT INTO test020 VALUES(2, 'B', 'B')"); +$db->exec("INSERT INTO test020 VALUES(3, 'C', 'C')"); -foreach (array('SELECT id, val FROM test', 'SELECT id, val, val2 FROM test', 'SELECT COUNT(*) FROM test') as $sql) { +foreach (array('SELECT id, val FROM test020', 'SELECT id, val, val2 FROM test020', 'SELECT COUNT(*) FROM test020') as $sql) { $stmt = $db->query($sql); $res = $stmt->columnCount(); @@ -28,8 +28,14 @@ foreach (array('SELECT id, val FROM test', 'SELECT id, val, val2 FROM test', 'SE $stmt = null; } +?> +--CLEAN-- +exec("DROP TABLE test020"); ?> --EXPECT-- -Counted 2 columns after SELECT id, val FROM test. -Counted 3 columns after SELECT id, val, val2 FROM test. -Counted 1 columns after SELECT COUNT(*) FROM test. +Counted 2 columns after SELECT id, val FROM test020. +Counted 3 columns after SELECT id, val, val2 FROM test020. +Counted 1 columns after SELECT COUNT(*) FROM test020. diff --git a/ext/pdo/tests/pdo_021.phpt b/ext/pdo/tests/pdo_021.phpt index d4df28b04d425..7f81ddbbf2935 100644 --- a/ext/pdo/tests/pdo_021.phpt +++ b/ext/pdo/tests/pdo_021.phpt @@ -19,9 +19,9 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } -$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); +$db->exec('CREATE TABLE test021(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -$select = $db->prepare('SELECT COUNT(id) FROM test'); +$select = $db->prepare('SELECT COUNT(id) FROM test021'); $data = array( array('10', 'Abc', 'zxy'), @@ -34,7 +34,7 @@ $data = array( // Insert using question mark placeholders -$stmt = $db->prepare("INSERT INTO test VALUES(?, ?, ?)"); +$stmt = $db->prepare("INSERT INTO test021 VALUES(?, ?, ?)"); foreach ($data as $row) { $stmt->execute($row); } @@ -43,7 +43,7 @@ $num = $select->fetchColumn(); echo 'There are ' . $num . " rows in the table.\n"; // Insert using named parameters -$stmt2 = $db->prepare("INSERT INTO test VALUES(:first, :second, :third)"); +$stmt2 = $db->prepare("INSERT INTO test021 VALUES(:first, :second, :third)"); foreach ($data as $row) { $stmt2->execute(array(':first'=>($row[0] + 5), ':second'=>$row[1], ':third'=>$row[2])); @@ -54,6 +54,12 @@ $num = $select->fetchColumn(); echo 'There are ' . $num . " rows in the table.\n"; +?> +--CLEAN-- +exec("DROP TABLE test021"); ?> --EXPECT-- There are 6 rows in the table. diff --git a/ext/pdo/tests/pdo_022.phpt b/ext/pdo/tests/pdo_022.phpt index eba8526e50019..28a5a7f824c68 100644 --- a/ext/pdo/tests/pdo_022.phpt +++ b/ext/pdo/tests/pdo_022.phpt @@ -26,7 +26,7 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); +$db->exec('CREATE TABLE test022(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); $data = array( array('10', 'Abc', 'zxy'), @@ -38,13 +38,13 @@ $data = array( ); // Insert using question mark placeholders -$stmt = $db->prepare("INSERT INTO test VALUES(?, ?, ?)"); +$stmt = $db->prepare("INSERT INTO test022 VALUES(?, ?, ?)"); foreach ($data as $row) { $stmt->execute($row); } // Retrieve column metadata for a result set returned by explicit SELECT -$select = $db->query('SELECT id, val, val2 FROM test'); +$select = $db->query('SELECT id, val, val2 FROM test022'); $meta = $select->getColumnMeta(0); var_dump($meta); $meta = $select->getColumnMeta(1); @@ -53,10 +53,16 @@ $meta = $select->getColumnMeta(2); var_dump($meta); // Retrieve column metadata for a result set returned by a function -$select = $db->query('SELECT COUNT(*) FROM test'); +$select = $db->query('SELECT COUNT(*) FROM test022'); $meta = $select->getColumnMeta(0); var_dump($meta); +?> +--CLEAN-- +exec("DROP TABLE test022"); ?> --EXPECT-- The unexpected! diff --git a/ext/pdo/tests/pdo_023.phpt b/ext/pdo/tests/pdo_023.phpt index b2356c13445e6..e511ecdd2fad4 100644 --- a/ext/pdo/tests/pdo_023.phpt +++ b/ext/pdo/tests/pdo_023.phpt @@ -63,12 +63,12 @@ $db = PDOTest::factory('PDODatabaseX'); $db->test(); var_dump($db); -$db->query('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->query('INSERT INTO test VALUES(0, \'A\')'); -$db->query('INSERT INTO test VALUES(1, \'B\')'); +$db->query('CREATE TABLE test023(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'); +$db->query('INSERT INTO test023 VALUES(0, \'A\')'); +$db->query('INSERT INTO test023 VALUES(1, \'B\')'); -$stmt = $db->query('SELECT val, id FROM test'); +$stmt = $db->query('SELECT val, id FROM test023'); var_dump($stmt); var_dump($stmt->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE)); @@ -76,6 +76,12 @@ $stmt = NULL; $db = NULL; +?> +--CLEAN-- +exec("DROP TABLE test023"); ?> --EXPECTF-- int(1) @@ -99,7 +105,7 @@ PDODatabaseX::query() PDOStatementX::__construct() object(PDOStatementX)#%d (3) { ["queryString"]=> - string(24) "SELECT val, id FROM test" + string(27) "SELECT val, id FROM test023" ["test1"]=> int(1) ["test2"]=> diff --git a/ext/pdo/tests/pdo_024.phpt b/ext/pdo/tests/pdo_024.phpt index f78305039c023..ab94be9080e54 100644 --- a/ext/pdo/tests/pdo_024.phpt +++ b/ext/pdo/tests/pdo_024.phpt @@ -19,15 +19,15 @@ switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': // environment settings can influence how the table is created if specifics are missing // https://msdn.microsoft.com/en-us/library/ms174979.aspx#Nullability Rules Within a Table Definition - $sql = 'create table test (id int, name varchar(10) null)'; + $sql = 'create test024 (id int, name varchar(10) null)'; break; default: - $sql = 'create table test (id int, name varchar(10))'; + $sql = 'create test024 (id int, name varchar(10))'; break; } $db->exec($sql); -$stmt = $db->prepare('insert into test (id, name) values(0, :name)'); +$stmt = $db->prepare('insert into test024 (id, name) values(0, :name)'); $name = NULL; $before_bind = $name; $stmt->bindParam(':name', $name, PDO::PARAM_NULL); @@ -37,8 +37,14 @@ if ($name !== $before_bind) { echo "bind: success\n"; } var_dump($stmt->execute()); -var_dump($db->query('select name from test where id=0')->fetchColumn()); +var_dump($db->query('select name from test024 where id=0')->fetchColumn()); +?> +--CLEAN-- +exec("DROP TABLE test024"); ?> --EXPECT-- bind: success diff --git a/ext/pdo/tests/pdo_025.phpt b/ext/pdo/tests/pdo_025.phpt index cc060f2238cf6..b81ed4b48f5c5 100644 --- a/ext/pdo/tests/pdo_025.phpt +++ b/ext/pdo/tests/pdo_025.phpt @@ -15,7 +15,7 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); +$db->exec('CREATE TABLE test025(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); $data = array( array('10', 'Abc', 'zxy'), @@ -28,7 +28,7 @@ $data = array( // Insert using question mark placeholders -$stmt = $db->prepare("INSERT INTO test VALUES(?, ?, ?)"); +$stmt = $db->prepare("INSERT INTO test025 VALUES(?, ?, ?)"); foreach ($data as $row) { $stmt->execute($row); } @@ -37,7 +37,7 @@ class Test { public $id, $val, $val2; } -$stmt = $db->prepare('SELECT * FROM test'); +$stmt = $db->prepare('SELECT * FROM test025'); $stmt->setFetchMode(PDO::FETCH_INTO, new Test); $stmt->execute(); @@ -59,6 +59,12 @@ foreach($stmt as $obj) { var_dump($obj); } +?> +--CLEAN-- +exec("DROP TABLE test025"); ?> --EXPECTF-- object(Test)#%d (3) { diff --git a/ext/pdo/tests/pdo_026.phpt b/ext/pdo/tests/pdo_026.phpt index 1a07fb1c06ff1..093ae8653c839 100644 --- a/ext/pdo/tests/pdo_026.phpt +++ b/ext/pdo/tests/pdo_026.phpt @@ -56,9 +56,9 @@ class PDODatabase extends PDO $db = PDOTest::factory('PDODatabase'); var_dump(get_class($db)); -$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); +$db->exec('CREATE TABLE test026(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -$stmt = $db->prepare("INSERT INTO test VALUES(?, ?, ?)"); +$stmt = $db->prepare("INSERT INTO test026 VALUES(?, ?, ?)"); var_dump(get_class($stmt)); foreach ($data as $row) { $stmt->execute($row); @@ -66,7 +66,7 @@ foreach ($data as $row) { unset($stmt); -$stmt = $db->query('SELECT * FROM test'); +$stmt = $db->query('SELECT * FROM test026'); var_dump(get_class($stmt)); var_dump(get_class($stmt->dbh)); @@ -76,6 +76,12 @@ foreach($stmt as $obj) { echo "===DONE===\n"; ?> +--CLEAN-- +exec("DROP TABLE test026"); +?> --EXPECT-- string(11) "PDODatabase" string(12) "PDOStatement" diff --git a/ext/pdo/tests/pdo_027.phpt b/ext/pdo/tests/pdo_027.phpt index 1bf09c183a5af..03b03493b1bb2 100644 --- a/ext/pdo/tests/pdo_027.phpt +++ b/ext/pdo/tests/pdo_027.phpt @@ -15,15 +15,21 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('create table test (id int, name varchar(10))'); -$db->exec("INSERT INTO test (id,name) VALUES(1,'test1')"); -$db->exec("INSERT INTO test (id,name) VALUES(2,'test2')"); +$db->exec('create table test027 (id int, name varchar(10))'); +$db->exec("INSERT INTO test027 (id,name) VALUES(1,'test1')"); +$db->exec("INSERT INTO test027 (id,name) VALUES(2,'test2')"); -foreach ($db->query("SELECT * FROM test", PDO::FETCH_LAZY) as $v) { +foreach ($db->query("SELECT * FROM test027", PDO::FETCH_LAZY) as $v) { echo "lazy: " . $v->id.$v->name."\n"; } echo "End\n"; ?> +--CLEAN-- +exec("DROP TABLE test027"); +?> --EXPECT-- lazy: 1test1 lazy: 2test2 diff --git a/ext/pdo/tests/pdo_028.phpt b/ext/pdo/tests/pdo_028.phpt index 7791357c815e8..228caf7e663b2 100644 --- a/ext/pdo/tests/pdo_028.phpt +++ b/ext/pdo/tests/pdo_028.phpt @@ -15,8 +15,8 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val1 VARCHAR(10), val2 VARCHAR(10), val3 VARCHAR(10))'); -$stmt = $db->prepare('INSERT INTO test values (1, ?, ?, ?)'); +$db->exec('CREATE TABLE test028(id int NOT NULL PRIMARY KEY, val1 VARCHAR(10), val2 VARCHAR(10), val3 VARCHAR(10))'); +$stmt = $db->prepare('INSERT INTO test028 values (1, ?, ?, ?)'); $data = array("one", "two", "three"); @@ -25,11 +25,17 @@ foreach ($data as $i => $v) { } $stmt->execute(); -$stmt = $db->prepare('SELECT * from test'); +$stmt = $db->prepare('SELECT * from test028'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); ?> +--CLEAN-- +exec("DROP TABLE test028"); +?> --EXPECT-- array(1) { [0]=> diff --git a/ext/pdo/tests/pdo_029.phpt b/ext/pdo/tests/pdo_029.phpt index 41e148e6991db..ac62bc207a448 100644 --- a/ext/pdo/tests/pdo_029.phpt +++ b/ext/pdo/tests/pdo_029.phpt @@ -62,9 +62,9 @@ class PDODatabase extends PDO $db = PDOTest::factory('PDODatabase'); var_dump(get_class($db)); -$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); +$db->exec('CREATE TABLE test029(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -$stmt = $db->prepare("INSERT INTO test VALUES(?, ?, ?)"); +$stmt = $db->prepare("INSERT INTO test029 VALUES(?, ?, ?)"); var_dump(get_class($stmt)); foreach ($data as $row) { $stmt->execute($row); @@ -74,7 +74,7 @@ unset($stmt); echo "===QUERY===\n"; -$stmt = $db->query('SELECT * FROM test'); +$stmt = $db->query('SELECT * FROM test029'); var_dump(get_class($stmt)); var_dump(get_class($stmt->dbh)); @@ -87,6 +87,12 @@ foreach($stmt as $obj) { echo "===DONE===\n"; exit(0); ?> +--CLEAN-- +exec("DROP TABLE test029"); +?> --EXPECT-- string(11) "PDODatabase" string(12) "PDOStatement" diff --git a/ext/pdo/tests/pdo_030.phpt b/ext/pdo/tests/pdo_030.phpt index dc9b27ab71ce1..9162062206200 100644 --- a/ext/pdo/tests/pdo_030.phpt +++ b/ext/pdo/tests/pdo_030.phpt @@ -60,9 +60,9 @@ class PDODatabase extends PDO $db = PDOTest::factory('PDODatabase'); var_dump(get_class($db)); -$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); +$db->exec('CREATE TABLE test030(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -$stmt = $db->prepare("INSERT INTO test VALUES(?, ?, ?)"); +$stmt = $db->prepare("INSERT INTO test030 VALUES(?, ?, ?)"); var_dump(get_class($stmt)); foreach ($data as $row) { $stmt->execute($row); @@ -75,7 +75,7 @@ echo "===QUERY===\n"; var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS)); $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatementx', array($db))); var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS)); -$stmt = $db->query('SELECT * FROM test'); +$stmt = $db->query('SELECT * FROM test030'); var_dump(get_class($stmt)); var_dump(get_class($stmt->dbh)); @@ -88,6 +88,12 @@ foreach($stmt as $obj) { echo "===DONE===\n"; exit(0); ?> +--CLEAN-- +exec("DROP TABLE test030"); +?> --EXPECTF-- string(11) "PDODatabase" string(12) "PDOStatement" diff --git a/ext/pdo/tests/pdo_031.phpt b/ext/pdo/tests/pdo_031.phpt index fbcbb5087c48e..bea0f6d506ee0 100644 --- a/ext/pdo/tests/pdo_031.phpt +++ b/ext/pdo/tests/pdo_031.phpt @@ -22,9 +22,9 @@ $data = array( $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); +$db->exec('CREATE TABLE test031(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -$stmt = $db->prepare("INSERT INTO test VALUES(?, ?, ?)"); +$stmt = $db->prepare("INSERT INTO test031 VALUES(?, ?, ?)"); foreach ($data as $row) { $stmt->execute($row); } @@ -33,7 +33,7 @@ unset($stmt); echo "===QUERY===\n"; -$stmt = $db->query('SELECT * FROM test'); +$stmt = $db->query('SELECT * FROM test031'); foreach(new RecursiveTreeIterator(new RecursiveArrayIterator($stmt->fetchAll(PDO::FETCH_ASSOC)), RecursiveTreeIterator::BYPASS_KEY) as $c=>$v) { @@ -43,6 +43,12 @@ foreach(new RecursiveTreeIterator(new RecursiveArrayIterator($stmt->fetchAll(PDO echo "===DONE===\n"; exit(0); ?> +--CLEAN-- +exec("DROP TABLE test031"); +?> --EXPECT-- ===QUERY=== |-Array [0] diff --git a/ext/pdo/tests/pdo_032.phpt b/ext/pdo/tests/pdo_032.phpt index e59a3c8d23133..8cae63598fc20 100644 --- a/ext/pdo/tests/pdo_032.phpt +++ b/ext/pdo/tests/pdo_032.phpt @@ -15,25 +15,31 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test VALUES(1, 'A')"); -$db->exec("INSERT INTO test VALUES(2, 'B')"); -$db->exec("INSERT INTO test VALUES(3, 'C')"); +$db->exec('CREATE TABLE test032(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); +$db->exec("INSERT INTO test032 VALUES(1, 'A')"); +$db->exec("INSERT INTO test032 VALUES(2, 'B')"); +$db->exec("INSERT INTO test032 VALUES(3, 'C')"); // Lower case columns $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); -$stmt = $db->prepare('SELECT * from test'); +$stmt = $db->prepare('SELECT * from test032'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); $stmt->closeCursor(); // Upper case columns $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER); -$stmt = $db->prepare('SELECT * from test'); +$stmt = $db->prepare('SELECT * from test032'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); $stmt->closeCursor(); +?> +--CLEAN-- +exec("DROP TABLE test032"); ?> --EXPECT-- array(3) { diff --git a/ext/pdo/tests/pdo_033.phpt b/ext/pdo/tests/pdo_033.phpt index ff129d97179ae..621d5cd0e56e5 100644 --- a/ext/pdo/tests/pdo_033.phpt +++ b/ext/pdo/tests/pdo_033.phpt @@ -22,18 +22,19 @@ $quoted = $db->quote($unquoted); $len = strlen($unquoted); -@$db->exec("DROP TABLE test"); +$db->query("CREATE TABLE test033 (t char($len))"); +$db->query("INSERT INTO test033 (t) VALUES($quoted)"); -$db->query("CREATE TABLE test (t char($len))"); -$db->query("INSERT INTO test (t) VALUES($quoted)"); - -$stmt = $db->prepare('SELECT * from test'); +$stmt = $db->prepare('SELECT * from test033'); $stmt->execute(); print_r($stmt->fetchAll(PDO::FETCH_ASSOC)); - -$db->exec("DROP TABLE test"); - +?> +--CLEAN-- +exec("DROP TABLE test033"); ?> --EXPECT-- Array diff --git a/ext/pdo/tests/pdo_034.phpt b/ext/pdo/tests/pdo_034.phpt index 0a8332254194c..fd727ed6ef4a3 100644 --- a/ext/pdo/tests/pdo_034.phpt +++ b/ext/pdo/tests/pdo_034.phpt @@ -15,17 +15,23 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))"); +$db->exec("CREATE TABLE test034 (a varchar(100), b varchar(100), c varchar(100))"); for ($i = 0; $i < 5; $i++) { - $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); + $db->exec("INSERT INTO test034 (a,b,c) VALUES('test".$i."','".$i."','".$i."')"); } -var_dump($db->query("SELECT a,b FROM test")->fetch(PDO::FETCH_KEY_PAIR)); -var_dump($db->query("SELECT a,b FROM test")->fetchAll(PDO::FETCH_KEY_PAIR)); -var_dump($db->query("SELECT * FROM test")->fetch(PDO::FETCH_KEY_PAIR)); -var_dump($db->query("SELECT a,a FROM test")->fetchAll(PDO::FETCH_KEY_PAIR)); +var_dump($db->query("SELECT a,b FROM test034")->fetch(PDO::FETCH_KEY_PAIR)); +var_dump($db->query("SELECT a,b FROM test034")->fetchAll(PDO::FETCH_KEY_PAIR)); +var_dump($db->query("SELECT * FROM test034")->fetch(PDO::FETCH_KEY_PAIR)); +var_dump($db->query("SELECT a,a FROM test034")->fetchAll(PDO::FETCH_KEY_PAIR)); +?> +--CLEAN-- +exec("DROP TABLE test034"); ?> --EXPECTF-- array(1) { diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc index ba9f159228fc2..b8509e9282f06 100644 --- a/ext/pdo/tests/pdo_test.inc +++ b/ext/pdo/tests/pdo_test.inc @@ -18,7 +18,7 @@ if (getenv('PDOTEST_DSN') === false) { class PDOTest { // create an instance of the PDO driver, based on // the current environment - static function factory($classname = 'PDO', $drop_test_tables = true) { + static function factory($classname = 'PDO') { $dsn = getenv('PDOTEST_DSN'); $user = getenv('PDOTEST_USER'); $pass = getenv('PDOTEST_PASS'); @@ -40,19 +40,6 @@ class PDOTest { // Ignore errors about non-existent tables $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); - // clean up any crufty test tables we might have left behind - // on a previous run - static $test_tables = array( - 'test', - 'test2', - 'classtypes' - ); - if ($drop_test_tables) { - foreach ($test_tables as $table) { - $db->exec("DROP TABLE $table"); - } - } - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); diff --git a/ext/pdo/tests/pecl_bug_5217.phpt b/ext/pdo/tests/pecl_bug_5217.phpt index 2d8c2235c9681..87f096ecc00af 100644 --- a/ext/pdo/tests/pecl_bug_5217.phpt +++ b/ext/pdo/tests/pecl_bug_5217.phpt @@ -18,13 +18,19 @@ try { $ser = serialize($db); debug_zval_dump($ser); $db = unserialize($ser); - $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); + $db->exec('CREATE TABLE test5217 (id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); } catch (Exception $e) { echo "Safely caught " . $e->getMessage() . "\n"; } echo "PHP Didn't crash!\n"; ?> +--CLEAN-- +exec("DROP TABLE test5217"); +?> --EXPECT-- Safely caught Serialization of 'PDO' is not allowed PHP Didn't crash! diff --git a/ext/pdo/tests/pecl_bug_5772.phpt b/ext/pdo/tests/pecl_bug_5772.phpt index 122d899585644..d039c7f7a2439 100644 --- a/ext/pdo/tests/pecl_bug_5772.phpt +++ b/ext/pdo/tests/pecl_bug_5772.phpt @@ -15,16 +15,22 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (id int NOT NULL, PRIMARY KEY (id))"); -$db->exec("INSERT INTO test (id) VALUES (1)"); +$db->exec("CREATE TABLE test5772 (id int NOT NULL, PRIMARY KEY (id))"); +$db->exec("INSERT INTO test5772 (id) VALUES (1)"); function heLLO($row) { return $row; } -foreach ($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_FUNC, 'heLLO') as $row) { +foreach ($db->query("SELECT * FROM test5772")->fetchAll(PDO::FETCH_FUNC, 'heLLO') as $row) { var_dump($row); } ?> +--CLEAN-- +exec("DROP TABLE test5772"); +?> --EXPECT-- string(1) "1" diff --git a/ext/pdo/tests/pecl_bug_5809.phpt b/ext/pdo/tests/pecl_bug_5809.phpt index c94d068d497ba..a8e59fec9fdc6 100644 --- a/ext/pdo/tests/pecl_bug_5809.phpt +++ b/ext/pdo/tests/pecl_bug_5809.phpt @@ -15,15 +15,21 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec("CREATE TABLE test (id int NOT NULL, PRIMARY KEY (id))"); -$db->exec("INSERT INTO test (id) VALUES (1)"); +$db->exec("CREATE TABLE test5809 (id int NOT NULL, PRIMARY KEY (id))"); +$db->exec("INSERT INTO test5809 (id) VALUES (1)"); $values = array(1); var_dump($values); -$stmt = $db->prepare('SELECT * FROM test WHERE id = ?'); +$stmt = $db->prepare('SELECT * FROM test5809 WHERE id = ?'); $stmt->execute($values); var_dump($values); ?> +--CLEAN-- +exec("DROP TABLE test5809"); +?> --EXPECT-- array(1) { [0]=> diff --git a/ext/pdo_dblib/tests/CONFLICTS b/ext/pdo_dblib/tests/CONFLICTS deleted file mode 100644 index 7980e46ba3fa6..0000000000000 --- a/ext/pdo_dblib/tests/CONFLICTS +++ /dev/null @@ -1 +0,0 @@ -pdo_dblib diff --git a/ext/pdo_dblib/tests/batch_stmt_ins_exec.phpt b/ext/pdo_dblib/tests/batch_stmt_ins_exec.phpt index b2e0b00225623..50abb5d1ebaf1 100644 --- a/ext/pdo_dblib/tests/batch_stmt_ins_exec.phpt +++ b/ext/pdo_dblib/tests/batch_stmt_ins_exec.phpt @@ -13,21 +13,21 @@ if (!driver_supports_batch_statements_without_select($db)) die('xfail test will require __DIR__ . '/config.inc'; // creating a proc need to be a statement in it's own batch, so we need to do a little setup first -$db->query("create table #php_pdo(id int); "); +$db->query("create table #test_batch_stmt_ins_exec(id int); "); $db->query( -"create proc php_pdo_exec_select_proc as " . +"create proc test_proc_batch_stmt_ins_exec as " . "begin " . -" insert into #php_pdo values(2), (3), (4); " . -" select * from #php_pdo; " . +" insert into #test_batch_stmt_ins_exec values(2), (3), (4); " . +" select * from #test_batch_stmt_ins_exec; " . "end; " ); // now lets get some results $stmt = $db->query( -"insert into #php_pdo values(1); " . -"exec php_pdo_exec_select_proc; " . -"drop table #php_pdo; " . -"drop procedure php_pdo_exec_select_proc; "); +"insert into #test_batch_stmt_ins_exec values(1); " . +"exec test_proc_batch_stmt_ins_exec; " . +"drop table #test_batch_stmt_ins_exec; " . +"drop procedure test_proc_batch_stmt_ins_exec; "); // check results from the insert var_dump($stmt->rowCount()); diff --git a/ext/pdo_dblib/tests/batch_stmt_ins_sel_up_del.phpt b/ext/pdo_dblib/tests/batch_stmt_ins_sel_up_del.phpt index 6363a945a6d08..c871f681be752 100644 --- a/ext/pdo_dblib/tests/batch_stmt_ins_sel_up_del.phpt +++ b/ext/pdo_dblib/tests/batch_stmt_ins_sel_up_del.phpt @@ -13,13 +13,13 @@ if (!driver_supports_batch_statements_without_select($db)) die('xfail test will require __DIR__ . '/config.inc'; $stmt = $db->query( -"create table #php_pdo(id int);" . -"insert into #php_pdo values(1), (2), (3);" . -"select * from #php_pdo;" . -"update #php_pdo set id = 4;" . -"delete from #php_pdo;" . -"select * from #php_pdo;" . -"drop table #php_pdo;" +"create table #test_batch_stmt_ins_sel_up_del(id int);" . +"insert into #test_batch_stmt_ins_sel_up_del values(1), (2), (3);" . +"select * from #test_batch_stmt_ins_sel_up_del;" . +"update #test_batch_stmt_ins_sel_up_del set id = 4;" . +"delete from #test_batch_stmt_ins_sel_up_del;" . +"select * from #test_batch_stmt_ins_sel_up_del;" . +"drop table #test_batch_stmt_ins_sel_up_del;" ); // check results from the create table diff --git a/ext/pdo_dblib/tests/batch_stmt_ins_up.phpt b/ext/pdo_dblib/tests/batch_stmt_ins_up.phpt index 5c47cba651feb..bbe8cb1565915 100644 --- a/ext/pdo_dblib/tests/batch_stmt_ins_up.phpt +++ b/ext/pdo_dblib/tests/batch_stmt_ins_up.phpt @@ -13,11 +13,11 @@ if (!driver_supports_batch_statements_without_select($db)) die('xfail test will require __DIR__ . '/config.inc'; $stmt = $db->query( -"create table #php_pdo(id int);" . -"insert into #php_pdo values(1), (2), (3);" . -"update #php_pdo set id = 1;" . -"insert into #php_pdo values(2);" . -"drop table #php_pdo;" +"create table #test_batch_stmt_ins_up(id int);" . +"insert into #test_batch_stmt_ins_up values(1), (2), (3);" . +"update #test_batch_stmt_ins_up set id = 1;" . +"insert into #test_batch_stmt_ins_up values(2);" . +"drop table #test_batch_stmt_ins_up;" ); // check results from the create table diff --git a/ext/pdo_dblib/tests/batch_stmt_rowcount.phpt b/ext/pdo_dblib/tests/batch_stmt_rowcount.phpt index 0919f5fbf8501..fa101c8622689 100644 --- a/ext/pdo_dblib/tests/batch_stmt_rowcount.phpt +++ b/ext/pdo_dblib/tests/batch_stmt_rowcount.phpt @@ -13,11 +13,11 @@ if (!driver_supports_batch_statements_without_select($db)) die('xfail test will require __DIR__ . '/config.inc'; $stmt = $db->query( -"create table #php_pdo(id int); " . +"create table #test_batch_stmt_rowcount(id int); " . "set rowcount 2; " . -"insert into #php_pdo values(1), (2), (3); " . -"insert into #php_pdo values(4), (5), (6); " . -"update #php_pdo set id = 4; " . +"insert into #test_batch_stmt_rowcount values(1), (2), (3); " . +"insert into #test_batch_stmt_rowcount values(4), (5), (6); " . +"update #test_batch_stmt_rowcount set id = 4; " . "select @@rowcount; " ); @@ -52,9 +52,9 @@ var_dump($stmt->nextRowset()); // now cleanup and check that the results are expected $stmt = $db->query("set rowcount 0;" . -"select * from #php_pdo;" . -"delete from #php_pdo;" . -"drop table #php_pdo;" +"select * from #test_batch_stmt_rowcount;" . +"delete from #test_batch_stmt_rowcount;" . +"drop table #test_batch_stmt_rowcount;" ); // check results from set rowcount diff --git a/ext/pdo_dblib/tests/batch_stmt_transaction.phpt b/ext/pdo_dblib/tests/batch_stmt_transaction.phpt index fda74c2192c9c..2d9fbc7a4c7bf 100644 --- a/ext/pdo_dblib/tests/batch_stmt_transaction.phpt +++ b/ext/pdo_dblib/tests/batch_stmt_transaction.phpt @@ -13,15 +13,15 @@ if (!driver_supports_batch_statements_without_select($db)) die('xfail test will require __DIR__ . '/config.inc'; $stmt = $db->query( -"create table #php_pdo(id int);" . -"insert into #php_pdo values(1), (2), (3);" . -"select * from #php_pdo;" . +"create table #test_batch_stmt_transaction(id int);" . +"insert into #test_batch_stmt_transaction values(1), (2), (3);" . +"select * from #test_batch_stmt_transaction;" . "begin transaction;" . -"update #php_pdo set id = 4;" . +"update #test_batch_stmt_transaction set id = 4;" . "rollback transaction;" . -"select * from #php_pdo;" . -"delete from #php_pdo;" . -"drop table #php_pdo;" +"select * from #test_batch_stmt_transaction;" . +"delete from #test_batch_stmt_transaction;" . +"drop table #test_batch_stmt_transaction;" ); // check results from the create table diff --git a/ext/pdo_dblib/tests/batch_stmt_try.phpt b/ext/pdo_dblib/tests/batch_stmt_try.phpt index 78726f18774f2..30e2bf58bebc3 100644 --- a/ext/pdo_dblib/tests/batch_stmt_try.phpt +++ b/ext/pdo_dblib/tests/batch_stmt_try.phpt @@ -13,18 +13,18 @@ if (!driver_supports_batch_statements_without_select($db)) die('xfail test will require __DIR__ . '/config.inc'; $stmt = $db->query( -"create table #php_pdo(id int);" . -"insert into #php_pdo values(1), (2), (3);" . -"select * from #php_pdo;" . +"create table #test_batch_stmt_try(id int);" . +"insert into #test_batch_stmt_try values(1), (2), (3);" . +"select * from #test_batch_stmt_try;" . "begin try " . -" update #php_pdo set id = 'f';" . +" update #test_batch_stmt_try set id = 'f';" . "end try " . "begin catch " . " throw;" . "end catch " . -"select * from #php_pdo;" . -"delete from #php_pdo;" . -"drop table #php_pdo;" +"select * from #test_batch_stmt_try;" . +"delete from #test_batch_stmt_try;" . +"drop table #test_batch_stmt_try;" ); // check results from the create table diff --git a/ext/pdo_dblib/tests/bug_38955.phpt b/ext/pdo_dblib/tests/bug_38955.phpt index eaf51ceb50d85..1ec340a8c051b 100644 --- a/ext/pdo_dblib/tests/bug_38955.phpt +++ b/ext/pdo_dblib/tests/bug_38955.phpt @@ -11,27 +11,30 @@ require __DIR__ . '/config.inc'; require __DIR__ . '/config.inc'; /*We see these rows */ -$db->query("CREATE table php_test(val int)"); +$db->query("CREATE table test38955(val int)"); $db->beginTransaction(); -$db->query("INSERT INTO php_test(val) values(1)"); -$db->query("INSERT INTO php_test(val) values(2)"); -$db->query("INSERT INTO php_test(val) values(3)"); -$db->query("INSERT INTO php_test(val) values(4)"); +$db->query("INSERT INTO test38955(val) values(1)"); +$db->query("INSERT INTO test38955(val) values(2)"); +$db->query("INSERT INTO test38955(val) values(3)"); +$db->query("INSERT INTO test38955(val) values(4)"); $db->commit(); /*We don't see these rows */ $db->beginTransaction(); -$db->query("INSERT INTO php_test(val) values(5)"); -$db->query("INSERT INTO php_test(val) values(6)"); -$db->query("INSERT INTO php_test(val) values(7)"); -$db->query("INSERT INTO php_test(val) values(8)"); +$db->query("INSERT INTO test38955(val) values(5)"); +$db->query("INSERT INTO test38955(val) values(6)"); +$db->query("INSERT INTO test38955(val) values(7)"); +$db->query("INSERT INTO test38955(val) values(8)"); $db->rollback(); -$rs = $db->query("SELECT * FROM php_test"); +$rs = $db->query("SELECT * FROM test38955"); $rows = $rs->fetchAll(PDO::FETCH_ASSOC); var_dump($rows); - -$db->query("DROP table php_test"); +?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test38955"); ?> --EXPECT-- array(4) { diff --git a/ext/pdo_dblib/tests/bug_47588.phpt b/ext/pdo_dblib/tests/bug_47588.phpt index dcfd7286c3673..a0671e5846dd8 100644 --- a/ext/pdo_dblib/tests/bug_47588.phpt +++ b/ext/pdo_dblib/tests/bug_47588.phpt @@ -10,15 +10,19 @@ require __DIR__ . '/config.inc'; query('CREATE TABLE "Test Table" ("My Field" int, "Another Field" varchar(32) not null default \'test_string\')'); -$db->query('INSERT INTO "Test Table" ("My Field") values(1)'); -$db->query('INSERT INTO "Test Table" ("My Field") values(2)'); -$db->query('INSERT INTO "Test Table" ("My Field") values(3)'); -$rs = $db->query('SELECT * FROM "Test Table"'); +$db->query('CREATE TABLE "Test Table47588" ("My Field" int, "Another Field" varchar(32) not null default \'test_string\')'); +$db->query('INSERT INTO "Test Table47588" ("My Field") values(1)'); +$db->query('INSERT INTO "Test Table47588" ("My Field") values(2)'); +$db->query('INSERT INTO "Test Table47588" ("My Field") values(3)'); +$rs = $db->query('SELECT * FROM "Test Table47588"'); var_dump($rs->fetchAll(PDO::FETCH_ASSOC)); -$db->query('DROP TABLE "Test Table"'); echo "Done.\n"; ?> +--CLEAN-- +exec('DROP TABLE IF EXISTS "Test Table47588"'); +?> --EXPECT-- array(3) { [0]=> diff --git a/ext/pdo_firebird/tests/CONFLICTS b/ext/pdo_firebird/tests/CONFLICTS deleted file mode 100644 index 4667cdfa07662..0000000000000 --- a/ext/pdo_firebird/tests/CONFLICTS +++ /dev/null @@ -1 +0,0 @@ -firebird diff --git a/ext/pdo_firebird/tests/bug_47415.phpt b/ext/pdo_firebird/tests/bug_47415.phpt index f9698b7110ee6..a1a36d6a11ccf 100644 --- a/ext/pdo_firebird/tests/bug_47415.phpt +++ b/ext/pdo_firebird/tests/bug_47415.phpt @@ -10,16 +10,14 @@ LSAN_OPTIONS=detect_leaks=0 setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -@$dbh->exec('DROP TABLE testz'); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -$dbh->exec('CREATE TABLE testz (idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$dbh->exec('INSERT INTO testz VALUES(0, \'String0\')'); +$dbh->exec('CREATE TABLE test47415 (idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); +$dbh->exec('INSERT INTO test47415 VALUES(0, \'String0\')'); $dbh->commit(); -$query = "SELECT idx, txt FROM testz ORDER by idx"; +$query = "SELECT idx, txt FROM test47415 ORDER by idx"; $idx = $txt = 0; $stmt = $dbh->prepare($query); $stmt->bindColumn('idx', $idx); @@ -30,7 +28,7 @@ var_dump($stmt->fetch()); var_dump($stmt->rowCount()); -$stmt = $dbh->prepare('DELETE FROM testz'); +$stmt = $dbh->prepare('DELETE FROM test47415'); $stmt->execute(); $dbh->commit(); @@ -38,6 +36,11 @@ $dbh->commit(); unset($stmt); unset($dbh); ?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test47415"); +?> --EXPECT-- bool(false) int(1) diff --git a/ext/pdo_firebird/tests/bug_48877.phpt b/ext/pdo_firebird/tests/bug_48877.phpt index c7845fbe1bf80..d8c9cfe04bbdc 100644 --- a/ext/pdo_firebird/tests/bug_48877.phpt +++ b/ext/pdo_firebird/tests/bug_48877.phpt @@ -13,15 +13,13 @@ require("testdb.inc"); $value = '2'; -$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -@$dbh->exec('DROP TABLE testz'); -$dbh->exec('CREATE TABLE testz (A integer)'); -$dbh->exec("INSERT INTO testz VALUES ('1')"); -$dbh->exec("INSERT INTO testz VALUES ('2')"); -$dbh->exec("INSERT INTO testz VALUES ('3')"); +$dbh->exec('CREATE TABLE test48877 (A integer)'); +$dbh->exec("INSERT INTO test48877 VALUES ('1')"); +$dbh->exec("INSERT INTO test48877 VALUES ('2')"); +$dbh->exec("INSERT INTO test48877 VALUES ('3')"); $dbh->commit(); -$query = "SELECT * FROM testz WHERE A = :paramno"; +$query = "SELECT * FROM test48877 WHERE A = :paramno"; $stmt = $dbh->prepare($query); $stmt->bindParam(':paramno', $value, PDO::PARAM_STR); @@ -31,16 +29,18 @@ var_dump($stmt->fetch()); var_dump($stmt->rowCount()); -$stmt = $dbh->prepare('DELETE FROM testz'); +$stmt = $dbh->prepare('DELETE FROM test48877'); $stmt->execute(); $dbh->commit(); - -$dbh->exec('DROP TABLE testz'); - unset($stmt); unset($dbh); +?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test48877"); ?> --EXPECT-- bool(false) diff --git a/ext/pdo_firebird/tests/bug_53280.phpt b/ext/pdo_firebird/tests/bug_53280.phpt index 21366a099273b..6aa79bf35225a 100644 --- a/ext/pdo_firebird/tests/bug_53280.phpt +++ b/ext/pdo_firebird/tests/bug_53280.phpt @@ -11,14 +11,12 @@ LSAN_OPTIONS=detect_leaks=0 require("testdb.inc"); -$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -@$dbh->exec('DROP TABLE testz'); -$dbh->exec('CREATE TABLE testz(A VARCHAR(30), B VARCHAR(30), C VARCHAR(30))'); -$dbh->exec("INSERT INTO testz VALUES ('A', 'B', 'C')"); +$dbh->exec('CREATE TABLE test53280(A VARCHAR(30), B VARCHAR(30), C VARCHAR(30))'); +$dbh->exec("INSERT INTO test53280 VALUES ('A', 'B', 'C')"); $dbh->commit(); -$stmt1 = "SELECT B FROM testz WHERE A = ? AND B = ?"; -$stmt2 = "SELECT B, C FROM testz WHERE A = ? AND B = ?"; +$stmt1 = "SELECT B FROM test53280 WHERE A = ? AND B = ?"; +$stmt2 = "SELECT B, C FROM test53280 WHERE A = ? AND B = ?"; $stmth2 = $dbh->prepare($stmt2); $stmth2->execute(array('A', 'B')); @@ -33,12 +31,14 @@ var_dump($rows); $dbh->commit(); unset($stmth1); unset($stmth2); - -$dbh->exec('DROP TABLE testz'); - unset($stmt); unset($dbh); +?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test53280"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo_firebird/tests/bug_62024.phpt b/ext/pdo_firebird/tests/bug_62024.phpt index 0aaf3701dffd4..10331deda4894 100644 --- a/ext/pdo_firebird/tests/bug_62024.phpt +++ b/ext/pdo_firebird/tests/bug_62024.phpt @@ -12,14 +12,13 @@ LSAN_OPTIONS=detect_leaks=0 require("testdb.inc"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -@$dbh->exec('DROP TABLE test_insert'); -$dbh->exec("CREATE TABLE test_insert (ID INTEGER NOT NULL, TEXT VARCHAR(10))"); +$dbh->exec("CREATE TABLE test62024 (ID INTEGER NOT NULL, TEXT VARCHAR(10))"); $dbh->commit(); //start actual test -$sql = "insert into test_insert (id, text) values (?, ?)"; +$sql = "insert into test62024 (id, text) values (?, ?)"; $sttmt = $dbh->prepare($sql); $args_ok = array(1, "test1"); @@ -35,16 +34,19 @@ $dbh->commit(); //teardown test data -$sttmt = $dbh->prepare('DELETE FROM test_insert'); +$sttmt = $dbh->prepare('DELETE FROM test62024'); $sttmt->execute(); $dbh->commit(); -$dbh->exec('DROP TABLE test_insert'); - unset($sttmt); unset($dbh); +?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test62024"); ?> --EXPECT-- bool(true) diff --git a/ext/pdo_firebird/tests/bug_64037.phpt b/ext/pdo_firebird/tests/bug_64037.phpt index 2095ddcbdb75e..8f772f993afae 100644 --- a/ext/pdo_firebird/tests/bug_64037.phpt +++ b/ext/pdo_firebird/tests/bug_64037.phpt @@ -12,15 +12,14 @@ LSAN_OPTIONS=detect_leaks=0 require("testdb.inc"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -@$dbh->exec('DROP TABLE price'); -$dbh->exec("CREATE TABLE PRICE (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15, 2))"); -$dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (1, 'test', -1.0)"); -$dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (2, 'test', -0.99)"); -$dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (3, 'test', -1.01)"); +$dbh->exec("CREATE TABLE test64037 (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15, 2))"); +$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (1, 'test', -1.0)"); +$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (2, 'test', -0.99)"); +$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (3, 'test', -1.01)"); $dbh->commit(); -$query = "SELECT * from price order by ID"; +$query = "SELECT * from test64037 order by ID"; $stmt = $dbh->prepare($query); $stmt->execute(); $rows = $stmt->fetchAll(); @@ -29,16 +28,19 @@ var_dump($rows[1]['COST']); var_dump($rows[2]['COST']); -$stmt = $dbh->prepare('DELETE FROM price'); +$stmt = $dbh->prepare('DELETE FROM test64037'); $stmt->execute(); $dbh->commit(); -$dbh->exec('DROP TABLE price'); - unset($stmt); unset($dbh); +?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test64037"); ?> --EXPECT-- string(5) "-1.00" diff --git a/ext/pdo_firebird/tests/bug_72583.phpt b/ext/pdo_firebird/tests/bug_72583.phpt index 136c387edb43b..e1c22142c2540 100644 --- a/ext/pdo_firebird/tests/bug_72583.phpt +++ b/ext/pdo_firebird/tests/bug_72583.phpt @@ -10,15 +10,20 @@ LSAN_OPTIONS=detect_leaks=0 exec('recreate table atable (aint integer, asmi smallint)'); -$dbh->exec('insert into atable values (1, -1)'); -$S = $dbh->prepare('select aint, asmi from atable'); +$dbh->exec('recreate table test72583 (aint integer, asmi smallint)'); +$dbh->exec('insert into test72583 values (1, -1)'); +$S = $dbh->prepare('select aint, asmi from test72583'); $S->execute(); $D = $S->fetch(PDO::FETCH_NUM); echo gettype($D[0])."\n".gettype($D[1]); unset($S); unset($dbh); ?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test72583"); +?> --EXPECT-- integer integer diff --git a/ext/pdo_firebird/tests/bug_72931.phpt b/ext/pdo_firebird/tests/bug_72931.phpt index edd899bf3a631..a0f2f1066f259 100644 --- a/ext/pdo_firebird/tests/bug_72931.phpt +++ b/ext/pdo_firebird/tests/bug_72931.phpt @@ -10,13 +10,18 @@ LSAN_OPTIONS=detect_leaks=0 exec('recreate table tablea (id integer)'); -$S = $dbh->prepare('insert into tablea (id) values (1) returning id'); +$dbh->exec('recreate table test72931 (id integer)'); +$S = $dbh->prepare('insert into test72931 (id) values (1) returning id'); $S->execute(); $D = $S->fetch(PDO::FETCH_NUM); echo $D[0]; unset($S); unset($dbh); ?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test72931"); +?> --EXPECT-- 1 diff --git a/ext/pdo_firebird/tests/bug_73087.phpt b/ext/pdo_firebird/tests/bug_73087.phpt index 26bb4ea09866b..2c13d1f40326c 100644 --- a/ext/pdo_firebird/tests/bug_73087.phpt +++ b/ext/pdo_firebird/tests/bug_73087.phpt @@ -10,8 +10,8 @@ LSAN_OPTIONS=detect_leaks=0 exec('recreate table atable (id integer not null, content blob sub_type 1 segment size 80)'); -$S = $dbh->prepare('insert into atable (id, content) values (:id, :content)'); +$dbh->exec('recreate table test73087 (id integer not null, content blob sub_type 1 segment size 80)'); +$S = $dbh->prepare('insert into test73087 (id, content) values (:id, :content)'); for ($I = 1; $I < 10; $I++) { $Params = [ 'id' => $I, @@ -25,5 +25,10 @@ unset($S); unset($dbh); echo 'OK'; ?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test73087"); +?> --EXPECT-- OK diff --git a/ext/pdo_firebird/tests/bug_74462.phpt b/ext/pdo_firebird/tests/bug_74462.phpt index 7500933830903..630c658fb2c4a 100644 --- a/ext/pdo_firebird/tests/bug_74462.phpt +++ b/ext/pdo_firebird/tests/bug_74462.phpt @@ -10,16 +10,21 @@ LSAN_OPTIONS=detect_leaks=0 exec('recreate table atable (id integer not null, abool boolean)'); -$dbh->exec('insert into atable (id, abool) values (1, true)'); -$dbh->exec('insert into atable (id, abool) values (2, false)'); -$dbh->exec('insert into atable (id, abool) values (3, null)'); -$S = $dbh->query('select abool from atable order by id'); +$dbh->exec('recreate table test74462 (id integer not null, abool boolean)'); +$dbh->exec('insert into test74462 (id, abool) values (1, true)'); +$dbh->exec('insert into test74462 (id, abool) values (2, false)'); +$dbh->exec('insert into test74462 (id, abool) values (3, null)'); +$S = $dbh->query('select abool from test74462 order by id'); $D = $S->fetchAll(PDO::FETCH_COLUMN); unset($S); unset($dbh); var_dump($D); ?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test74462"); +?> --EXPECT-- array(3) { [0]=> diff --git a/ext/pdo_firebird/tests/bug_aaa.phpt b/ext/pdo_firebird/tests/bug_aaa.phpt index b25c5f98897cc..64f976b8c57f3 100644 --- a/ext/pdo_firebird/tests/bug_aaa.phpt +++ b/ext/pdo_firebird/tests/bug_aaa.phpt @@ -11,14 +11,19 @@ LSAN_OPTIONS=detect_leaks=0 require 'testdb.inc'; $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -@$dbh->exec('drop table ta_table'); -$dbh->exec('create table ta_table (id integer)'); -$S = $dbh->prepare('insert into ta_table (id) values (:id) returning id'); +@$dbh->exec('drop table test_aaa'); +$dbh->exec('create table test_aaa (id integer)'); +$S = $dbh->prepare('insert into test_aaa (id) values (:id) returning id'); $S->execute(['id' => 1]); $S->execute(['id' => 2]); unset($S); unset($dbh); echo 'OK'; ?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test_aaa"); +?> --EXPECT-- OK diff --git a/ext/pdo_firebird/tests/ddl.phpt b/ext/pdo_firebird/tests/ddl.phpt index f95b6e4041b89..56e3e431feff5 100644 --- a/ext/pdo_firebird/tests/ddl.phpt +++ b/ext/pdo_firebird/tests/ddl.phpt @@ -9,33 +9,36 @@ LSAN_OPTIONS=detect_leaks=0 --FILE-- setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); +$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - @$dbh->exec('DROP TABLE ddl'); - @$dbh->exec('DROP GENERATOR gen_ddl_id'); - @$dbh->exec('DROP TRIGGER ddl_bi'); +$dbh->exec("CREATE TABLE test_ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)"); +$dbh->exec("CREATE GENERATOR gen_ddl_id"); +$dbh->exec("CREATE TRIGGER ddl_bi FOR test_ddl BEFORE INSERT AS + BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END"); - $dbh->exec("CREATE TABLE ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)"); - $dbh->exec("CREATE GENERATOR gen_ddl_id"); - $dbh->exec("CREATE TRIGGER ddl_bi FOR ddl BEFORE INSERT AS - BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END"); +$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT,0); - $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT,0); +$dbh->beginTransaction(); +var_dump($dbh->exec("INSERT INTO test_ddl (text) VALUES ('bla')")); +var_dump($dbh->exec("UPDATE test_ddl SET text='blabla'")); +$dbh->rollback(); - $dbh->beginTransaction(); - var_dump($dbh->exec("INSERT INTO ddl (text) VALUES ('bla')")); - var_dump($dbh->exec("UPDATE ddl SET text='blabla'")); - $dbh->rollback(); +$dbh->beginTransaction(); +var_dump($dbh->exec("DELETE FROM test_ddl")); +$dbh->commit(); - $dbh->beginTransaction(); - var_dump($dbh->exec("DELETE FROM ddl")); - $dbh->commit(); - - unset($dbh); - echo "done\n"; +unset($dbh); +echo "done\n"; +?> +--CLEAN-- +exec('DROP TABLE test_ddl'); +$dbh->exec('DROP GENERATOR gen_ddl_id'); +$dbh->exec('DROP TRIGGER ddl_bi'); ?> --EXPECT-- int(1) diff --git a/ext/pdo_firebird/tests/dialect_1.phpt b/ext/pdo_firebird/tests/dialect_1.phpt index dec35c57068b6..5a65018984913 100644 --- a/ext/pdo_firebird/tests/dialect_1.phpt +++ b/ext/pdo_firebird/tests/dialect_1.phpt @@ -12,46 +12,50 @@ if (strpos(getenv('PDO_FIREBIRD_TEST_DSN'), 'dialect=1')===false) { LSAN_OPTIONS=detect_leaks=0 --FILE-- setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); +$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); +$dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); - $sql = - 'SELECT - 1 as N, - 2.0 as F, - cast(0.76 as numeric(15, 2)) as K, - cast(\'2019-06-12\' as date) as DT - FROM RDB$DATABASE'; - $query = $dbh->prepare($sql); - $query->execute(); - $row = $query->fetch(\PDO::FETCH_OBJ); - var_dump($row->N); - var_dump($row->F); - var_dump($row->K); - var_dump($row->DT); +$sql = +'SELECT + 1 as N, + 2.0 as F, + cast(0.76 as numeric(15, 2)) as K, + cast(\'2019-06-12\' as date) as DT +FROM RDB$DATABASE'; +$query = $dbh->prepare($sql); +$query->execute(); +$row = $query->fetch(\PDO::FETCH_OBJ); +var_dump($row->N); +var_dump($row->F); +var_dump($row->K); +var_dump($row->DT); - unset($query); +unset($query); - $dbh->exec('RECREATE TABLE test_d1(K numeric(15, 2), DT date)'); - $sql='INSERT INTO test_d1(K, DT) values(?, ?)'; - $query = $dbh->prepare($sql); - $query->execute([0.76, '2019-06-12']); - unset($query); +$dbh->exec('RECREATE TABLE test_dialect_1(K numeric(15, 2), DT date)'); +$sql='INSERT INTO test_dialect_1(K, DT) values(?, ?)'; +$query = $dbh->prepare($sql); +$query->execute([0.76, '2019-06-12']); +unset($query); - $sql='SELECT * FROM test_d1'; - $query = $dbh->prepare($sql); - $query->execute(); - $row = $query->fetch(\PDO::FETCH_OBJ); - var_dump($row->K); - var_dump($row->DT); +$sql='SELECT * FROM test_dialect_1'; +$query = $dbh->prepare($sql); +$query->execute(); +$row = $query->fetch(\PDO::FETCH_OBJ); +var_dump($row->K); +var_dump($row->DT); - unset($query); - unset($dbh); - echo "done\n"; +unset($query); +unset($dbh); +echo "done\n"; ?> +--CLEAN-- +exec('DROP TABLE IF EXISTS test_dialect_1'); --EXPECT-- int(1) string(8) "2.000000" diff --git a/ext/pdo_firebird/tests/execute.phpt b/ext/pdo_firebird/tests/execute.phpt index 4cc6421be0f6c..1db5a14c96e7c 100644 --- a/ext/pdo_firebird/tests/execute.phpt +++ b/ext/pdo_firebird/tests/execute.phpt @@ -8,43 +8,45 @@ pdo_firebird LSAN_OPTIONS=detect_leaks=0 --FILE-- getAttribute(PDO::ATTR_CONNECTION_STATUS)); +var_dump($dbh->getAttribute(PDO::ATTR_CONNECTION_STATUS)); - $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); +$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); +$dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); - @$dbh->exec('DROP TABLE ddl'); - $dbh->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32), - datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)"); - $dbh->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')"); +$dbh->exec("CREATE TABLE test_execute (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32), + datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)"); +$dbh->exec("INSERT INTO test_execute (id,text) VALUES (1,'bla')"); - $s = $dbh->prepare("SELECT * FROM ddl WHERE id=? FOR UPDATE"); +$s = $dbh->prepare("SELECT * FROM test_execute WHERE id=? FOR UPDATE"); - $id = 0; - $s->bindParam(1,$id); - $var = null; - $s->bindColumn("TEXT",$var); - $id = 1; - $s->execute(); - $s->setAttribute(PDO::ATTR_CURSOR_NAME, "c"); +$id = 0; +$s->bindParam(1,$id); +$var = null; +$s->bindColumn("TEXT",$var); +$id = 1; +$s->execute(); +$s->setAttribute(PDO::ATTR_CURSOR_NAME, "c"); - var_dump($id); +var_dump($id); - var_dump($s->fetch()); +var_dump($s->fetch()); - var_dump($var); +var_dump($var); - var_dump($dbh->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c")); +var_dump($dbh->exec("UPDATE test_execute SET id=2 WHERE CURRENT OF c")); - var_dump($s->fetch()); - - unset($s); - unset($dbh); - echo "done\n"; +var_dump($s->fetch()); +unset($s); +unset($dbh); +echo "done\n"; ?> +--CLEAN-- +exec('DROP TABLE IF EXISTS test_execute'); --EXPECT-- bool(true) int(1) diff --git a/ext/pdo_firebird/tests/rowCount.phpt b/ext/pdo_firebird/tests/rowCount.phpt index d955493d828d8..86090a3b3cae4 100644 --- a/ext/pdo_firebird/tests/rowCount.phpt +++ b/ext/pdo_firebird/tests/rowCount.phpt @@ -11,15 +11,13 @@ LSAN_OPTIONS=detect_leaks=0 require("testdb.inc"); -$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -@$dbh->exec('DROP TABLE testz'); -$dbh->exec('CREATE TABLE testz (A VARCHAR(10))'); -$dbh->exec("INSERT INTO testz VALUES ('A')"); -$dbh->exec("INSERT INTO testz VALUES ('A')"); -$dbh->exec("INSERT INTO testz VALUES ('B')"); +$dbh->exec('CREATE TABLE test_rowcount (A VARCHAR(10))'); +$dbh->exec("INSERT INTO test_rowcount VALUES ('A')"); +$dbh->exec("INSERT INTO test_rowcount VALUES ('A')"); +$dbh->exec("INSERT INTO test_rowcount VALUES ('B')"); $dbh->commit(); -$query = "SELECT * FROM testz WHERE A = ?"; +$query = "SELECT * FROM test_rowcount WHERE A = ?"; $stmt = $dbh->prepare($query); $stmt->execute(array('A')); @@ -28,23 +26,25 @@ $rows = $stmt->fetch(); var_dump($stmt->fetch()); var_dump($stmt->rowCount()); -$stmt = $dbh->prepare('UPDATE testZ SET A="A" WHERE A != ?'); +$stmt = $dbh->prepare('UPDATE test_rowcount SET A="A" WHERE A != ?'); $stmt->execute(array('A')); var_dump($stmt->rowCount()); $dbh->commit(); -$stmt = $dbh->prepare('DELETE FROM testz'); +$stmt = $dbh->prepare('DELETE FROM test_rowcount'); $stmt->execute(); var_dump($stmt->rowCount()); $dbh->commit(); -$dbh->exec('DROP TABLE testz'); - unset($stmt); unset($dbh); ?> +--CLEAN-- +exec('DROP TABLE IF EXISTS test_rowcount'); --EXPECT-- bool(false) int(2) diff --git a/ext/pdo_oci/tests/CONFLICTS b/ext/pdo_oci/tests/CONFLICTS deleted file mode 100644 index ff6afc6fb0838..0000000000000 --- a/ext/pdo_oci/tests/CONFLICTS +++ /dev/null @@ -1,2 +0,0 @@ -# OCI tests are network intensive and may cause timeouts in other tests -all diff --git a/ext/pdo_oci/tests/bug46274.phpt b/ext/pdo_oci/tests/bug46274.phpt index 3c098e695305f..5c6269e2c8175 100644 --- a/ext/pdo_oci/tests/bug46274.phpt +++ b/ext/pdo_oci/tests/bug46274.phpt @@ -16,16 +16,11 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); -try { - $db->exec("DROP TABLE test_one_blob"); -} catch (Exception $e) { -} - $db->beginTransaction(); -$db->query('CREATE TABLE test_one_blob (id INT NOT NULL, blob1 BLOB)'); +$db->query('CREATE TABLE test46274 (id INT NOT NULL, blob1 BLOB)'); -$stmt = $db->prepare("INSERT INTO test_one_blob (id, blob1) VALUES (:id, EMPTY_BLOB()) RETURNING blob1 INTO :foo"); +$stmt = $db->prepare("INSERT INTO test46274 (id, blob1) VALUES (:id, EMPTY_BLOB()) RETURNING blob1 INTO :foo"); $data = 'foo'; $blob = fopen('php://memory', 'a'); @@ -47,15 +42,18 @@ $stmt->bindparam(':id', $id); $stmt->bindparam(':foo', $blob, PDO::PARAM_LOB); $stmt->execute(); -$res = $db->query("SELECT blob1 from test_one_blob"); +$res = $db->query("SELECT blob1 from test46274"); // Resource var_dump($res->fetch()); // Empty string var_dump($res->fetch()); - -$db->exec("DROP TABLE test_one_blob"); - +?> +--CLEAN-- +exec("DROP TABLE test46274"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo_oci/tests/bug46274_2.phpt b/ext/pdo_oci/tests/bug46274_2.phpt index 333ef724de383..88149308d61c3 100644 --- a/ext/pdo_oci/tests/bug46274_2.phpt +++ b/ext/pdo_oci/tests/bug46274_2.phpt @@ -16,16 +16,11 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); -try { - $db->exec("DROP TABLE test_one_blob"); -} catch (Exception $e) { -} - $db->beginTransaction(); -$db->query('CREATE TABLE test_one_blob (id INT NOT NULL, blob1 BLOB)'); +$db->query('CREATE TABLE test46274_2 (id INT NOT NULL, blob1 BLOB)'); -$stmt = $db->prepare("INSERT INTO test_one_blob (id, blob1) VALUES (:id, EMPTY_BLOB()) RETURNING blob1 INTO :foo"); +$stmt = $db->prepare("INSERT INTO test46274_2 (id, blob1) VALUES (:id, EMPTY_BLOB()) RETURNING blob1 INTO :foo"); $data = 'foo'; $blob = fopen('php://memory', 'a'); @@ -47,7 +42,7 @@ $stmt->bindparam(':id', $id); $stmt->bindparam(':foo', $blob, PDO::PARAM_LOB); $stmt->execute(); -$res = $db->query("SELECT blob1 from test_one_blob"); +$res = $db->query("SELECT blob1 from test46274_2"); // Resource var_dump($row = $res->fetch()); var_dump(fread($row[0], 1024)); @@ -58,8 +53,12 @@ var_dump($row = $res->fetch()); var_dump(fread($row[0], 1024)); fclose($row[0]); -$db->exec("DROP TABLE test_one_blob"); - +?> +--CLEAN-- +exec("DROP TABLE test46274_2"); ?> --EXPECTF-- array(2) { diff --git a/ext/pdo_oci/tests/bug54379.phpt b/ext/pdo_oci/tests/bug54379.phpt index e7992ca834053..9c91c82f9095c 100644 --- a/ext/pdo_oci/tests/bug54379.phpt +++ b/ext/pdo_oci/tests/bug54379.phpt @@ -15,10 +15,7 @@ PDOTest::skip(); require 'ext/pdo/tests/pdo_test.inc'; $db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -try { - $db->exec("DROP TABLE test"); -} catch (Exception $e) { -} + $db->exec("CREATE TABLE test (col1 NVARCHAR2(20))"); $db->exec("INSERT INTO test VALUES('12345678901234567890')"); $db->exec("INSERT INTO test VALUES('ใ‚ใ„ใ†ใˆใŠใ‹ใใใ‘ใ“ใ•ใ—ใ™ใ›ใใŸใกใคใฆใจ')"); @@ -27,6 +24,12 @@ $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); $db->exec("DROP TABLE test"); ?> +--CLEAN-- +exec("DROP TABLE test54379"); +?> --EXPECT-- array(2) { [0]=> diff --git a/ext/pdo_oci/tests/bug57702.phpt b/ext/pdo_oci/tests/bug57702.phpt index b17add13f82bf..e58e1e71727bc 100644 --- a/ext/pdo_oci/tests/bug57702.phpt +++ b/ext/pdo_oci/tests/bug57702.phpt @@ -17,18 +17,14 @@ $db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt'); // Note the PDO test setup sets PDO::ATTR_STRINGIFY_FETCHES to true // (and sets PDO::ATTR_CASE to PDO::CASE_LOWER) -$query = "begin execute immediate 'drop table bug57702'; exception when others then if sqlcode <> -942 then raise; end if; end;"; -$stmt = $db->prepare($query); -$stmt->execute(); - -$query = "create table bug57702 (id number, data1 blob, data2 blob)"; +$query = "create table test57702 (id number, data1 blob, data2 blob)"; $stmt = $db->prepare($query); $stmt->execute(); function do_insert($db, $id, $data1, $data2) { $db->beginTransaction(); - $stmt = $db->prepare("insert into bug57702 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2"); + $stmt = $db->prepare("insert into test57702 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2"); $stmt->bindParam(':id', $id); $stmt->bindParam(':blob1', $blob1, PDO::PARAM_LOB); $stmt->bindParam(':blob2', $blob2, PDO::PARAM_LOB); @@ -51,7 +47,7 @@ do_insert($db, 2, "row 2 col 1", "row 2 col 2"); echo "First Query\n"; // Fetch it back -$stmt = $db->prepare('select data1, data2 from bug57702 order by id'); +$stmt = $db->prepare('select data1, data2 from test57702 order by id'); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); var_dump($row['data1']); @@ -64,7 +60,7 @@ var_dump($row['data2']); echo "\nSecond Query\n"; -foreach($db->query("select data1 as d1, data2 as d2 from bug57702 order by id") as $row) { +foreach($db->query("select data1 as d1, data2 as d2 from test57702 order by id") as $row) { var_dump($row['d1']); var_dump($row['d2']); } @@ -73,7 +69,7 @@ foreach($db->query("select data1 as d1, data2 as d2 from bug57702 order by id") echo "\nThird Query\n"; -$stmt = $db->prepare('select data1 as d3_1, data2 as d3_2 from bug57702 order by id'); +$stmt = $db->prepare('select data1 as d3_1, data2 as d3_2 from test57702 order by id'); $rs = $stmt->execute(); $stmt->bindColumn('d3_1' , $clob1, PDO::PARAM_LOB); @@ -90,7 +86,7 @@ echo "\nFourth Query\n"; $a = array(); $i = 0; -foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) { +foreach($db->query("select data1 as d4_1, data2 as d4_2 from test57702 order by id") as $row) { $a[$i][0] = $row['d4_1']; $a[$i][1] = $row['d4_2']; $i++; @@ -113,7 +109,7 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams $a = array(); $i = 0; -foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) { +foreach($db->query("select data1 as d4_1, data2 as d4_2 from test57702 order by id") as $row) { $a[$i][0] = $row['d4_1']; $a[$i][1] = $row['d4_2']; $i++; @@ -132,7 +128,7 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams $a = array(); $i = 0; -foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) { +foreach($db->query("select data1 as d4_1, data2 as d4_2 from test57702 order by id") as $row) { $a[$i][0] = $row['d4_1']; $a[$i][1] = $row['d4_2']; var_dump(stream_get_contents($a[$i][0])); @@ -140,13 +136,14 @@ foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by i $i++; } -// Cleanup -$query = "drop table bug57702"; -$stmt = $db->prepare($query); -$stmt->execute(); - print "done\n"; +?> +--CLEAN-- +exec("DROP TABLE test57702"); ?> --EXPECT-- First Query diff --git a/ext/pdo_oci/tests/bug60994.phpt b/ext/pdo_oci/tests/bug60994.phpt index 6f5c9161dc8e5..a22d4aced6e42 100644 --- a/ext/pdo_oci/tests/bug60994.phpt +++ b/ext/pdo_oci/tests/bug60994.phpt @@ -20,7 +20,6 @@ $dbh = PDOTest::factory(); $dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); $dbh->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); -@$dbh->exec('DROP TABLE pdo_oci_bug60994'); $dbh->exec('CREATE TABLE pdo_oci_bug60994 (id NUMBER, data CLOB, data2 NCLOB)'); $id = null; @@ -109,6 +108,12 @@ if ($string4 != $stream4 || $stream4 != stream_get_contents($row['DATA2'])) { echo 'Expected nclob value to match clob value for stream4', PHP_EOL; } ?> +--CLEAN-- +exec("DROP TABLE pdo_oci_bug60994"); +?> --EXPECT-- Test 1: j size of string1 is 8193 bytes, 8193 chars. diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt index 9eb3518ec8911..3b127af5f7eca 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt @@ -15,8 +15,6 @@ require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); $dbh = PDOTest::factory(); -$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -$dbh->exec("drop table pdo_ac_tab"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); print "PDO::ATTR_AUTOCOMMIT: Default: "; @@ -39,22 +37,26 @@ var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT)); // Use 2nd connection to check that autocommit does commit echo "Insert data\n"; -$dbh->exec("create table pdo_ac_tab (col1 varchar2(20))"); -$dbh->exec("insert into pdo_ac_tab (col1) values ('some data')"); +$dbh->exec("create table test_pdo_oci_attr_autocommit_1 (col1 varchar2(20))"); +$dbh->exec("insert into test_pdo_oci_attr_autocommit_1 (col1) values ('some data')"); $dbh2 = PDOTest::factory(); echo "Second connection should be able to see committed data\n"; -$s = $dbh2->prepare("select col1 from pdo_ac_tab"); +$s = $dbh2->prepare("select col1 from test_pdo_oci_attr_autocommit_1"); $s->execute(); while ($r = $s->fetch()) { echo "Data is: " . $r[0] . "\n"; } -$dbh->exec("drop table pdo_ac_tab"); - echo "Done\n"; +?> +--CLEAN-- +exec("DROP TABLE test_pdo_oci_attr_autocommit_1"); ?> --EXPECT-- PDO::ATTR_AUTOCOMMIT: Default: bool(true) diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt index e2d11db503662..dce701a35fc9d 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt @@ -14,8 +14,6 @@ PDOTest::skip(); require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); $dbh = PDOTest::factory(); -$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -$dbh->exec("drop table pdo_ac_tab"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbh->exec("create table pdo_ac_tab (col1 varchar2(25))"); @@ -102,6 +100,12 @@ while ($r = $s->fetch()) { echo "Done\n"; +?> +--CLEAN-- +exec("DROP TABLE test_pdo_oci_attr_autocommit_2"); ?> --EXPECTF-- Test 1 Check beginTransaction insertion diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt index 277a17f0740f4..b0bcd628556e6 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt @@ -17,9 +17,6 @@ require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); putenv('PDOTEST_ATTR='.serialize(array(PDO::ATTR_AUTOCOMMIT=>false))); $dbh = PDOTest::factory(); -$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -$dbh->exec("drop table pdo_ac_tab"); - $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); print "PDO::ATTR_AUTOCOMMIT: "; @@ -27,24 +24,28 @@ var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT)); echo "Insert data\n"; -$dbh->exec("create table pdo_ac_tab (col1 varchar2(20))"); +$dbh->exec("create table test_pdo_oci_attr_autocommit_3 (col1 varchar2(20))"); -$dbh->exec("insert into pdo_ac_tab (col1) values ('some data')"); +$dbh->exec("insert into test_pdo_oci_attr_autocommit_3 (col1) values ('some data')"); $dbh = null; // close first connection echo "Second connection should be able to see committed data\n"; $dbh2 = PDOTest::factory(); -$s = $dbh2->prepare("select col1 from pdo_ac_tab"); +$s = $dbh2->prepare("select col1 from test_pdo_oci_attr_autocommit_3"); $s->execute(); while ($r = $s->fetch()) { echo "Data is: " . $r[0] . "\n"; } -$dbh2->exec("drop table pdo_ac_tab"); - echo "Done\n"; +?> +--CLEAN-- +exec("DROP TABLE test_pdo_oci_attr_autocommit_3"); ?> --EXPECT-- PDO::ATTR_AUTOCOMMIT: bool(false) diff --git a/ext/pdo_oci/tests/pdo_oci_fread_1.phpt b/ext/pdo_oci/tests/pdo_oci_fread_1.phpt index 1d9f9e24b3697..4f50ad775f392 100644 --- a/ext/pdo_oci/tests/pdo_oci_fread_1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_fread_1.phpt @@ -20,12 +20,11 @@ $dbh->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Initialization $stmtarray = array( - "begin execute immediate 'drop table pdo_oci_fread_tab'; exception when others then null; end;", - "create table pdo_oci_fread_tab (id number, data clob)", + "create table test_oci_fread_1 (id number, data clob)", "declare lob1 clob := 'abc' || lpad('j',4020,'j') || 'xyz'; begin - insert into pdo_oci_fread_tab (id,data) values (1, lob1); + insert into test_oci_fread_1 (id,data) values (1, lob1); end;" ); @@ -35,7 +34,7 @@ foreach ($stmtarray as $stmt) { echo "Test 1\n"; -$s = $dbh->query("select data from pdo_oci_fread_tab where id = 1"); +$s = $dbh->query("select data from test_oci_fread_1 where id = 1"); $r = $s->fetch(); $sh = $r['data']; @@ -45,17 +44,12 @@ while (!feof($sh)) { } echo "\n"; fclose($sh); - -// Clean up - -$stmtarray = array( - "drop table pdo_oci_fread_tab" -); - -foreach ($stmtarray as $stmt) { - $dbh->exec($stmt); -} - +?> +--CLEAN-- +exec("DROP TABLE test_oci_fread_1"); ?> --EXPECT-- Test 1 diff --git a/ext/pdo_oci/tests/pdo_oci_quote1.phpt b/ext/pdo_oci/tests/pdo_oci_quote1.phpt index ea2a5468dbd5b..91a47170919f4 100644 --- a/ext/pdo_oci/tests/pdo_oci_quote1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_quote1.phpt @@ -14,9 +14,8 @@ PDOTest::skip(); require __DIR__ . '/../../pdo/tests/pdo_test.inc'; $db = PDOTest::factory(); -@$db->exec("drop table poq_tab"); -$db->query("create table poq_tab (t varchar2(100))"); -$stmt = $db->prepare('select * from poq_tab'); +$db->query("create table test_pdo_oci_quote1 (t varchar2(100))"); +$stmt = $db->prepare('select * from test_pdo_oci_quote1'); // The intent is that the fetched data be identical to the unquoted string. // Remember!: use bind variables instead of PDO->quote() @@ -29,17 +28,20 @@ foreach ($a as $u) { echo "Quoted : "; var_dump($q); - $db->exec("delete from poq_tab"); + $db->exec("delete from test_pdo_oci_quote1"); - $db->query("insert into poq_tab (t) values($q)"); + $db->query("insert into test_pdo_oci_quote1 (t) values($q)"); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); } echo "Done\n"; - -@$db->exec("drop table poq_tab"); - +?> +--CLEAN-- +exec("DROP TABLE test_pdo_oci_quote1"); ?> --EXPECT-- Unquoted : string(0) "" diff --git a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt index 204c083e36578..b7bb764dd47a1 100644 --- a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt @@ -27,11 +27,11 @@ EXCEPTION END; SQL ); - $db->exec("CREATE TABLE test(id INT)"); + $db->exec("CREATE TABLE test_pdo_oci_stmt_getcolumnmeta(id INT)"); $db->beginTransaction(); - $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); + $stmt = $db->prepare('SELECT id FROM test_pdo_oci_stmt_getcolumnmeta ORDER BY id ASC'); echo "Test 1. calling function with invalid parameters\n"; @@ -90,7 +90,7 @@ SQL echo "Test 2. testing return values\n"; echo "Test 2.1 testing array returned\n"; - $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC'); + $stmt = $db->prepare('SELECT id FROM test_pdo_oci_stmt_getcolumnmeta ORDER BY id ASC'); $stmt->execute(); $native = $stmt->getColumnMeta(0); if (count($native) == 0) { @@ -152,7 +152,7 @@ SQL $db->exec(<<prepare($sql); $stmt->execute(); - if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) { + if (!$db->exec(sprintf("INSERT INTO test_pdo_oci_stmt_getcolumnmeta(id, label) VALUES (1, '%s')", $value))) { printf("[%03d] + 1] Insert failed, %d - %s\n", $offset, $db->errorCode(), var_export($db->errorInfo(), true)); return false; } - $stmt = $db->prepare('SELECT id, label FROM test'); + $stmt = $db->prepare('SELECT id, label FROM test_pdo_oci_stmt_getcolumnmeta'); $stmt->execute(); $meta = $stmt->getColumnMeta(1); return test_return($meta, $offset, $native_type, $pdo_type); @@ -234,7 +234,7 @@ SQL $db->exec(<<prepare($sql); $stmt->execute(); - $db->exec('INSERT INTO test(id, label) VALUES (1, 1)'); - $stmt = $db->query('SELECT id, label FROM test'); + $db->exec('INSERT INTO test_pdo_oci_stmt_getcolumnmeta(id, label) VALUES (1, 1)'); + $stmt = $db->query('SELECT id, label FROM test_pdo_oci_stmt_getcolumnmeta'); $meta = $stmt->getColumnMeta(0); // verify the flags array contains a not_null flag and not nullable flags if (!isset($meta['flags'])) { @@ -302,19 +302,14 @@ SQL $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); } -$db->exec(<< +--CLEAN-- +exec("DROP TABLE test_pdo_oci_stmt_getcolumnmeta"); +?> --EXPECT-- Preparations before the test Test 1. calling function with invalid parameters diff --git a/ext/pdo_oci/tests/pdo_oci_stream_1.phpt b/ext/pdo_oci/tests/pdo_oci_stream_1.phpt index 51e4464c49414..35b2e8da66309 100644 --- a/ext/pdo_oci/tests/pdo_oci_stream_1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stream_1.phpt @@ -19,10 +19,8 @@ $dbh = PDOTest::factory(); $dbh->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Initialization -@$dbh->exec("drop table pdo_oci_stream_1_tab"); - $stmtarray = array( - "create table pdo_oci_stream_1_tab (id number, data clob)", + "create table test_pdo_oci_stream_1 (id number, data clob)", ); foreach ($stmtarray as $stmt) { @@ -33,13 +31,13 @@ $dbh->exec(" declare lob1 clob := 'abc' || lpad('j',30000,'j') || 'xyz'; begin - insert into pdo_oci_stream_1_tab (id,data) values (1, 'abcdefghijklmnopqrstuvwxyz'); - insert into pdo_oci_stream_1_tab (id,data) values (2, lob1); + insert into test_pdo_oci_stream_1 (id,data) values (1, 'abcdefghijklmnopqrstuvwxyz'); + insert into test_pdo_oci_stream_1 (id,data) values (2, lob1); end;"); echo "Test 1\n"; -$s = $dbh->prepare("select data from pdo_oci_stream_1_tab where id = 1"); +$s = $dbh->prepare("select data from test_pdo_oci_stream_1 where id = 1"); $s->execute(); $r = $s->fetch(); @@ -57,7 +55,7 @@ echo 'Read '.stream_get_contents($r['data'], 1, 0)."$\n"; // a echo "\nTest 2\n"; -$s = $dbh->prepare("select data from pdo_oci_stream_1_tab where id = 2"); +$s = $dbh->prepare("select data from test_pdo_oci_stream_1 where id = 2"); $s->execute(); $r = $s->fetch(); @@ -74,17 +72,12 @@ echo 'Read '.strlen(stream_get_contents($r['data']))."\n"; // 0 echo 'Read '.strlen(stream_get_contents($r['data'], 0))."\n"; // 0 echo 'Read '.strlen(stream_get_contents($r['data'], -1))."\n"; // 0 echo 'Read '.stream_get_contents($r['data'], -1, 30000)."\n"; // jjjxyz - -// Clean up - -$stmtarray = array( - "drop table pdo_oci_stream_1_tab" -); - -foreach ($stmtarray as $stmt) { - $dbh->exec($stmt); -} - +?> +--CLEAN-- +exec("DROP TABLE test_pdo_oci_stream_1"); ?> --EXPECT-- Test 1 diff --git a/ext/pdo_oci/tests/pdo_oci_stream_2.phpt b/ext/pdo_oci/tests/pdo_oci_stream_2.phpt index 93b71039187e9..fa5d0a432946a 100644 --- a/ext/pdo_oci/tests/pdo_oci_stream_2.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stream_2.phpt @@ -16,18 +16,14 @@ require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); $db = PDOTest::factory(); -$query = "begin execute immediate 'drop table pdo_oci_stream_2'; exception when others then if sqlcode <> -942 then raise; end if; end;"; -$stmt = $db->prepare($query); -$stmt->execute(); - -$query = "create table pdo_oci_stream_2 (id number, data1 blob, data2 blob)"; +$query = "create table test_pdo_oci_stream_2 (id number, data1 blob, data2 blob)"; $stmt = $db->prepare($query); $stmt->execute(); function do_insert($db, $id, $data1, $data2) { $db->beginTransaction(); - $stmt = $db->prepare("insert into pdo_oci_stream_2 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2"); + $stmt = $db->prepare("insert into test_pdo_oci_stream_2 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2"); $stmt->bindParam(':id', $id); $stmt->bindParam(':blob1', $blob1, PDO::PARAM_LOB); $stmt->bindParam(':blob2', $blob2, PDO::PARAM_LOB); @@ -68,9 +64,6 @@ for($i=0; $i<100; $i++) { } printf("Done\n"); -/* Cleanup is done in pdo_oci_stream_2b.phpt */ -//$db->exec("drop table pdo_oci_stream_2"); - $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams // Since each column only has one lob descriptor, the last row is @@ -80,7 +73,7 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams $i = 0; $j = 9; $a_val = ord('a'); -foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 order by id") as $row) { +foreach($db->query("select data1 as d4_1, data2 as d4_2 from test_pdo_oci_stream_2 order by id") as $row) { $a = $row['d4_1']; $a1 = $row['d4_2']; @@ -117,10 +110,12 @@ foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 or $j = 9; } echo "Fetch operation done!\n"; - -/* Cleanup */ -$db->exec("drop table pdo_oci_stream_2"); - +?> +--CLEAN-- +exec("DROP TABLE test_pdo_oci_stream_2"); ?> --EXPECT-- Inserting 1000 Records ... Done diff --git a/ext/pdo_oci/tests/pecl_bug_6364.phpt b/ext/pdo_oci/tests/pecl_bug_6364.phpt index afd3685a5b613..b6b793f22ce5a 100644 --- a/ext/pdo_oci/tests/pecl_bug_6364.phpt +++ b/ext/pdo_oci/tests/pecl_bug_6364.phpt @@ -15,13 +15,11 @@ PDOTest::skip(); require __DIR__ . '/../../pdo/tests/pdo_test.inc'; $dbh = PDOTest::factory(); -@$dbh->exec ("drop table bug_6364_t"); +$dbh->exec ("create table test6364 (c1 varchar2(10), c2 varchar2(10), c3 varchar2(10), c4 varchar2(10), c5 varchar2(10))"); -$dbh->exec ("create table bug_6364_t (c1 varchar2(10), c2 varchar2(10), c3 varchar2(10), c4 varchar2(10), c5 varchar2(10))"); +$dbh->exec ("create procedure test6364_sp(p1 IN varchar2, p2 IN varchar2, p3 IN varchar2, p4 OUT varchar2, p5 OUT varchar2) as begin insert into test6364 (c1, c2, c3) values (p1, p2, p3); p4 := 'val4'; p5 := 'val5'; end;"); -$dbh->exec ("create or replace procedure bug_6364_sp(p1 IN varchar2, p2 IN varchar2, p3 IN varchar2, p4 OUT varchar2, p5 OUT varchar2) as begin insert into bug_6364_t (c1, c2, c3) values (p1, p2, p3); p4 := 'val4'; p5 := 'val5'; end;"); - -$stmt = $dbh->prepare("call bug_6364_sp('p1','p2','p3',?,?)"); +$stmt = $dbh->prepare("call test6364_sp('p1','p2','p3',?,?)"); $out_param1 = "a"; $out_param2 = "a"; @@ -34,16 +32,18 @@ $stmt->execute() or die ("Execution error: " . var_dump($dbh->errorInfo())); var_dump($out_param1); var_dump($out_param2); -foreach ($dbh->query("select * from bug_6364_t") as $row) { +foreach ($dbh->query("select * from test6364") as $row) { var_dump($row); } print "Done\n"; - -// Cleanup -$dbh->exec ("drop procedure bug_6364_sp"); -$dbh->exec ("drop table bug_6364_t"); - +?> +--CLEAN-- +exec("DROP TABLE test6364"); +$db->exec("DROP PROCEDURE test6364_sp"); ?> --EXPECT-- string(4) "val4" diff --git a/ext/pdo_odbc/tests/CONFLICTS b/ext/pdo_odbc/tests/CONFLICTS deleted file mode 100644 index a3722b55c518a..0000000000000 --- a/ext/pdo_odbc/tests/CONFLICTS +++ /dev/null @@ -1 +0,0 @@ -odbc diff --git a/ext/pdo_odbc/tests/bug80783.phpt b/ext/pdo_odbc/tests/bug80783.phpt index 0263beee382d8..1660815f95148 100644 --- a/ext/pdo_odbc/tests/bug80783.phpt +++ b/ext/pdo_odbc/tests/bug80783.phpt @@ -27,7 +27,7 @@ var_dump($data === bin2hex($string)); exec("DROP TABLE bug80783"); +$db->exec("DROP TABLE IF EXISTS bug80783"); ?> --EXPECT-- bool(true) diff --git a/ext/pdo_odbc/tests/bug80783a.phpt b/ext/pdo_odbc/tests/bug80783a.phpt index 2418d0591bafe..ab141588e1b4e 100644 --- a/ext/pdo_odbc/tests/bug80783a.phpt +++ b/ext/pdo_odbc/tests/bug80783a.phpt @@ -33,7 +33,7 @@ var_dump($data === $string); exec("DROP TABLE bug80783a"); +$db->exec("DROP TABLE IF EXISTS bug80783a"); ?> --EXPECT-- bool(true) diff --git a/ext/pdo_odbc/tests/long_columns.phpt b/ext/pdo_odbc/tests/long_columns.phpt index d561c5b8beda4..63422c3040886 100644 --- a/ext/pdo_odbc/tests/long_columns.phpt +++ b/ext/pdo_odbc/tests/long_columns.phpt @@ -46,9 +46,9 @@ require 'ext/pdo/tests/pdo_test.inc'; $db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CLOB)')) { - if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) { - if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data varchar(4000))')) { +if (false === $db->exec('CREATE TABLE test_long_columns (id INT NOT NULL PRIMARY KEY, data CLOB)')) { + if (false === $db->exec('CREATE TABLE test_long_columns (id INT NOT NULL PRIMARY KEY, data longtext)')) { + if (false === $db->exec('CREATE TABLE test_long_columns (id INT NOT NULL PRIMARY KEY, data varchar(4000))')) { die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo())); } } @@ -74,11 +74,11 @@ function alpha_repeat($len) { // this test does - nice to be able to test using MS SQL server foreach ($sizes as $num) { $text = alpha_repeat($num); - $db->exec("INSERT INTO TEST VALUES($num, '$text')"); + $db->exec("INSERT INTO test_long_columns VALUES($num, '$text')"); } // verify data -foreach ($db->query('SELECT id, data from TEST ORDER BY LEN(data) ASC') as $row) { +foreach ($db->query('SELECT id, data from test_long_columns ORDER BY LEN(data) ASC') as $row) { $expect = alpha_repeat($row[0]); if (strcmp($expect, $row[1])) { echo "Failed on size $row[id]:\n"; @@ -92,6 +92,12 @@ foreach ($db->query('SELECT id, data from TEST ORDER BY LEN(data) ASC') as $row) echo "Finished\n"; ?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test_long_columns"); +?> --EXPECT-- Passed on size 32 Passed on size 53 diff --git a/ext/pdo_odbc/tests/max_columns.phpt b/ext/pdo_odbc/tests/max_columns.phpt index 5c4ca9b0a1901..cdcafafb3afbf 100644 --- a/ext/pdo_odbc/tests/max_columns.phpt +++ b/ext/pdo_odbc/tests/max_columns.phpt @@ -13,9 +13,9 @@ require 'ext/pdo/tests/pdo_test.inc'; $db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data varchar(max))')) { - if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) { - if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CLOB)')) { +if (false === $db->exec('CREATE TABLE test_max_columns (id INT NOT NULL PRIMARY KEY, data varchar(max))')) { + if (false === $db->exec('CREATE TABLE test_max_columns (id INT NOT NULL PRIMARY KEY, data longtext)')) { + if (false === $db->exec('CREATE TABLE test_max_columns (id INT NOT NULL PRIMARY KEY, data CLOB)')) { die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo())); } } @@ -26,14 +26,14 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sizes = array(32, 64, 128, 253, 254, 255, 256, 257, 258, 512, 1024, 2048, 3998, 3999, 4000); $db->beginTransaction(); -$insert = $db->prepare('INSERT INTO TEST VALUES (?, ?)'); +$insert = $db->prepare('INSERT INTO test_max_columns VALUES (?, ?)'); foreach ($sizes as $num) { $insert->execute(array($num, str_repeat('i', $num))); } $insert = null; $db->commit(); -foreach ($db->query('SELECT id, data from TEST') as $row) { +foreach ($db->query('SELECT id, data from test_max_columns') as $row) { $expect = str_repeat('i', $row[0]); if (strcmp($expect, $row[1])) { echo "Failed on size $row[id]:\n"; @@ -45,5 +45,11 @@ foreach ($db->query('SELECT id, data from TEST') as $row) { echo "Finished\n"; ?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test_max_columns"); +?> --EXPECT-- Finished diff --git a/ext/pdo_pgsql/tests/CONFLICTS b/ext/pdo_pgsql/tests/CONFLICTS deleted file mode 100644 index 7ecf66a952aaf..0000000000000 --- a/ext/pdo_pgsql/tests/CONFLICTS +++ /dev/null @@ -1 +0,0 @@ -pgsql diff --git a/ext/pdo_pgsql/tests/bug36727.phpt b/ext/pdo_pgsql/tests/bug36727.phpt index da95267b2147d..8ab244926c1ea 100644 --- a/ext/pdo_pgsql/tests/bug36727.phpt +++ b/ext/pdo_pgsql/tests/bug36727.phpt @@ -15,11 +15,17 @@ require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; require __DIR__ . '/config.inc'; $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); -$stmt = $db->prepare('SELECT * FROM child'); +$stmt = $db->prepare('SELECT * FROM test36727'); var_dump($stmt->bindValue(':test', 1, PDO::PARAM_INT)); echo "Done\n"; ?> +--CLEAN-- +exec("DROP TABLE IF EXIST test36727"); +?> --EXPECTF-- Warning: PDOStatement::bindValue(): SQLSTATE[HY093]: Invalid parameter number: :test in %s on line %d bool(false) diff --git a/ext/pdo_pgsql/tests/bug43925.phpt b/ext/pdo_pgsql/tests/bug43925.phpt index ab8b43513137e..442218013fbfa 100644 --- a/ext/pdo_pgsql/tests/bug43925.phpt +++ b/ext/pdo_pgsql/tests/bug43925.phpt @@ -14,10 +14,8 @@ PDOTest::skip(); require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; $dbh = PDOTest::test_factory(__DIR__ . '/common.phpt'); -@$dbh->query('DROP TABLE nodes'); - $dbh->query(' -CREATE TABLE nodes +CREATE TABLE test43925 ( id integer NOT NULL PRIMARY KEY , root integer NOT NULL @@ -25,14 +23,14 @@ CREATE TABLE nodes , rgt integer NOT NULL );'); -$dbh->query('INSERT INTO nodes (id, root, lft, rgt) VALUES (1, 1, 1, 6);'); -$dbh->query('INSERT INTO nodes (id, root, lft, rgt) VALUES (2, 1, 2, 3);'); -$dbh->query('INSERT INTO nodes (id, root, lft, rgt) VALUES (3, 1, 4, 5);'); +$dbh->query('INSERT INTO test43925 (id, root, lft, rgt) VALUES (1, 1, 1, 6);'); +$dbh->query('INSERT INTO test43925 (id, root, lft, rgt) VALUES (2, 1, 2, 3);'); +$dbh->query('INSERT INTO test43925 (id, root, lft, rgt) VALUES (3, 1, 4, 5);'); $stmt = $dbh->prepare(' SELECT * - FROM nodes + FROM test43925 WHERE (:rootId > 0 OR lft > :left OR rgt > :left) AND (root = :rootId OR root = :left) AND (1 > :left OR 1 < :left OR 1 = :left) @@ -51,9 +49,12 @@ foreach ($stmt->fetchAll() as $row) { print implode(' - ', $row); print "\n"; } - -$dbh->query('DROP TABLE nodes'); - +?> +--CLEAN-- +exec("DROP TABLE IF EXIST test43925"); ?> --EXPECT-- 1 - 1 - 1 - 1 - 1 - 1 - 6 - 6 diff --git a/ext/pdo_pgsql/tests/bug62479.phpt b/ext/pdo_pgsql/tests/bug62479.phpt index e38e308cae6af..030b15c0d3dc9 100644 --- a/ext/pdo_pgsql/tests/bug62479.phpt +++ b/ext/pdo_pgsql/tests/bug62479.phpt @@ -16,7 +16,7 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$user = 'pdo_test_'.rand(5, 400); +$user = 'pdo_test62479'; $pass = 'testpass'; // Assume that if we can't create or drop a user, this test needs to be skipped @@ -43,8 +43,7 @@ require __DIR__ . '/config.inc'; require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); -$rand = rand(5, 400); -$user = "pdo_test_$rand"; +$user = "pdo_test62479"; $template = "CREATE USER $user WITH PASSWORD '%s'"; $dropUser = "DROP USER $user"; $testQuery = 'SELECT 1 as verification'; @@ -58,7 +57,7 @@ $check = $result[0]; var_dump($check); // Remove the user -$pdo->query($dropUser); +$pdo->query("DROP USER $user"); // Create a user with a space and single quote $sql = sprintf($template, "my pass''word"); @@ -68,9 +67,12 @@ $testConn = new PDO($config['ENV']['PDOTEST_DSN'], $user, "my pass'word"); $result = $testConn->query($testQuery)->fetch(); $check = $result[0]; var_dump($check); - -// Remove the user -$pdo->query($dropUser); +?> +--CLEAN-- +exec("DROP USER pdo_test62479"); ?> --EXPECT-- int(1) diff --git a/ext/pdo_pgsql/tests/bug62498-32bit.phpt b/ext/pdo_pgsql/tests/bug62498-32bit.phpt index 53562ec34cef9..1d11155648be7 100644 --- a/ext/pdo_pgsql/tests/bug62498-32bit.phpt +++ b/ext/pdo_pgsql/tests/bug62498-32bit.phpt @@ -19,10 +19,10 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); // create the table -$db->exec("CREATE TEMPORARY TABLE bugtest_62498 (int2col INT2, int4col INT4, int8col INT8, stringcol VARCHAR(255), boolcol BOOLEAN, datecol DATE, textcol TEXT, tscol TIMESTAMP, byteacol BYTEA)"); +$db->exec("CREATE TEMPORARY TABLE test62498_32 (int2col INT2, int4col INT4, int8col INT8, stringcol VARCHAR(255), boolcol BOOLEAN, datecol DATE, textcol TEXT, tscol TIMESTAMP, byteacol BYTEA)"); // insert some data -$statement = $db->prepare("INSERT INTO bugtest_62498 (int2col, int4col, int8col, stringcol, boolcol, datecol, textcol, tscol, byteacol) VALUES (:int2val, :int4val, :int8val, :stringval, :boolval, :dateval, :textval, :tsval, :byteaval)"); +$statement = $db->prepare("INSERT INTO test62498_32 (int2col, int4col, int8col, stringcol, boolcol, datecol, textcol, tscol, byteacol) VALUES (:int2val, :int4val, :int8val, :stringval, :boolval, :dateval, :textval, :tsval, :byteaval)"); $vals = array( "int2val" => "42", "int4val" => "42", @@ -36,7 +36,7 @@ $vals = array( ); $statement->execute($vals); -$select = $db->query('SELECT int2col, int4col, int8col, stringcol, boolcol, datecol, textcol, tscol, byteacol FROM bugtest_62498'); +$select = $db->query('SELECT int2col, int4col, int8col, stringcol, boolcol, datecol, textcol, tscol, byteacol FROM test62498_32'); $meta = []; for ($i=0; $i < count($vals); $i++) { $meta[] = $select->getColumnMeta($i); @@ -45,6 +45,12 @@ var_dump($meta); ?> Done +--CLEAN-- +exec("DROP TABLE IF EXIST test62498_32"); +?> --EXPECTF-- Begin test... array(9) { @@ -55,7 +61,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498_32" ["native_type"]=> string(4) "int2" ["pdo_type"]=> @@ -74,7 +80,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498_32" ["native_type"]=> string(4) "int4" ["pdo_type"]=> @@ -93,7 +99,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498_32" ["native_type"]=> string(4) "int8" ["pdo_type"]=> @@ -112,7 +118,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498_32" ["native_type"]=> string(7) "varchar" ["pdo_type"]=> @@ -131,7 +137,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498_32" ["native_type"]=> string(4) "bool" ["pdo_type"]=> @@ -150,7 +156,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498_32" ["native_type"]=> string(4) "date" ["pdo_type"]=> @@ -169,7 +175,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498_32" ["native_type"]=> string(4) "text" ["pdo_type"]=> @@ -188,7 +194,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498_32" ["native_type"]=> string(9) "timestamp" ["pdo_type"]=> @@ -207,7 +213,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498_32" ["native_type"]=> string(5) "bytea" ["pdo_type"]=> diff --git a/ext/pdo_pgsql/tests/bug62498.phpt b/ext/pdo_pgsql/tests/bug62498.phpt index 0bc44a1b3bf81..2d60c954ddc5c 100644 --- a/ext/pdo_pgsql/tests/bug62498.phpt +++ b/ext/pdo_pgsql/tests/bug62498.phpt @@ -19,10 +19,10 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); // create the table -$db->exec("CREATE TEMPORARY TABLE bugtest_62498 (int2col INT2, int4col INT4, int8col INT8, stringcol VARCHAR(255), boolcol BOOLEAN, datecol DATE, textcol TEXT, tscol TIMESTAMP, byteacol BYTEA)"); +$db->exec("CREATE TEMPORARY TABLE test62498 (int2col INT2, int4col INT4, int8col INT8, stringcol VARCHAR(255), boolcol BOOLEAN, datecol DATE, textcol TEXT, tscol TIMESTAMP, byteacol BYTEA)"); // insert some data -$statement = $db->prepare("INSERT INTO bugtest_62498 (int2col, int4col, int8col, stringcol, boolcol, datecol, textcol, tscol, byteacol) VALUES (:int2val, :int4val, :int8val, :stringval, :boolval, :dateval, :textval, :tsval, :byteaval)"); +$statement = $db->prepare("INSERT INTO test62498 (int2col, int4col, int8col, stringcol, boolcol, datecol, textcol, tscol, byteacol) VALUES (:int2val, :int4val, :int8val, :stringval, :boolval, :dateval, :textval, :tsval, :byteaval)"); $vals = array( "int2val" => "42", "int4val" => "42", @@ -36,7 +36,7 @@ $vals = array( ); $statement->execute($vals); -$select = $db->query('SELECT int2col, int4col, int8col, stringcol, boolcol, datecol, textcol, tscol, byteacol FROM bugtest_62498'); +$select = $db->query('SELECT int2col, int4col, int8col, stringcol, boolcol, datecol, textcol, tscol, byteacol FROM test62498'); $meta = []; for ($i=0; $i < count($vals); $i++) { $meta[] = $select->getColumnMeta($i); @@ -45,6 +45,11 @@ var_dump($meta); ?> Done +--CLEAN-- +query('DROP TABLE IF EXISTS test62498'); --EXPECTF-- Begin test... array(9) { @@ -55,7 +60,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498" ["native_type"]=> string(4) "int2" ["pdo_type"]=> @@ -74,7 +79,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498" ["native_type"]=> string(4) "int4" ["pdo_type"]=> @@ -93,7 +98,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498" ["native_type"]=> string(4) "int8" ["pdo_type"]=> @@ -112,7 +117,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498" ["native_type"]=> string(7) "varchar" ["pdo_type"]=> @@ -131,7 +136,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498" ["native_type"]=> string(4) "bool" ["pdo_type"]=> @@ -150,7 +155,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498" ["native_type"]=> string(4) "date" ["pdo_type"]=> @@ -169,7 +174,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498" ["native_type"]=> string(4) "text" ["pdo_type"]=> @@ -188,7 +193,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498" ["native_type"]=> string(9) "timestamp" ["pdo_type"]=> @@ -207,7 +212,7 @@ array(9) { ["pgsql:table_oid"]=> int(%d) ["table"]=> - string(13) "bugtest_62498" + string(%s) "test62498" ["native_type"]=> string(5) "bytea" ["pdo_type"]=> diff --git a/ext/pdo_pgsql/tests/bug66584.phpt b/ext/pdo_pgsql/tests/bug66584.phpt index 1df28e037afa3..bea7c8c3df916 100644 --- a/ext/pdo_pgsql/tests/bug66584.phpt +++ b/ext/pdo_pgsql/tests/bug66584.phpt @@ -18,8 +18,8 @@ $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $pdo->beginTransaction(); -$pdo->query("CREATE TABLE b66584 (a int)"); -$pdo->query("INSERT INTO b66584 VALUES (165)"); +$pdo->query("CREATE TABLE test66584 (a int)"); +$pdo->query("INSERT INTO test66584 VALUES (165)"); for ($i = 1; $i >= 0; $i--) { $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, (bool)$i); @@ -38,7 +38,7 @@ for ($i = 1; $i >= 0; $i--) { } try { - $pdo->query("DROP TABLE b66584"); + $pdo->query("DROP TABLE test66584"); $pdo->rollback(); } catch (\Exception $e) { } @@ -47,7 +47,7 @@ function run($pdo, $data) { $bind = join(', ', array_fill(0, count($data), '?')); - $stmt = $pdo->prepare("SELECT COUNT(*) FROM b66584 WHERE a IN ({$bind})"); + $stmt = $pdo->prepare("SELECT COUNT(*) FROM test66584 WHERE a IN ({$bind})"); var_dump(count($data)); @@ -61,7 +61,7 @@ function run($pdo, $data) query("DROP TABLE IF EXISTS b66584"); +$pdo->query("DROP TABLE IF EXISTS test66584"); ?> --EXPECTF-- int(3) diff --git a/ext/pdo_pgsql/tests/bug67462.phpt b/ext/pdo_pgsql/tests/bug67462.phpt index b3e85fee96df8..03e078fe10643 100644 --- a/ext/pdo_pgsql/tests/bug67462.phpt +++ b/ext/pdo_pgsql/tests/bug67462.phpt @@ -19,8 +19,8 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $pdo->beginTransaction(); try { - $pdo->query("CREATE TABLE b67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)"); - $pdo->query("INSERT INTO b67462 VALUES (1), (1)"); + $pdo->query("CREATE TABLE test67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)"); + $pdo->query("INSERT INTO test67462 VALUES (1), (1)"); var_dump($pdo->inTransaction()); $pdo->commit(); // This should fail! @@ -34,7 +34,7 @@ try { query("DROP TABLE IF EXISTS b67462"); +$pdo->query("DROP TABLE IF EXISTS test67462"); ?> --EXPECT-- bool(true) diff --git a/ext/pdo_pgsql/tests/bug69362.phpt b/ext/pdo_pgsql/tests/bug69362.phpt index fd913221e7572..cd532b86a1aa5 100644 --- a/ext/pdo_pgsql/tests/bug69362.phpt +++ b/ext/pdo_pgsql/tests/bug69362.phpt @@ -16,7 +16,7 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$user = 'pdo_test_'.rand(5, 400); +$user = 'pdo_test69362'; $pass = 'testpass'; // Assume that if we can't create or drop a user, this test needs to be skipped @@ -43,10 +43,8 @@ require __DIR__ . '/config.inc'; require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); -$rand = rand(5, 400); -$user = "pdo_test_$rand"; +$user = "pdo_test69362"; $template = "CREATE USER $user WITH PASSWORD '%s'"; -$dropUser = "DROP USER $user"; $testQuery = 'SELECT 1 as verification'; // Create temp user with leading single quote @@ -56,10 +54,12 @@ $testConn = new PDO($config['ENV']['PDOTEST_DSN'], $user, "'mypassword"); $result = $testConn->query($testQuery)->fetch(); $check = $result[0]; var_dump($check); - -// Remove the user -$pdo->query($dropUser); - +?> +--CLEAN-- +exec("DROP USER pdo_test69362"); ?> --EXPECT-- int(1) diff --git a/ext/pdo_pgsql/tests/bug69752.phpt b/ext/pdo_pgsql/tests/bug69752.phpt index 5bf76e183683e..07e3f6accdad9 100644 --- a/ext/pdo_pgsql/tests/bug69752.phpt +++ b/ext/pdo_pgsql/tests/bug69752.phpt @@ -19,7 +19,7 @@ $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $pdo->beginTransaction(); $pdo->exec(" - create table foo ( + create table test69752 ( id bigserial not null primary key, field1 text not null, field2 text not null, @@ -27,7 +27,7 @@ $pdo->exec(" field4 int4 not null ) "); -$stmt = $pdo->prepare("insert into foo (field1, field2, field3, field4) values (:field1, :field2, :field3, :field4)"); +$stmt = $pdo->prepare("insert into test69752 (field1, field2, field3, field4) values (:field1, :field2, :field3, :field4)"); $max = 1000; $first_time_usage = null; diff --git a/ext/pdo_pgsql/tests/bug70861.phpt b/ext/pdo_pgsql/tests/bug70861.phpt index e64c97f12c1e6..73d4eea2c578d 100644 --- a/ext/pdo_pgsql/tests/bug70861.phpt +++ b/ext/pdo_pgsql/tests/bug70861.phpt @@ -21,7 +21,7 @@ try { } catch (Exception $e) { } -$db->query('CREATE TABLE test_blob_crash_70861 (id SERIAL NOT NULL, blob1 BYTEA)'); +$db->query('CREATE TABLE test70861 (id SERIAL NOT NULL, blob1 BYTEA)'); class HelloWrapper { public function stream_open() { return true; } @@ -33,22 +33,20 @@ stream_wrapper_register("hello", "HelloWrapper"); $f = fopen("hello://there", "r"); -$stmt = $db->prepare("INSERT INTO test_one_blob (blob1) VALUES (:foo)", array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL)); +$stmt = $db->prepare("INSERT INTO test70861 (blob1) VALUES (:foo)", array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL)); $stmt->bindparam(':foo', $f, PDO::PARAM_LOB); $stmt->execute(); fclose($f); -$db->exec('DROP TABLE test_blob_crash'); - ?> +++DONE+++ --CLEAN-- query('DROP TABLE IF EXISTS test_blob_crash_70861 CASCADE'); +$db->query('DROP TABLE IF EXISTS test70861 CASCADE'); ?> --EXPECTF-- %a diff --git a/ext/pdo_pgsql/tests/bug72294.phpt b/ext/pdo_pgsql/tests/bug72294.phpt index 8b55b033f61c2..02346f606c275 100644 --- a/ext/pdo_pgsql/tests/bug72294.phpt +++ b/ext/pdo_pgsql/tests/bug72294.phpt @@ -131,11 +131,11 @@ SQL { $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); - $pdo->exec( 'CREATE TEMPORARY TABLE temp_table ( test_column INT NOT NULL );' ); + $pdo->exec( 'CREATE TEMPORARY TABLE test72294 ( test_column INT NOT NULL );' ); $this->cache = new PreparedStatementCache( $pdo ); - $statement = $this->cache->prepare( $pdo, 'SELECT * FROM temp_table WHERE test_column > 0' ); + $statement = $this->cache->prepare( $pdo, 'SELECT * FROM test72294 WHERE test_column > 0' ); $statement->execute(); } } diff --git a/ext/pdo_pgsql/tests/bug72633.phpt b/ext/pdo_pgsql/tests/bug72633.phpt index 6f60577075e27..916ab9347e6d7 100644 --- a/ext/pdo_pgsql/tests/bug72633.phpt +++ b/ext/pdo_pgsql/tests/bug72633.phpt @@ -18,9 +18,9 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); -$db->query('CREATE TABLE test_last_id_72633 (id SERIAL NOT NULL, field1 VARCHAR(10))'); +$db->query('CREATE TABLE test72633 (id SERIAL NOT NULL, field1 VARCHAR(10))'); -$stmt = $db->prepare("INSERT INTO test_last_id_72633 (field1) VALUES ('test')"); +$stmt = $db->prepare("INSERT INTO test72633 (field1) VALUES ('test')"); $stmt->execute(); @@ -31,14 +31,14 @@ var_dump($db->lastInsertId()); /** * Sequence name informed */ -var_dump($db->lastInsertId('test_last_id_72633_id_seq')); +var_dump($db->lastInsertId('test72633_id_seq')); ?> --CLEAN-- query('DROP TABLE IF EXISTS test_last_id_72633'); +$db->query('DROP TABLE IF EXISTS test72633'); ?> --EXPECTREGEX-- string\([0-9]*\)\ \"[0-9]*\" From 0e789bb50ab3459c1b71b2e3e7899dd9d0f4eb0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 12 Oct 2023 09:47:08 +0200 Subject: [PATCH 02/14] Address review comments --- ext/pdo/tests/bug_34630.phpt | 2 +- ext/pdo/tests/bug_35671.phpt | 2 +- ext/pdo/tests/bug_36428.phpt | 2 +- ext/pdo/tests/bug_36798.phpt | 4 ++-- ext/pdo/tests/bug_38253.phpt | 2 +- ext/pdo/tests/bug_38394.phpt | 2 +- ext/pdo/tests/bug_39398.phpt | 2 +- ext/pdo/tests/bug_39656.phpt | 2 +- ext/pdo/tests/bug_40285.phpt | 2 +- ext/pdo/tests/bug_42917.phpt | 2 +- ext/pdo/tests/bug_43130.phpt | 2 +- ext/pdo/tests/bug_44173.phpt | 2 +- ext/pdo/tests/bug_44409.phpt | 2 +- ext/pdo/tests/bug_50458.phpt | 2 +- ext/pdo/tests/bug_52098.phpt | 2 +- ext/pdo/tests/bug_64172.phpt | 2 +- ext/pdo/tests/bug_65946.phpt | 8 +++---- ext/pdo/tests/bug_71447.phpt | 2 +- ext/pdo/tests/bug_71885.phpt | 2 +- ext/pdo/tests/bug_73234.phpt | 2 +- ext/pdo/tests/gh8626.phpt | 3 +-- ext/pdo/tests/pdo_001.phpt | 2 +- ext/pdo/tests/pdo_002.phpt | 6 ++--- ext/pdo/tests/pdo_003.phpt | 6 ++--- ext/pdo/tests/pdo_004.phpt | 6 ++--- ext/pdo/tests/pdo_005.phpt | 8 +++---- ext/pdo/tests/pdo_006.phpt | 6 ++--- ext/pdo/tests/pdo_007.phpt | 6 ++--- ext/pdo/tests/pdo_008.phpt | 6 ++--- ext/pdo/tests/pdo_009.phpt | 13 ++++------- ext/pdo/tests/pdo_010.phpt | 13 ++++------- ext/pdo/tests/pdo_011.phpt | 7 ++---- ext/pdo/tests/pdo_012.phpt | 5 ++--- ext/pdo/tests/pdo_013.phpt | 5 ++--- ext/pdo/tests/pdo_014.phpt | 5 ++--- ext/pdo/tests/pdo_015.phpt | 5 ++--- ext/pdo/tests/pdo_016.phpt | 6 ++--- ext/pdo/tests/pdo_016a.phpt | 6 ++--- ext/pdo/tests/pdo_017.phpt | 6 ++--- ext/pdo/tests/pdo_018.phpt | 16 ++++++-------- ext/pdo/tests/pdo_019.phpt | 7 ++---- ext/pdo/tests/pdo_020.phpt | 6 ++--- ext/pdo/tests/pdo_021.phpt | 2 +- ext/pdo/tests/pdo_022.phpt | 2 +- ext/pdo/tests/pdo_023.phpt | 5 ++--- ext/pdo/tests/pdo_024.phpt | 6 ++--- ext/pdo/tests/pdo_025.phpt | 2 +- ext/pdo/tests/pdo_026.phpt | 2 +- ext/pdo/tests/pdo_027.phpt | 5 ++--- ext/pdo/tests/pdo_028.phpt | 2 +- ext/pdo/tests/pdo_029.phpt | 2 +- ext/pdo/tests/pdo_030.phpt | 2 +- ext/pdo/tests/pdo_031.phpt | 2 +- ext/pdo/tests/pdo_032.phpt | 6 ++--- ext/pdo/tests/pdo_033.phpt | 2 +- ext/pdo/tests/pdo_034.phpt | 2 +- ext/pdo/tests/pdo_test.inc | 22 +++++++++++++++++++ ext/pdo/tests/pecl_bug_5217.phpt | 2 +- ext/pdo/tests/pecl_bug_5772.phpt | 2 +- ext/pdo/tests/pecl_bug_5809.phpt | 2 +- ext/pdo_dblib/tests/bug_47588.phpt | 4 +--- ext/pdo_firebird/tests/bug_48877.phpt | 4 +--- ext/pdo_firebird/tests/bug_64037.phpt | 4 +--- ext/pdo_firebird/tests/bug_74462.phpt | 4 +--- ext/pdo_firebird/tests/rowCount.phpt | 4 +--- ext/pdo_oci/tests/bug46274.phpt | 2 +- ext/pdo_oci/tests/bug46274_2.phpt | 2 +- ext/pdo_oci/tests/bug54379.phpt | 10 ++++----- ext/pdo_oci/tests/bug57702.phpt | 2 +- ext/pdo_oci/tests/bug60994.phpt | 2 +- .../tests/pdo_oci_attr_autocommit_1.phpt | 2 +- .../tests/pdo_oci_attr_autocommit_2.phpt | 2 +- .../tests/pdo_oci_attr_autocommit_3.phpt | 2 +- ext/pdo_oci/tests/pdo_oci_fread_1.phpt | 2 +- ext/pdo_oci/tests/pdo_oci_quote1.phpt | 2 +- .../tests/pdo_oci_stmt_getcolumnmeta.phpt | 14 ++---------- ext/pdo_oci/tests/pdo_oci_stream_1.phpt | 2 +- ext/pdo_oci/tests/pdo_oci_stream_2.phpt | 2 +- ext/pdo_oci/tests/pecl_bug_6364.phpt | 2 +- ext/pdo_pgsql/tests/bug43925.phpt | 4 +--- ext/pdo_pgsql/tests/bug62479.phpt | 1 - ext/pdo_pgsql/tests/bug_33876.phpt | 3 +-- ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt | 3 +-- .../tests/pdo_sqlite_createaggregate.phpt | 3 +-- .../tests/pdo_sqlite_createcollation.phpt | 4 +--- .../tests/pdo_sqlite_createfunction.phpt | 3 +-- .../pdo_sqlite_createfunction_with_flags.phpt | 3 +-- .../tests/pdo_sqlite_lastinsertid.phpt | 3 +-- 88 files changed, 151 insertions(+), 211 deletions(-) diff --git a/ext/pdo/tests/bug_34630.phpt b/ext/pdo/tests/bug_34630.phpt index 052aebea64fb2..18e11a53e5ac8 100644 --- a/ext/pdo/tests/bug_34630.phpt +++ b/ext/pdo/tests/bug_34630.phpt @@ -50,7 +50,7 @@ var_dump($db->query("SELECT * from test34630")->fetchAll(PDO::FETCH_ASSOC)); exec("DROP TABLE test34630"); +PDOTest::dropTableIfExists($db, "test34630"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_35671.phpt b/ext/pdo/tests/bug_35671.phpt index 025073e80fccd..47543ec9ab9fa 100644 --- a/ext/pdo/tests/bug_35671.phpt +++ b/ext/pdo/tests/bug_35671.phpt @@ -36,7 +36,7 @@ var_dump($db->query("SELECT * from test35671")->fetchAll(PDO::FETCH_ASSOC)); exec("DROP TABLE test35671"); +PDOTest::dropTableIfExists($db, "test35671"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_36428.phpt b/ext/pdo/tests/bug_36428.phpt index 6f3d25ac35e17..af05eb09464b4 100644 --- a/ext/pdo/tests/bug_36428.phpt +++ b/ext/pdo/tests/bug_36428.phpt @@ -26,7 +26,7 @@ var_dump($res->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'SimpleXMLElemen exec("DROP TABLE test36428"); +PDOTest::dropTableIfExists($db, "test36428"); ?> --EXPECTF-- array(1) { diff --git a/ext/pdo/tests/bug_36798.phpt b/ext/pdo/tests/bug_36798.phpt index d7d982bcf1c53..5161b6234389e 100644 --- a/ext/pdo/tests/bug_36798.phpt +++ b/ext/pdo/tests/bug_36798.phpt @@ -29,7 +29,7 @@ $db = PDOTest::factory(); $db->exec("CREATE TABLE test36798 (id INTEGER)"); $db->exec("INSERT INTO test36798 (id) VALUES (1)"); -$stmt = $db->prepare("SELECT '๏ฟฝ' as test FROM test36798 WHERE id = :id"); +$stmt = $db->prepare("SELECT 'รƒ' as test FROM test36798 WHERE id = :id"); $stmt->execute(array(":id" => 1)); $row = $stmt->fetch(PDO::FETCH_NUM); @@ -40,7 +40,7 @@ var_dump( $row ); exec("DROP TABLE test36798"); +PDOTest::dropTableIfExists($db, "test36798"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_38253.phpt b/ext/pdo/tests/bug_38253.phpt index 8a6ec89a8070e..642b999848a6e 100644 --- a/ext/pdo/tests/bug_38253.phpt +++ b/ext/pdo/tests/bug_38253.phpt @@ -33,7 +33,7 @@ var_dump($stmt->fetchAll()); exec("DROP TABLE test38253"); +PDOTest::dropTableIfExists($db, "test38253"); ?> --EXPECTF-- Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: No fetch class specified in %s on line %d diff --git a/ext/pdo/tests/bug_38394.phpt b/ext/pdo/tests/bug_38394.phpt index d545cc24b2c5e..a76f13238f4ad 100644 --- a/ext/pdo/tests/bug_38394.phpt +++ b/ext/pdo/tests/bug_38394.phpt @@ -31,7 +31,7 @@ var_dump($db->query("SELECT * FROM test38394")->fetchAll(PDO::FETCH_ASSOC)); exec("DROP TABLE test38394"); +PDOTest::dropTableIfExists($db, "test38394"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo/tests/bug_39398.phpt b/ext/pdo/tests/bug_39398.phpt index 91f490db64354..b2aa686cc70c8 100644 --- a/ext/pdo/tests/bug_39398.phpt +++ b/ext/pdo/tests/bug_39398.phpt @@ -28,7 +28,7 @@ var_dump($db->query("SELECT * FROM test39398")->fetchAll(PDO::FETCH_ASSOC)); exec("DROP TABLE test39398"); +PDOTest::dropTableIfExists($db, "test39398"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_39656.phpt b/ext/pdo/tests/bug_39656.phpt index e0aa11c700e94..fd7ba22da03bb 100644 --- a/ext/pdo/tests/bug_39656.phpt +++ b/ext/pdo/tests/bug_39656.phpt @@ -38,7 +38,7 @@ echo "Done\n"; exec("DROP TABLE test39656"); +PDOTest::dropTableIfExists($db, "test39656"); ?> --EXPECT-- array(4) { diff --git a/ext/pdo/tests/bug_40285.phpt b/ext/pdo/tests/bug_40285.phpt index d8bd72f22a629..cd796c8a91318 100644 --- a/ext/pdo/tests/bug_40285.phpt +++ b/ext/pdo/tests/bug_40285.phpt @@ -28,7 +28,7 @@ echo "Done\n"; exec("DROP TABLE test40285"); +PDOTest::dropTableIfExists($db, "test40285"); ?> --EXPECT-- Done diff --git a/ext/pdo/tests/bug_42917.phpt b/ext/pdo/tests/bug_42917.phpt index e2350cc21e646..a1d7534ba5abc 100644 --- a/ext/pdo/tests/bug_42917.phpt +++ b/ext/pdo/tests/bug_42917.phpt @@ -30,7 +30,7 @@ var_dump($res->fetchAll()); exec("DROP TABLE test42917"); +PDOTest::dropTableIfExists($db, "test42917"); ?> --EXPECT-- array(5) { diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt index b483b0448303c..72f66ceaa2345 100644 --- a/ext/pdo/tests/bug_43130.phpt +++ b/ext/pdo/tests/bug_43130.phpt @@ -39,7 +39,7 @@ var_dump($stmt->fetch(PDO::FETCH_COLUMN)); exec("DROP TABLE test43130"); +PDOTest::dropTableIfExists($db, "test43130"); ?> --EXPECTF-- Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in %s on line %d diff --git a/ext/pdo/tests/bug_44173.phpt b/ext/pdo/tests/bug_44173.phpt index a8856f7005f0e..ea11ea0ad200a 100644 --- a/ext/pdo/tests/bug_44173.phpt +++ b/ext/pdo/tests/bug_44173.phpt @@ -76,7 +76,7 @@ try { exec("DROP TABLE test44173"); +PDOTest::dropTableIfExists($db, "test44173"); ?> --EXPECT-- PDO::query() expects exactly 2 arguments for the fetch mode provided, 4 given diff --git a/ext/pdo/tests/bug_44409.phpt b/ext/pdo/tests/bug_44409.phpt index cdb08cb589551..71914508e3d36 100644 --- a/ext/pdo/tests/bug_44409.phpt +++ b/ext/pdo/tests/bug_44409.phpt @@ -45,7 +45,7 @@ print_r($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, "bug44409")); exec("DROP TABLE test44409"); +PDOTest::dropTableIfExists($db, "test44409"); ?> --EXPECTF-- Deprecated: %s implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d diff --git a/ext/pdo/tests/bug_50458.phpt b/ext/pdo/tests/bug_50458.phpt index ea67b71f1bc0c..5ddc1bfd54cc7 100644 --- a/ext/pdo/tests/bug_50458.phpt +++ b/ext/pdo/tests/bug_50458.phpt @@ -25,7 +25,7 @@ var_dump($res->fetchAll(PDO::FETCH_FUNC, function($a) { return strtoupper($a); } exec("DROP TABLE test50458"); +PDOTest::dropTableIfExists($db, "test50458"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_52098.phpt b/ext/pdo/tests/bug_52098.phpt index 17bbf847774d0..cf376aaea57e9 100644 --- a/ext/pdo/tests/bug_52098.phpt +++ b/ext/pdo/tests/bug_52098.phpt @@ -53,7 +53,7 @@ echo $obj->lucky(); exec("DROP TABLE test52098"); +PDOTest::dropTableIfExists($db, "test52098"); ?> --EXPECT-- Calling object method 'foo' diff --git a/ext/pdo/tests/bug_64172.phpt b/ext/pdo/tests/bug_64172.phpt index 17d66eb9c4a15..5bee82b9c5c5b 100644 --- a/ext/pdo/tests/bug_64172.phpt +++ b/ext/pdo/tests/bug_64172.phpt @@ -47,7 +47,7 @@ var_dump($db->errorInfo()); exec("DROP TABLE test64172"); +PDOTest::dropTableIfExists($db, "test64172"); ?> --EXPECTF-- ===FAIL=== diff --git a/ext/pdo/tests/bug_65946.phpt b/ext/pdo/tests/bug_65946.phpt index 79a1f7158be4f..ef7d7b27ebfdb 100644 --- a/ext/pdo/tests/bug_65946.phpt +++ b/ext/pdo/tests/bug_65946.phpt @@ -19,13 +19,13 @@ $db->exec('CREATE TABLE test65946(id int)'); $db->exec('INSERT INTO test65946 VALUES(1)'); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': - $sql = 'SELECT TOP :limit * FROM test'; + $sql = 'SELECT TOP :limit * FROM test65946'; break; case 'odbc': - $sql = 'SELECT TOP (:limit) * FROM test'; + $sql = 'SELECT TOP (:limit) * FROM test65946'; break; case 'firebird': - $sql = 'SELECT FIRST :limit * FROM test'; + $sql = 'SELECT FIRST :limit * FROM test65946'; break; case 'oci': //$sql = 'SELECT * FROM test65946 FETCH FIRST :limit ROWS ONLY'; // Oracle 12c syntax @@ -45,7 +45,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); exec("DROP TABLE test65946"); +PDOTest::dropTableIfExists($db, "test65946"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/bug_71447.phpt b/ext/pdo/tests/bug_71447.phpt index e23374d9b3f7f..f34107edd195e 100644 --- a/ext/pdo/tests/bug_71447.phpt +++ b/ext/pdo/tests/bug_71447.phpt @@ -99,7 +99,7 @@ var_dump($stmt->fetchColumn()); exec("DROP TABLE test71447"); +PDOTest::dropTableIfExists($db, "test71447"); ?> --EXPECT-- string(10) ""abc":8000" diff --git a/ext/pdo/tests/bug_71885.phpt b/ext/pdo/tests/bug_71885.phpt index d13457768310b..7eab7313b4c44 100644 --- a/ext/pdo/tests/bug_71885.phpt +++ b/ext/pdo/tests/bug_71885.phpt @@ -52,7 +52,7 @@ try { exec("DROP TABLE test71885"); +PDOTest::dropTableIfExists($db, "test71885"); ?> --EXPECT-- bool(true) diff --git a/ext/pdo/tests/bug_73234.phpt b/ext/pdo/tests/bug_73234.phpt index 5ccd4c52e9ae4..f291df704bbcc 100644 --- a/ext/pdo/tests/bug_73234.phpt +++ b/ext/pdo/tests/bug_73234.phpt @@ -48,7 +48,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); exec("DROP TABLE test73234"); +PDOTest::dropTableIfExists($db, "test73234"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo/tests/gh8626.phpt b/ext/pdo/tests/gh8626.phpt index 0a7d7712f9f76..4c087afb82ee4 100644 --- a/ext/pdo/tests/gh8626.phpt +++ b/ext/pdo/tests/gh8626.phpt @@ -21,7 +21,6 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -$db->exec('DROP TABLE test8626'); $db->exec('CREATE TABLE test8626 (x int NOT NULL)'); $stmt = $db->prepare('INSERT INTO test8626 VALUES(?)'); @@ -43,7 +42,7 @@ var_dump(array_slice($errorInfo, 0, 3)); // odbc, dblib exec("DROP TABLE test8626"); +PDOTest::dropTableIfExists($db, "test8626"); ?> --EXPECTF-- bool(false) diff --git a/ext/pdo/tests/pdo_001.phpt b/ext/pdo/tests/pdo_001.phpt index a751ac562a747..a5cd3e4ff0cc1 100644 --- a/ext/pdo/tests/pdo_001.phpt +++ b/ext/pdo/tests/pdo_001.phpt @@ -29,7 +29,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); exec("DROP TABLE test001"); +PDOTest::dropTableIfExists($db, "test001"); ?> --EXPECT-- array(3) { diff --git a/ext/pdo/tests/pdo_002.phpt b/ext/pdo/tests/pdo_002.phpt index 9f6666b943c62..ec7bab32c6cb0 100644 --- a/ext/pdo/tests/pdo_002.phpt +++ b/ext/pdo/tests/pdo_002.phpt @@ -16,9 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test002(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test002 VALUES(1, 'A')"); -$db->exec("INSERT INTO test002 VALUES(2, 'B')"); -$db->exec("INSERT INTO test002 VALUES(3, 'C')"); +$db->exec("INSERT INTO test002 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); $stmt = $db->prepare('SELECT * from test002'); $stmt->execute(); @@ -29,7 +27,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_NUM)); exec("DROP TABLE test002"); +PDOTest::dropTableIfExists($db, "test002"); ?> --EXPECT-- array(3) { diff --git a/ext/pdo/tests/pdo_003.phpt b/ext/pdo/tests/pdo_003.phpt index 4810b89ed7f25..03db39816ddb8 100644 --- a/ext/pdo/tests/pdo_003.phpt +++ b/ext/pdo/tests/pdo_003.phpt @@ -16,9 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test003(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test003 VALUES(1, 'A')"); -$db->exec("INSERT INTO test003 VALUES(2, 'B')"); -$db->exec("INSERT INTO test003 VALUES(3, 'C')"); +$db->exec("INSERT INTO test003 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); $stmt = $db->prepare('SELECT * from test003'); $stmt->execute(); @@ -29,7 +27,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_BOTH)); exec("DROP TABLE test003"); +PDOTest::dropTableIfExists($db, "test003"); ?> --EXPECT-- array(3) { diff --git a/ext/pdo/tests/pdo_004.phpt b/ext/pdo/tests/pdo_004.phpt index e10542b9174b1..0d9e1d96e2dbd 100644 --- a/ext/pdo/tests/pdo_004.phpt +++ b/ext/pdo/tests/pdo_004.phpt @@ -16,9 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test004(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test004 VALUES(1, 'A')"); -$db->exec("INSERT INTO test004 VALUES(2, 'B')"); -$db->exec("INSERT INTO test004 VALUES(3, 'C')"); +$db->exec("INSERT INTO test004 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); $stmt = $db->prepare('SELECT * from test004'); $stmt->execute(); @@ -29,7 +27,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_OBJ)); exec("DROP TABLE test004"); +PDOTest::dropTableIfExists($db, "test004"); ?> --EXPECTF-- array(3) { diff --git a/ext/pdo/tests/pdo_005.phpt b/ext/pdo/tests/pdo_005.phpt index 44957d1f3fcab..0c781fad0ffd8 100644 --- a/ext/pdo/tests/pdo_005.phpt +++ b/ext/pdo/tests/pdo_005.phpt @@ -16,11 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test005(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(10))'); -$db->exec("INSERT INTO test005 VALUES(1, 'A', 'AA')"); -$db->exec("INSERT INTO test005 VALUES(2, 'B', 'BB')"); -$db->exec("INSERT INTO test005 VALUES(3, 'C', 'CC')"); +$db->exec("INSERT INTO test005 VALUES(1, 'A', 'AA'), (2, 'B', 'BB'), (3, 'C', 'CC')"); -$stmt = $db->prepare('SELECT id, val, val2 from test'); +$stmt = $db->prepare('SELECT id, val, val2 from test005'); class TestBase { @@ -55,7 +53,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_CLASS, 'TestDerived', array(0))); exec("DROP TABLE test005"); +PDOTest::dropTableIfExists($db, "test005"); ?> --EXPECTF-- array(3) { diff --git a/ext/pdo/tests/pdo_006.phpt b/ext/pdo/tests/pdo_006.phpt index 7e0d931a7b66b..e943a2837f800 100644 --- a/ext/pdo/tests/pdo_006.phpt +++ b/ext/pdo/tests/pdo_006.phpt @@ -16,9 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test006(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test006 VALUES(1, 'A')"); -$db->exec("INSERT INTO test006 VALUES(2, 'A')"); -$db->exec("INSERT INTO test006 VALUES(3, 'C')"); +$db->exec("INSERT INTO test006 VALUES(1, 'A'), (2, 'A'), (3, 'C')"); $stmt = $db->prepare('SELECT val, id from test006'); @@ -33,7 +31,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC|PDO::FETCH_GROUP)); exec("DROP TABLE test006"); +PDOTest::dropTableIfExists($db, "test006"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo/tests/pdo_007.phpt b/ext/pdo/tests/pdo_007.phpt index 6ec0980185976..136d2f7a78456 100644 --- a/ext/pdo/tests/pdo_007.phpt +++ b/ext/pdo/tests/pdo_007.phpt @@ -16,9 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test007(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test007 VALUES('A', 'A')"); -$db->exec("INSERT INTO test007 VALUES('B', 'A')"); -$db->exec("INSERT INTO test007 VALUES('C', 'C')"); +$db->exec("INSERT INTO test007 VALUES('A', 'A'), ('B', 'A'), ('C', 'C')"); $stmt = $db->prepare('SELECT id, val from test007'); @@ -33,7 +31,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC|PDO::FETCH_UNIQUE)); exec("DROP TABLE test007"); +PDOTest::dropTableIfExists($db, "test007"); ?> --EXPECT-- array(3) { diff --git a/ext/pdo/tests/pdo_008.phpt b/ext/pdo/tests/pdo_008.phpt index ef1a0838ae476..a1498f24f2917 100644 --- a/ext/pdo/tests/pdo_008.phpt +++ b/ext/pdo/tests/pdo_008.phpt @@ -16,9 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test008(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test008 VALUES('A', 'A')"); -$db->exec("INSERT INTO test008 VALUES('B', 'A')"); -$db->exec("INSERT INTO test008 VALUES('C', 'C')"); +$db->exec("INSERT INTO test008 VALUES('A', 'A'), ('B', 'A'), ('C', 'C')"); $stmt = $db->prepare('SELECT val, id from test008'); @@ -30,7 +28,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_UNIQUE)); exec("DROP TABLE test008"); +PDOTest::dropTableIfExists($db, "test008"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo/tests/pdo_009.phpt b/ext/pdo/tests/pdo_009.phpt index 8c2de1368d989..22b67250ea4fa 100644 --- a/ext/pdo/tests/pdo_009.phpt +++ b/ext/pdo/tests/pdo_009.phpt @@ -16,14 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE classtypes009(id int NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)'); -$db->exec('INSERT INTO classtypes009 VALUES(0, \'stdClass\')'); -$db->exec('INSERT INTO classtypes009 VALUES(1, \'Test1\')'); -$db->exec('INSERT INTO classtypes009 VALUES(2, \'Test2\')'); +$db->exec("INSERT INTO classtypes009 VALUES(0, 'stdClass'), (1, 'Test1'), (2, 'Test2')"); $db->exec('CREATE TABLE test009(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10))'); -$db->exec('INSERT INTO test009 VALUES(1, 0, \'A\')'); -$db->exec('INSERT INTO test009 VALUES(2, 1, \'B\')'); -$db->exec('INSERT INTO test009 VALUES(3, 2, \'C\')'); -$db->exec('INSERT INTO test009 VALUES(4, 3, \'D\')'); +$db->exec("INSERT INTO test009 VALUES(1, 0, 'A'), (2, 1, 'B'), (3, 2, 'C'), (4, 3, 'D')"); $stmt = $db->prepare('SELECT classtypes.name, test.id AS id, test.val AS val FROM test009 LEFT JOIN classtypes009 ON test.classtype=classtypes.id'); @@ -71,8 +66,8 @@ var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE, 'Test3')); exec("DROP TABLE test009"); -$db->exec("DROP TABLE classtypes009"); +PDOTest::dropTableIfExists($db, "test009"); +PDOTest::dropTableIfExists($db, "classtypes009"); ?> --EXPECTF-- array(4) { diff --git a/ext/pdo/tests/pdo_010.phpt b/ext/pdo/tests/pdo_010.phpt index cbb2d537e3302..8953104b595c4 100644 --- a/ext/pdo/tests/pdo_010.phpt +++ b/ext/pdo/tests/pdo_010.phpt @@ -16,14 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE classtypes010(id int NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)'); -$db->exec('INSERT INTO classtypes010 VALUES(0, \'stdClass\')'); -$db->exec('INSERT INTO classtypes010 VALUES(1, \'Test1\')'); -$db->exec('INSERT INTO classtypes010 VALUES(2, \'Test2\')'); +$db->exec("INSERT INTO classtypes010 VALUES(0, 'stdClass'), (1, 'Test1'), (2, 'Test2')); $db->exec('CREATE TABLE test010(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test010 VALUES(1, 0, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test010 VALUES(2, 1, \'B\', \'Group1\')'); -$db->exec('INSERT INTO test010 VALUES(3, 2, \'C\', \'Group2\')'); -$db->exec('INSERT INTO test010 VALUES(4, 3, \'D\', \'Group2\')'); +$db->exec("INSERT INTO test010 VALUES(1, 0, 'A', 'Group1'), (2, 1, 'B', 'Group1'), (3, 2, 'C', 'Group2'), (4, 3, 'D', 'Group2')"); $stmt = $db->prepare('SELECT classtypes.name, test.grp AS grp, test.id AS id, test.val AS val FROM test010 LEFT JOIN classtypes010 ON test.classtype=classtypes.id'); @@ -72,8 +67,8 @@ var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_UNIQUE exec("DROP TABLE test010"); -$db->exec("DROP TABLE classtypes010"); +PDOTest::dropTableIfExists($db, "test010"); +PDOTest::dropTableIfExists($db, "classtypes010"); ?> --EXPECTF-- Test1::__construct() diff --git a/ext/pdo/tests/pdo_011.phpt b/ext/pdo/tests/pdo_011.phpt index bd6a1be2f29dc..225a0f268dce9 100644 --- a/ext/pdo/tests/pdo_011.phpt +++ b/ext/pdo/tests/pdo_011.phpt @@ -16,10 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test011(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test011 VALUES(1, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test011 VALUES(2, \'B\', \'Group1\')'); -$db->exec('INSERT INTO test011 VALUES(3, \'C\', \'Group2\')'); -$db->exec('INSERT INTO test011 VALUES(4, \'D\', \'Group2\')'); +$db->exec("INSERT INTO test011 VALUES(1, 'A', 'Group1'), (2, 'B', 'Group1'), (3, 'C', 'Group2'), (4, 'D', 'Group2')"); class DerivedStatement extends PDOStatement { @@ -85,7 +82,7 @@ var_dump($derived->fetchAll(PDO::FETCH_FUNC, array($derived, 'RETRIEVE'))); exec("DROP TABLE test011"); +PDOTest::dropTableIfExists($db, "test011"); ?> --EXPECTF-- DerivedStatement::__construct(Overloaded) diff --git a/ext/pdo/tests/pdo_012.phpt b/ext/pdo/tests/pdo_012.phpt index b5b810d53154b..7b0473fdbacb3 100644 --- a/ext/pdo/tests/pdo_012.phpt +++ b/ext/pdo/tests/pdo_012.phpt @@ -16,8 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test012(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test012 VALUES(1, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test012 VALUES(2, \'B\', \'Group2\')'); +$db->exec("INSERT INTO test012 VALUES(1, 'A', 'Group1'), (2, 'B', 'Group2')"); $SELECT = 'SELECT val, grp FROM test012'; @@ -51,7 +50,7 @@ var_dump($stmt->fetchAll()); exec("DROP TABLE test012"); +PDOTest::dropTableIfExists($db, "test012"); ?> --EXPECTF-- array(2) { diff --git a/ext/pdo/tests/pdo_013.phpt b/ext/pdo/tests/pdo_013.phpt index 45785987cb247..9af1749d3118a 100644 --- a/ext/pdo/tests/pdo_013.phpt +++ b/ext/pdo/tests/pdo_013.phpt @@ -16,8 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test013(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test013 VALUES(1, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test013 VALUES(2, \'B\', \'Group2\')'); +$db->exec("INSERT INTO test013 VALUES(1, 'A', 'Group1'), (2, 'B', 'Group2')"); $SELECT = 'SELECT val, grp FROM test013'; @@ -61,7 +60,7 @@ foreach($stmt as $data) exec("DROP TABLE test013"); +PDOTest::dropTableIfExists($db, "test013"); ?> --EXPECTF-- array(2) { diff --git a/ext/pdo/tests/pdo_014.phpt b/ext/pdo/tests/pdo_014.phpt index cf6c1e37c01e1..f467e835fee5f 100644 --- a/ext/pdo/tests/pdo_014.phpt +++ b/ext/pdo/tests/pdo_014.phpt @@ -16,8 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test014(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec('INSERT INTO test014 VALUES(1, \'A\', \'Group1\')'); -$db->exec('INSERT INTO test014 VALUES(2, \'B\', \'Group2\')'); +$db->exec("INSERT INTO test014 VALUES(1, 'A', 'Group1'), (2, 'B', 'Group2')"); $SELECT = 'SELECT val, grp FROM test014'; class Test @@ -75,7 +74,7 @@ foreach($stmt as $data) exec("DROP TABLE test014"); +PDOTest::dropTableIfExists($db, "test014"); ?> --EXPECTF-- Test::__construct(WOW) diff --git a/ext/pdo/tests/pdo_015.phpt b/ext/pdo/tests/pdo_015.phpt index 02c673871bf58..8aa5e9f22e259 100644 --- a/ext/pdo/tests/pdo_015.phpt +++ b/ext/pdo/tests/pdo_015.phpt @@ -16,8 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test015(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(20))'); -$db->exec('INSERT INTO test015 VALUES(1, \'A\', \'A2\')'); -$db->exec('INSERT INTO test015 VALUES(2, \'A\', \'B2\')'); +$db->exec("INSERT INTO test015 VALUES(1, 'A', 'A2'), (2, 'A', 'B2')"); $select1 = $db->prepare('SELECT id, val, val2 FROM test015'); $select2 = $db->prepare('SELECT val, val2 FROM test015'); @@ -45,7 +44,7 @@ var_dump($select2->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP)); exec("DROP TABLE test015"); +PDOTest::dropTableIfExists($db, "test015"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo/tests/pdo_016.phpt b/ext/pdo/tests/pdo_016.phpt index 3afd3caf7de74..dd902bbe1be44 100644 --- a/ext/pdo/tests/pdo_016.phpt +++ b/ext/pdo/tests/pdo_016.phpt @@ -21,9 +21,7 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { } $db->exec('CREATE TABLE test016(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$db->exec('INSERT INTO test016 VALUES(0, \'String0\')'); -$db->exec('INSERT INTO test016 VALUES(1, \'String1\')'); -$db->exec('INSERT INTO test016 VALUES(2, \'String2\')'); +$db->exec("INSERT INTO test016 VALUES(0, 'String0'), (1, 'String1'), (2, 'String2')"); $stmt1 = $db->prepare('SELECT COUNT(idx) FROM test016'); $stmt2 = $db->prepare('SELECT idx, txt FROM test016 ORDER by idx'); @@ -112,7 +110,7 @@ while($stmt2->fetch(PDO::FETCH_BOUND)) exec("DROP TABLE test016"); +PDOTest::dropTableIfExists($db, "test016"); ?> --EXPECT-- string(1) "3" diff --git a/ext/pdo/tests/pdo_016a.phpt b/ext/pdo/tests/pdo_016a.phpt index fcdbdf548df7b..52db2850b27f7 100644 --- a/ext/pdo/tests/pdo_016a.phpt +++ b/ext/pdo/tests/pdo_016a.phpt @@ -21,9 +21,7 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { } $db->exec('CREATE TABLE test016a(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$db->exec('INSERT INTO test016a VALUES(0, \'String0\')'); -$db->exec('INSERT INTO test016a VALUES(1, \'String1\')'); -$db->exec('INSERT INTO test016a VALUES(2, \'String2\')'); +$db->exec("INSERT INTO test016a VALUES(0, 'String0'), (1, 'String1'), (2, 'String2')"); $stmt1 = $db->prepare('SELECT COUNT(idx) FROM test016a'); $stmt2 = $db->prepare('SELECT idx, txt FROM test016a ORDER by idx'); @@ -112,7 +110,7 @@ while($stmt2->fetch(PDO::FETCH_BOUND)) exec("DROP TABLE test016a"); +PDOTest::dropTableIfExists($db, "test016a"); ?> --EXPECT-- string(1) "3" diff --git a/ext/pdo/tests/pdo_017.phpt b/ext/pdo/tests/pdo_017.phpt index 8a27e3f16a09c..17decb42c9704 100644 --- a/ext/pdo/tests/pdo_017.phpt +++ b/ext/pdo/tests/pdo_017.phpt @@ -37,9 +37,7 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { } $db->exec('CREATE TABLE test017(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'.$suf); -$db->exec("INSERT INTO test017 VALUES(1, 'A')"); -$db->exec("INSERT INTO test017 VALUES(2, 'B')"); -$db->exec("INSERT INTO test017 VALUES(3, 'C')"); +$db->exec("INSERT INTO test017 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); $delete = $db->prepare('DELETE FROM test017'); function countRows($action) { @@ -71,7 +69,7 @@ echo countRows('commit'); exec("DROP TABLE test017"); +PDOTest::dropTableIfExists($db, "test017"); ?> --EXPECT-- Counted 3 rows after insert. diff --git a/ext/pdo/tests/pdo_018.phpt b/ext/pdo/tests/pdo_018.phpt index 6ae537185e8a1..7ff9828d48551 100644 --- a/ext/pdo/tests/pdo_018.phpt +++ b/ext/pdo/tests/pdo_018.phpt @@ -68,9 +68,7 @@ class TestLeaf extends TestDerived } $db->exec('CREATE TABLE classtypes018(id int NOT NULL PRIMARY KEY, name VARCHAR(20) NOT NULL UNIQUE)'); -$db->exec('INSERT INTO classtypes018 VALUES(0, \'stdClass\')'); -$db->exec('INSERT INTO classtypes018 VALUES(1, \'TestBase\')'); -$db->exec('INSERT INTO classtypes018 VALUES(2, \'TestDerived\')'); +$db->exec("INSERT INTO classtypes018 VALUES(0, 'stdClass'), (1, 'TestBase'), (2, 'TestDerived')"); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': @@ -138,7 +136,7 @@ foreach($objs as $idx => $obj) unset($stmt); echo "===DATA===\n"; -$res = $db->query('SELECT test.val FROM test018')->fetchAll(PDO::FETCH_COLUMN); +$res = $db->query('SELECT test018.val FROM test018')->fetchAll(PDO::FETCH_COLUMN); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': @@ -160,7 +158,7 @@ var_dump($res); echo "===FAILURE===\n"; try { - $db->query('SELECT classtypes.name AS name, test.val AS val FROM test018 LEFT JOIN classtypes ON test.classtype=classtypes.id')->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf', array()); + $db->query('SELECT classtypes018.name AS name, test018.val AS val FROM test018 LEFT JOIN classtypes018 ON test018.classtype=classtypes018.id')->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf', array()); } catch (PDOException $e) { @@ -169,10 +167,10 @@ catch (PDOException $e) } echo "===COUNT===\n"; -var_dump($db->query('SELECT COUNT(*) FROM test018 LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)')->fetchColumn()); +var_dump($db->query('SELECT COUNT(*) FROM test018 LEFT JOIN classtypes018 ON test018.classtype=classtypes018.id WHERE (classtypes018.id IS NULL OR classtypes018.id > 0)')->fetchColumn()); echo "===DATABASE===\n"; -$stmt = $db->prepare('SELECT classtypes.name AS name, test.val AS val FROM test018 LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)'); +$stmt = $db->prepare('SELECT classtypes018.name AS name, test018.val AS val FROM test018 LEFT JOIN classtypes018 ON test018.classtype=classtypes018.id WHERE (classtypes018.id IS NULL OR classtypes018.id > 0)'); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); @@ -187,8 +185,8 @@ var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIAL exec("DROP TABLE test018"); -$db->exec("DROP TABLE classtypes018"); +PDOTest::dropTableIfExists($db, "test018"); +PDOTest::dropTableIfExists($db, "classtypes018"); ?> --EXPECTF-- Deprecated: %s implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d diff --git a/ext/pdo/tests/pdo_019.phpt b/ext/pdo/tests/pdo_019.phpt index bbc76ceb74577..1ec8054f2a93e 100644 --- a/ext/pdo/tests/pdo_019.phpt +++ b/ext/pdo/tests/pdo_019.phpt @@ -16,10 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test019(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$db->exec('INSERT INTO test019 VALUES(0, \'String0\')'); -$db->exec('INSERT INTO test019 VALUES(1, \'String1\')'); -$db->exec('INSERT INTO test019 VALUES(2, \'String2\')'); -$db->exec('INSERT INTO test019 VALUES(3, \'String3\')'); +$db->exec("INSERT INTO test019 VALUES(0, 'String0'), (1, 'String1'), (2, 'String2'), (3, 'String3')"); var_dump($db->query('SELECT COUNT(*) FROM test019')->fetchColumn()); @@ -45,7 +42,7 @@ while($stmt->fetch(PDO::FETCH_BOUND)) { exec("DROP TABLE test019"); +PDOTest::dropTableIfExists($db, "test019"); ?> --EXPECT-- string(1) "4" diff --git a/ext/pdo/tests/pdo_020.phpt b/ext/pdo/tests/pdo_020.phpt index e569f3aa10e53..d6aec12b97334 100644 --- a/ext/pdo/tests/pdo_020.phpt +++ b/ext/pdo/tests/pdo_020.phpt @@ -16,9 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test020(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -$db->exec("INSERT INTO test020 VALUES(1, 'A', 'A')"); -$db->exec("INSERT INTO test020 VALUES(2, 'B', 'B')"); -$db->exec("INSERT INTO test020 VALUES(3, 'C', 'C')"); +$db->exec("INSERT INTO test020 VALUES(1, 'A', 'A'), (2, 'B', 'B'), (3, 'C', 'C')"); foreach (array('SELECT id, val FROM test020', 'SELECT id, val, val2 FROM test020', 'SELECT COUNT(*) FROM test020') as $sql) { @@ -33,7 +31,7 @@ foreach (array('SELECT id, val FROM test020', 'SELECT id, val, val2 FROM test020 exec("DROP TABLE test020"); +PDOTest::dropTableIfExists($db, "test020"); ?> --EXPECT-- Counted 2 columns after SELECT id, val FROM test020. diff --git a/ext/pdo/tests/pdo_021.phpt b/ext/pdo/tests/pdo_021.phpt index 7f81ddbbf2935..494ad3c39c50f 100644 --- a/ext/pdo/tests/pdo_021.phpt +++ b/ext/pdo/tests/pdo_021.phpt @@ -59,7 +59,7 @@ echo 'There are ' . $num . " rows in the table.\n"; exec("DROP TABLE test021"); +PDOTest::dropTableIfExists($db, "test021"); ?> --EXPECT-- There are 6 rows in the table. diff --git a/ext/pdo/tests/pdo_022.phpt b/ext/pdo/tests/pdo_022.phpt index 28a5a7f824c68..a45dd8e2938e0 100644 --- a/ext/pdo/tests/pdo_022.phpt +++ b/ext/pdo/tests/pdo_022.phpt @@ -62,7 +62,7 @@ var_dump($meta); exec("DROP TABLE test022"); +PDOTest::dropTableIfExists($db, "test022"); ?> --EXPECT-- The unexpected! diff --git a/ext/pdo/tests/pdo_023.phpt b/ext/pdo/tests/pdo_023.phpt index e511ecdd2fad4..32cd497d1c8cd 100644 --- a/ext/pdo/tests/pdo_023.phpt +++ b/ext/pdo/tests/pdo_023.phpt @@ -64,8 +64,7 @@ $db->test(); var_dump($db); $db->query('CREATE TABLE test023(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->query('INSERT INTO test023 VALUES(0, \'A\')'); -$db->query('INSERT INTO test023 VALUES(1, \'B\')'); +$db->query("INSERT INTO test023 VALUES(0, 'A'), (1, 'B')"); $stmt = $db->query('SELECT val, id FROM test023'); @@ -81,7 +80,7 @@ $db = NULL; exec("DROP TABLE test023"); +PDOTest::dropTableIfExists($db, "test023"); ?> --EXPECTF-- int(1) diff --git a/ext/pdo/tests/pdo_024.phpt b/ext/pdo/tests/pdo_024.phpt index ab94be9080e54..53c95e49d6886 100644 --- a/ext/pdo/tests/pdo_024.phpt +++ b/ext/pdo/tests/pdo_024.phpt @@ -19,10 +19,10 @@ switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': // environment settings can influence how the table is created if specifics are missing // https://msdn.microsoft.com/en-us/library/ms174979.aspx#Nullability Rules Within a Table Definition - $sql = 'create test024 (id int, name varchar(10) null)'; + $sql = 'create table test024 (id int, name varchar(10) null)'; break; default: - $sql = 'create test024 (id int, name varchar(10))'; + $sql = 'create table test024 (id int, name varchar(10))'; break; } $db->exec($sql); @@ -44,7 +44,7 @@ var_dump($db->query('select name from test024 where id=0')->fetchColumn()); exec("DROP TABLE test024"); +PDOTest::dropTableIfExists($db, "test024"); ?> --EXPECT-- bind: success diff --git a/ext/pdo/tests/pdo_025.phpt b/ext/pdo/tests/pdo_025.phpt index b81ed4b48f5c5..aa0adac878440 100644 --- a/ext/pdo/tests/pdo_025.phpt +++ b/ext/pdo/tests/pdo_025.phpt @@ -64,7 +64,7 @@ foreach($stmt as $obj) { exec("DROP TABLE test025"); +PDOTest::dropTableIfExists($db, "test025"); ?> --EXPECTF-- object(Test)#%d (3) { diff --git a/ext/pdo/tests/pdo_026.phpt b/ext/pdo/tests/pdo_026.phpt index 093ae8653c839..66374e26ae6b3 100644 --- a/ext/pdo/tests/pdo_026.phpt +++ b/ext/pdo/tests/pdo_026.phpt @@ -80,7 +80,7 @@ echo "===DONE===\n"; exec("DROP TABLE test026"); +PDOTest::dropTableIfExists($db, "test026"); ?> --EXPECT-- string(11) "PDODatabase" diff --git a/ext/pdo/tests/pdo_027.phpt b/ext/pdo/tests/pdo_027.phpt index 03b03493b1bb2..808e905dc64b3 100644 --- a/ext/pdo/tests/pdo_027.phpt +++ b/ext/pdo/tests/pdo_027.phpt @@ -16,8 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('create table test027 (id int, name varchar(10))'); -$db->exec("INSERT INTO test027 (id,name) VALUES(1,'test1')"); -$db->exec("INSERT INTO test027 (id,name) VALUES(2,'test2')"); +$db->exec("INSERT INTO test027 (id,name) VALUES(1,'test1'), (2,'test2')"); foreach ($db->query("SELECT * FROM test027", PDO::FETCH_LAZY) as $v) { echo "lazy: " . $v->id.$v->name."\n"; @@ -28,7 +27,7 @@ echo "End\n"; exec("DROP TABLE test027"); +PDOTest::dropTableIfExists($db, "test027"); ?> --EXPECT-- lazy: 1test1 diff --git a/ext/pdo/tests/pdo_028.phpt b/ext/pdo/tests/pdo_028.phpt index 228caf7e663b2..6a2dae28db897 100644 --- a/ext/pdo/tests/pdo_028.phpt +++ b/ext/pdo/tests/pdo_028.phpt @@ -34,7 +34,7 @@ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); exec("DROP TABLE test028"); +PDOTest::dropTableIfExists($db, "test028"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo/tests/pdo_029.phpt b/ext/pdo/tests/pdo_029.phpt index ac62bc207a448..205150b65d80d 100644 --- a/ext/pdo/tests/pdo_029.phpt +++ b/ext/pdo/tests/pdo_029.phpt @@ -91,7 +91,7 @@ exit(0); exec("DROP TABLE test029"); +PDOTest::dropTableIfExists($db, "test029"); ?> --EXPECT-- string(11) "PDODatabase" diff --git a/ext/pdo/tests/pdo_030.phpt b/ext/pdo/tests/pdo_030.phpt index 9162062206200..88308c18ca839 100644 --- a/ext/pdo/tests/pdo_030.phpt +++ b/ext/pdo/tests/pdo_030.phpt @@ -92,7 +92,7 @@ exit(0); exec("DROP TABLE test030"); +PDOTest::dropTableIfExists($db, "test030"); ?> --EXPECTF-- string(11) "PDODatabase" diff --git a/ext/pdo/tests/pdo_031.phpt b/ext/pdo/tests/pdo_031.phpt index bea0f6d506ee0..2d1155b5e71ef 100644 --- a/ext/pdo/tests/pdo_031.phpt +++ b/ext/pdo/tests/pdo_031.phpt @@ -47,7 +47,7 @@ exit(0); exec("DROP TABLE test031"); +PDOTest::dropTableIfExists($db, "test031"); ?> --EXPECT-- ===QUERY=== diff --git a/ext/pdo/tests/pdo_032.phpt b/ext/pdo/tests/pdo_032.phpt index 8cae63598fc20..a0633d5305481 100644 --- a/ext/pdo/tests/pdo_032.phpt +++ b/ext/pdo/tests/pdo_032.phpt @@ -16,9 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test032(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test032 VALUES(1, 'A')"); -$db->exec("INSERT INTO test032 VALUES(2, 'B')"); -$db->exec("INSERT INTO test032 VALUES(3, 'C')"); +$db->exec("INSERT INTO test032 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); // Lower case columns $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); @@ -39,7 +37,7 @@ $stmt->closeCursor(); exec("DROP TABLE test032"); +PDOTest::dropTableIfExists($db, "test032"); ?> --EXPECT-- array(3) { diff --git a/ext/pdo/tests/pdo_033.phpt b/ext/pdo/tests/pdo_033.phpt index 621d5cd0e56e5..f85a4fd4f6a8e 100644 --- a/ext/pdo/tests/pdo_033.phpt +++ b/ext/pdo/tests/pdo_033.phpt @@ -34,7 +34,7 @@ print_r($stmt->fetchAll(PDO::FETCH_ASSOC)); exec("DROP TABLE test033"); +PDOTest::dropTableIfExists($db, "test033"); ?> --EXPECT-- Array diff --git a/ext/pdo/tests/pdo_034.phpt b/ext/pdo/tests/pdo_034.phpt index fd727ed6ef4a3..89b691e6cfc3f 100644 --- a/ext/pdo/tests/pdo_034.phpt +++ b/ext/pdo/tests/pdo_034.phpt @@ -31,7 +31,7 @@ var_dump($db->query("SELECT a,a FROM test034")->fetchAll(PDO::FETCH_KEY_PAIR)); exec("DROP TABLE test034"); +PDOTest::dropTableIfExists($db, "test034"); ?> --EXPECTF-- array(1) { diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc index b8509e9282f06..7093be01b41e3 100644 --- a/ext/pdo/tests/pdo_test.inc +++ b/ext/pdo/tests/pdo_test.inc @@ -69,5 +69,27 @@ class PDOTest { return $config; } + + public static function dropTableIfExists(PDO $db, string $tableName): void { + if (getenv('PDOTEST_DSN') === "sqlite::memory:") { + return; + } + + if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) === "oci") { + $db->exec(<<exec("DROP TABLE IF EXISTS $tableName"); + } + } } ?> diff --git a/ext/pdo/tests/pecl_bug_5217.phpt b/ext/pdo/tests/pecl_bug_5217.phpt index 87f096ecc00af..26e8b806ff29d 100644 --- a/ext/pdo/tests/pecl_bug_5217.phpt +++ b/ext/pdo/tests/pecl_bug_5217.phpt @@ -29,7 +29,7 @@ echo "PHP Didn't crash!\n"; exec("DROP TABLE test5217"); +PDOTest::dropTableIfExists($db, "test5217"); ?> --EXPECT-- Safely caught Serialization of 'PDO' is not allowed diff --git a/ext/pdo/tests/pecl_bug_5772.phpt b/ext/pdo/tests/pecl_bug_5772.phpt index d039c7f7a2439..f1e73043b2bde 100644 --- a/ext/pdo/tests/pecl_bug_5772.phpt +++ b/ext/pdo/tests/pecl_bug_5772.phpt @@ -30,7 +30,7 @@ foreach ($db->query("SELECT * FROM test5772")->fetchAll(PDO::FETCH_FUNC, 'heLLO' exec("DROP TABLE test5772"); +PDOTest::dropTableIfExists($db, "test5772"); ?> --EXPECT-- string(1) "1" diff --git a/ext/pdo/tests/pecl_bug_5809.phpt b/ext/pdo/tests/pecl_bug_5809.phpt index a8e59fec9fdc6..d26f963b1603a 100644 --- a/ext/pdo/tests/pecl_bug_5809.phpt +++ b/ext/pdo/tests/pecl_bug_5809.phpt @@ -28,7 +28,7 @@ var_dump($values); exec("DROP TABLE test5809"); +PDOTest::dropTableIfExists($db, "test5809"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo_dblib/tests/bug_47588.phpt b/ext/pdo_dblib/tests/bug_47588.phpt index a0671e5846dd8..e4d46c23f3e34 100644 --- a/ext/pdo_dblib/tests/bug_47588.phpt +++ b/ext/pdo_dblib/tests/bug_47588.phpt @@ -11,9 +11,7 @@ require __DIR__ . '/config.inc'; require __DIR__ . '/config.inc'; $db->query('CREATE TABLE "Test Table47588" ("My Field" int, "Another Field" varchar(32) not null default \'test_string\')'); -$db->query('INSERT INTO "Test Table47588" ("My Field") values(1)'); -$db->query('INSERT INTO "Test Table47588" ("My Field") values(2)'); -$db->query('INSERT INTO "Test Table47588" ("My Field") values(3)'); +$db->query('INSERT INTO "Test Table47588" ("My Field") values(1), (2), (3)'); $rs = $db->query('SELECT * FROM "Test Table47588"'); var_dump($rs->fetchAll(PDO::FETCH_ASSOC)); echo "Done.\n"; diff --git a/ext/pdo_firebird/tests/bug_48877.phpt b/ext/pdo_firebird/tests/bug_48877.phpt index d8c9cfe04bbdc..3c2203cd8c6d4 100644 --- a/ext/pdo_firebird/tests/bug_48877.phpt +++ b/ext/pdo_firebird/tests/bug_48877.phpt @@ -14,9 +14,7 @@ require("testdb.inc"); $value = '2'; $dbh->exec('CREATE TABLE test48877 (A integer)'); -$dbh->exec("INSERT INTO test48877 VALUES ('1')"); -$dbh->exec("INSERT INTO test48877 VALUES ('2')"); -$dbh->exec("INSERT INTO test48877 VALUES ('3')"); +$dbh->exec("INSERT INTO test48877 VALUES ('1'), ('2'), ('3')"); $dbh->commit(); $query = "SELECT * FROM test48877 WHERE A = :paramno"; diff --git a/ext/pdo_firebird/tests/bug_64037.phpt b/ext/pdo_firebird/tests/bug_64037.phpt index 8f772f993afae..eb6f8ee2f221b 100644 --- a/ext/pdo_firebird/tests/bug_64037.phpt +++ b/ext/pdo_firebird/tests/bug_64037.phpt @@ -13,9 +13,7 @@ require("testdb.inc"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $dbh->exec("CREATE TABLE test64037 (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15, 2))"); -$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (1, 'test', -1.0)"); -$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (2, 'test', -0.99)"); -$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (3, 'test', -1.01)"); +$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (1, 'test', -1.0), (2, 'test', -0.99), (3, 'test', -1.01)"); $dbh->commit(); diff --git a/ext/pdo_firebird/tests/bug_74462.phpt b/ext/pdo_firebird/tests/bug_74462.phpt index 630c658fb2c4a..3adf8ee3079d6 100644 --- a/ext/pdo_firebird/tests/bug_74462.phpt +++ b/ext/pdo_firebird/tests/bug_74462.phpt @@ -11,9 +11,7 @@ LSAN_OPTIONS=detect_leaks=0 require 'testdb.inc'; $dbh->exec('recreate table test74462 (id integer not null, abool boolean)'); -$dbh->exec('insert into test74462 (id, abool) values (1, true)'); -$dbh->exec('insert into test74462 (id, abool) values (2, false)'); -$dbh->exec('insert into test74462 (id, abool) values (3, null)'); +$dbh->exec('insert into test74462 (id, abool) values (1, true), (2, false), (3, null)'); $S = $dbh->query('select abool from test74462 order by id'); $D = $S->fetchAll(PDO::FETCH_COLUMN); unset($S); diff --git a/ext/pdo_firebird/tests/rowCount.phpt b/ext/pdo_firebird/tests/rowCount.phpt index 86090a3b3cae4..07c8b835718cf 100644 --- a/ext/pdo_firebird/tests/rowCount.phpt +++ b/ext/pdo_firebird/tests/rowCount.phpt @@ -12,9 +12,7 @@ LSAN_OPTIONS=detect_leaks=0 require("testdb.inc"); $dbh->exec('CREATE TABLE test_rowcount (A VARCHAR(10))'); -$dbh->exec("INSERT INTO test_rowcount VALUES ('A')"); -$dbh->exec("INSERT INTO test_rowcount VALUES ('A')"); -$dbh->exec("INSERT INTO test_rowcount VALUES ('B')"); +$dbh->exec("INSERT INTO test_rowcount VALUES ('A'), ('A'), ('B')"); $dbh->commit(); $query = "SELECT * FROM test_rowcount WHERE A = ?"; diff --git a/ext/pdo_oci/tests/bug46274.phpt b/ext/pdo_oci/tests/bug46274.phpt index 5c6269e2c8175..db32de195ab5b 100644 --- a/ext/pdo_oci/tests/bug46274.phpt +++ b/ext/pdo_oci/tests/bug46274.phpt @@ -53,7 +53,7 @@ var_dump($res->fetch()); exec("DROP TABLE test46274"); +PDOTest::dropTableIfExists($db, "test46274"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo_oci/tests/bug46274_2.phpt b/ext/pdo_oci/tests/bug46274_2.phpt index 88149308d61c3..070df29a0a8ff 100644 --- a/ext/pdo_oci/tests/bug46274_2.phpt +++ b/ext/pdo_oci/tests/bug46274_2.phpt @@ -58,7 +58,7 @@ fclose($row[0]); exec("DROP TABLE test46274_2"); +PDOTest::dropTableIfExists($db, "test46274_2"); ?> --EXPECTF-- array(2) { diff --git a/ext/pdo_oci/tests/bug54379.phpt b/ext/pdo_oci/tests/bug54379.phpt index 9c91c82f9095c..8d393a4727abd 100644 --- a/ext/pdo_oci/tests/bug54379.phpt +++ b/ext/pdo_oci/tests/bug54379.phpt @@ -16,19 +16,17 @@ require 'ext/pdo/tests/pdo_test.inc'; $db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$db->exec("CREATE TABLE test (col1 NVARCHAR2(20))"); -$db->exec("INSERT INTO test VALUES('12345678901234567890')"); -$db->exec("INSERT INTO test VALUES('ใ‚ใ„ใ†ใˆใŠใ‹ใใใ‘ใ“ใ•ใ—ใ™ใ›ใใŸใกใคใฆใจ')"); -$stmt = $db->prepare("SELECT * FROM test"); +$db->exec("CREATE TABLE test54379 (col1 NVARCHAR2(20))"); +$db->exec("INSERT INTO test54379 VALUES('12345678901234567890'), ('ใ‚ใ„ใ†ใˆใŠใ‹ใใใ‘ใ“ใ•ใ—ใ™ใ›ใใŸใกใคใฆใจ')"); +$stmt = $db->prepare("SELECT * FROM test54379"); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); -$db->exec("DROP TABLE test"); ?> --CLEAN-- exec("DROP TABLE test54379"); +PDOTest::dropTableIfExists($db, "test54379"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo_oci/tests/bug57702.phpt b/ext/pdo_oci/tests/bug57702.phpt index e58e1e71727bc..f972bdca7d450 100644 --- a/ext/pdo_oci/tests/bug57702.phpt +++ b/ext/pdo_oci/tests/bug57702.phpt @@ -143,7 +143,7 @@ print "done\n"; exec("DROP TABLE test57702"); +PDOTest::dropTableIfExists($db, "test57702"); ?> --EXPECT-- First Query diff --git a/ext/pdo_oci/tests/bug60994.phpt b/ext/pdo_oci/tests/bug60994.phpt index a22d4aced6e42..14ebae69d621f 100644 --- a/ext/pdo_oci/tests/bug60994.phpt +++ b/ext/pdo_oci/tests/bug60994.phpt @@ -112,7 +112,7 @@ if ($string4 != $stream4 || $stream4 != stream_get_contents($row['DATA2'])) { exec("DROP TABLE pdo_oci_bug60994"); +PDOTest::dropTableIfExists($db, "pdo_oci_bug60994"); ?> --EXPECT-- Test 1: j diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt index 3b127af5f7eca..8aca1c95a8c11 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt @@ -56,7 +56,7 @@ echo "Done\n"; exec("DROP TABLE test_pdo_oci_attr_autocommit_1"); +PDOTest::dropTableIfExists($db, "test_pdo_oci_attr_autocommit_1"); ?> --EXPECT-- PDO::ATTR_AUTOCOMMIT: Default: bool(true) diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt index dce701a35fc9d..468fa61326adb 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt @@ -105,7 +105,7 @@ echo "Done\n"; exec("DROP TABLE test_pdo_oci_attr_autocommit_2"); +PDOTest::dropTableIfExists($db, test_pdo_oci_attr_autocommit_2"); ?> --EXPECTF-- Test 1 Check beginTransaction insertion diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt index b0bcd628556e6..52629f54b3b5c 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt @@ -45,7 +45,7 @@ echo "Done\n"; exec("DROP TABLE test_pdo_oci_attr_autocommit_3"); +PDOTest::dropTableIfExists($db, "test_pdo_oci_attr_autocommit_3"); ?> --EXPECT-- PDO::ATTR_AUTOCOMMIT: bool(false) diff --git a/ext/pdo_oci/tests/pdo_oci_fread_1.phpt b/ext/pdo_oci/tests/pdo_oci_fread_1.phpt index 4f50ad775f392..112ba994abe1f 100644 --- a/ext/pdo_oci/tests/pdo_oci_fread_1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_fread_1.phpt @@ -49,7 +49,7 @@ fclose($sh); exec("DROP TABLE test_oci_fread_1"); +PDOTest::dropTableIfExists($db, test_oci_fread_1"); ?> --EXPECT-- Test 1 diff --git a/ext/pdo_oci/tests/pdo_oci_quote1.phpt b/ext/pdo_oci/tests/pdo_oci_quote1.phpt index 91a47170919f4..5a43576768788 100644 --- a/ext/pdo_oci/tests/pdo_oci_quote1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_quote1.phpt @@ -41,7 +41,7 @@ echo "Done\n"; exec("DROP TABLE test_pdo_oci_quote1"); +PDOTest::dropTableIfExists($db, "test_pdo_oci_quote1"); ?> --EXPECT-- Unquoted : string(0) "" diff --git a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt index b7bb764dd47a1..043b6e0ad8212 100644 --- a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt @@ -16,17 +16,7 @@ echo "Preparations before the test\n"; require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); try { $db = PDOTest::factory(); - $db->exec(<<exec("CREATE TABLE test_pdo_oci_stmt_getcolumnmeta(id INT)"); $db->beginTransaction(); @@ -308,7 +298,7 @@ print "done!"; exec("DROP TABLE test_pdo_oci_stmt_getcolumnmeta"); +PDOTest::dropTableIfExists($db, "test_pdo_oci_stmt_getcolumnmeta"); ?> --EXPECT-- Preparations before the test diff --git a/ext/pdo_oci/tests/pdo_oci_stream_1.phpt b/ext/pdo_oci/tests/pdo_oci_stream_1.phpt index 35b2e8da66309..b414e5024f602 100644 --- a/ext/pdo_oci/tests/pdo_oci_stream_1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stream_1.phpt @@ -77,7 +77,7 @@ echo 'Read '.stream_get_contents($r['data'], -1, 30000)."\n"; // jjjxyz exec("DROP TABLE test_pdo_oci_stream_1"); +PDOTest::dropTableIfExists($db, test_pdo_oci_stream_1"); ?> --EXPECT-- Test 1 diff --git a/ext/pdo_oci/tests/pdo_oci_stream_2.phpt b/ext/pdo_oci/tests/pdo_oci_stream_2.phpt index fa5d0a432946a..a610ea692d380 100644 --- a/ext/pdo_oci/tests/pdo_oci_stream_2.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stream_2.phpt @@ -115,7 +115,7 @@ echo "Fetch operation done!\n"; exec("DROP TABLE test_pdo_oci_stream_2"); +PDOTest::dropTableIfExists($db, "test_pdo_oci_stream_2"); ?> --EXPECT-- Inserting 1000 Records ... Done diff --git a/ext/pdo_oci/tests/pecl_bug_6364.phpt b/ext/pdo_oci/tests/pecl_bug_6364.phpt index b6b793f22ce5a..9c5e031e9f870 100644 --- a/ext/pdo_oci/tests/pecl_bug_6364.phpt +++ b/ext/pdo_oci/tests/pecl_bug_6364.phpt @@ -42,7 +42,7 @@ print "Done\n"; exec("DROP TABLE test6364"); +PDOTest::dropTableIfExists($db, "test6364"); $db->exec("DROP PROCEDURE test6364_sp"); ?> --EXPECT-- diff --git a/ext/pdo_pgsql/tests/bug43925.phpt b/ext/pdo_pgsql/tests/bug43925.phpt index 442218013fbfa..2141d8b52ebf4 100644 --- a/ext/pdo_pgsql/tests/bug43925.phpt +++ b/ext/pdo_pgsql/tests/bug43925.phpt @@ -23,9 +23,7 @@ CREATE TABLE test43925 , rgt integer NOT NULL );'); -$dbh->query('INSERT INTO test43925 (id, root, lft, rgt) VALUES (1, 1, 1, 6);'); -$dbh->query('INSERT INTO test43925 (id, root, lft, rgt) VALUES (2, 1, 2, 3);'); -$dbh->query('INSERT INTO test43925 (id, root, lft, rgt) VALUES (3, 1, 4, 5);'); +$dbh->query('INSERT INTO test43925 (id, root, lft, rgt) VALUES (1, 1, 1, 6), (2, 1, 2, 3), (3, 1, 4, 5);'); $stmt = $dbh->prepare(' diff --git a/ext/pdo_pgsql/tests/bug62479.phpt b/ext/pdo_pgsql/tests/bug62479.phpt index 030b15c0d3dc9..851fb8123b3f4 100644 --- a/ext/pdo_pgsql/tests/bug62479.phpt +++ b/ext/pdo_pgsql/tests/bug62479.phpt @@ -45,7 +45,6 @@ $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $user = "pdo_test62479"; $template = "CREATE USER $user WITH PASSWORD '%s'"; -$dropUser = "DROP USER $user"; $testQuery = 'SELECT 1 as verification'; // Create temp user with space in password diff --git a/ext/pdo_pgsql/tests/bug_33876.phpt b/ext/pdo_pgsql/tests/bug_33876.phpt index 6b062f6ceb167..1f11dc847a53f 100644 --- a/ext/pdo_pgsql/tests/bug_33876.phpt +++ b/ext/pdo_pgsql/tests/bug_33876.phpt @@ -17,8 +17,7 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); $db->exec("SET LC_MESSAGES='C'"); $db->exec('CREATE TABLE b33876 (foo varchar(5) NOT NULL, bar bool NOT NULL)'); -$db->exec("INSERT INTO b33876 VALUES('false','f')"); -$db->exec("INSERT INTO b33876 VALUES('true', 't')"); +$db->exec("INSERT INTO b33876 VALUES('false','f'), ('true', 't')"); $res = $db->prepare('SELECT foo from b33876 where bar = ?'); diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt index e3373df8ac3b4..3ae9113173acd 100644 --- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt +++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt @@ -9,8 +9,7 @@ $db = new PDO('sqlite::memory:'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $db->exec('CREATE TABLE test_fetch_func_001 (id INTEGER , name VARCHAR)'); -$db->exec('INSERT INTO test_fetch_func_001 VALUES(1, "php")'); -$db->exec('INSERT INTO test_fetch_func_001 VALUES(2, "")'); +$db->exec('INSERT INTO test_fetch_func_001 VALUES(1, "php"), (2, "")'); $st = $db->query('SELECT * FROM test_fetch_func_001'); $st->fetchAll(PDO::FETCH_FUNC, function($x, $y) use ($st) { var_dump($st); print "data: $x, $y\n"; }); diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt index 35450b127c112..98240b5943fb1 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt @@ -9,8 +9,7 @@ $db = new PDO('sqlite::memory:'); $db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)'); -$db->query('INSERT INTO foobar VALUES (NULL, "PHP")'); -$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")'); +$db->query('INSERT INTO foobar VALUES (NULL, "PHP"), (NULL, "PHP6")'); $db->sqliteCreateAggregate('testing', function(&$a, $b) { $a .= $b; return $a; }, function(&$v) { return $v; }); diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt index 75c951b4d58f6..bf1cac2a49bd0 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt @@ -10,9 +10,7 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)'); -$db->query('INSERT INTO foobar VALUES (NULL, "1")'); -$db->query('INSERT INTO foobar VALUES (NULL, "2")'); -$db->query('INSERT INTO foobar VALUES (NULL, "10")'); +$db->query('INSERT INTO foobar VALUES (NULL, "1"), (NULL, "2"), (NULL, "10")'); $db->sqliteCreateCollation('MYCOLLATE', function($a, $b) { return strnatcmp($a, $b); }); diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt index 7769df3ab1c52..9ea8edc8ad7fb 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt @@ -9,8 +9,7 @@ $db = new PDO('sqlite::memory:'); $db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)'); -$db->query('INSERT INTO foobar VALUES (NULL, "PHP")'); -$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")'); +$db->query('INSERT INTO foobar VALUES (NULL, "PHP"), (NULL, "PHP6")'); $db->sqliteCreateFunction('testing', function($v) { return strtolower($v); }); diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt index 55bb8450a345f..bc3def2bf68bb 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt @@ -13,8 +13,7 @@ $db = new PDO('sqlite::memory:'); $db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)'); -$db->query('INSERT INTO foobar VALUES (NULL, "PHP")'); -$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")'); +$db->query('INSERT INTO foobar VALUES (NULL, "PHP"), (NULL, "PHP6")'); $db->sqliteCreateFunction('testing', function($v) { return strtolower($v); }, 1, PDO::SQLITE_DETERMINISTIC); diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt index 035a80a959e0f..2237e36722d14 100644 --- a/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt +++ b/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt @@ -7,8 +7,7 @@ pdo_sqlite $db = new PDO('sqlite::memory:'); $db->query('CREATE TABLE IF NOT EXISTS foo (id INT AUTO INCREMENT, name TEXT)'); -$db->query('INSERT INTO foo VALUES (NULL, "PHP")'); -$db->query('INSERT INTO foo VALUES (NULL, "PHP6")'); +$db->query('INSERT INTO foo VALUES (NULL, "PHP"), (NULL, "PHP6")'); var_dump($db->query('SELECT * FROM foo')); var_dump($db->errorInfo()); var_dump($db->lastInsertId()); From dcfa0c8fd7878b1e4fe5ae8f0cce5aa50c83a6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Mon, 16 Oct 2023 22:44:14 +0200 Subject: [PATCH 03/14] Fix tests --- ext/pdo/tests/bug_36798.phpt | 2 +- ext/pdo/tests/pdo_002.phpt | 4 +++- ext/pdo/tests/pdo_003.phpt | 4 +++- ext/pdo/tests/pdo_004.phpt | 4 +++- ext/pdo/tests/pdo_005.phpt | 4 +++- ext/pdo/tests/pdo_006.phpt | 4 +++- ext/pdo/tests/pdo_007.phpt | 4 +++- ext/pdo/tests/pdo_009.phpt | 11 ++++++++--- ext/pdo/tests/pdo_010.phpt | 11 ++++++++--- ext/pdo/tests/pdo_011.phpt | 5 ++++- ext/pdo/tests/pdo_012.phpt | 3 ++- ext/pdo/tests/pdo_013.phpt | 3 ++- ext/pdo/tests/pdo_014.phpt | 3 ++- ext/pdo/tests/pdo_015.phpt | 3 ++- ext/pdo/tests/pdo_016.phpt | 4 +++- ext/pdo/tests/pdo_016a.phpt | 4 +++- ext/pdo/tests/pdo_017.phpt | 4 +++- ext/pdo/tests/pdo_018.phpt | 4 +++- ext/pdo/tests/pdo_019.phpt | 5 ++++- ext/pdo/tests/pdo_020.phpt | 4 +++- ext/pdo/tests/pdo_023.phpt | 3 ++- ext/pdo/tests/pdo_027.phpt | 3 ++- ext/pdo/tests/pdo_032.phpt | 4 +++- ext/pdo_oci/tests/bug54379.phpt | 3 ++- 24 files changed, 75 insertions(+), 28 deletions(-) diff --git a/ext/pdo/tests/bug_36798.phpt b/ext/pdo/tests/bug_36798.phpt index 5161b6234389e..e3a3d31b10b7b 100644 --- a/ext/pdo/tests/bug_36798.phpt +++ b/ext/pdo/tests/bug_36798.phpt @@ -45,5 +45,5 @@ PDOTest::dropTableIfExists($db, "test36798"); --EXPECT-- array(1) { [0]=> - string(1) "๏ฟฝ" + string(2) "รƒ" } diff --git a/ext/pdo/tests/pdo_002.phpt b/ext/pdo/tests/pdo_002.phpt index ec7bab32c6cb0..6ae49deb1b29f 100644 --- a/ext/pdo/tests/pdo_002.phpt +++ b/ext/pdo/tests/pdo_002.phpt @@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test002(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test002 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); +$db->exec("INSERT INTO test002 VALUES(1, 'A')"); +$db->exec("INSERT INTO test002 VALUES(2, 'B')"); +$db->exec("INSERT INTO test002 VALUES(3, 'C')"); $stmt = $db->prepare('SELECT * from test002'); $stmt->execute(); diff --git a/ext/pdo/tests/pdo_003.phpt b/ext/pdo/tests/pdo_003.phpt index 03db39816ddb8..d5ec1d776323a 100644 --- a/ext/pdo/tests/pdo_003.phpt +++ b/ext/pdo/tests/pdo_003.phpt @@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test003(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test003 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); +$db->exec("INSERT INTO test003 VALUES(1, 'A')"); +$db->exec("INSERT INTO test003 VALUES(2, 'B')"); +$db->exec("INSERT INTO test003 VALUES(3, 'C')"); $stmt = $db->prepare('SELECT * from test003'); $stmt->execute(); diff --git a/ext/pdo/tests/pdo_004.phpt b/ext/pdo/tests/pdo_004.phpt index 0d9e1d96e2dbd..160bb88155db5 100644 --- a/ext/pdo/tests/pdo_004.phpt +++ b/ext/pdo/tests/pdo_004.phpt @@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test004(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test004 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); +$db->exec("INSERT INTO test004 VALUES(1, 'A')"); +$db->exec("INSERT INTO test004 VALUES(2, 'B')"); +$db->exec("INSERT INTO test004 VALUES(3, 'C')"); $stmt = $db->prepare('SELECT * from test004'); $stmt->execute(); diff --git a/ext/pdo/tests/pdo_005.phpt b/ext/pdo/tests/pdo_005.phpt index 0c781fad0ffd8..b22e4aa9a9b5b 100644 --- a/ext/pdo/tests/pdo_005.phpt +++ b/ext/pdo/tests/pdo_005.phpt @@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test005(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(10))'); -$db->exec("INSERT INTO test005 VALUES(1, 'A', 'AA'), (2, 'B', 'BB'), (3, 'C', 'CC')"); +$db->exec("INSERT INTO test005 VALUES(1, 'A', 'AA')"); +$db->exec("INSERT INTO test005 VALUES(2, 'B', 'BB')"); +$db->exec("INSERT INTO test005 VALUES(3, 'C', 'CC')"); $stmt = $db->prepare('SELECT id, val, val2 from test005'); diff --git a/ext/pdo/tests/pdo_006.phpt b/ext/pdo/tests/pdo_006.phpt index e943a2837f800..c8ef0bcaf3091 100644 --- a/ext/pdo/tests/pdo_006.phpt +++ b/ext/pdo/tests/pdo_006.phpt @@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test006(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test006 VALUES(1, 'A'), (2, 'A'), (3, 'C')"); +$db->exec("INSERT INTO test006 VALUES(1, 'A')"); +$db->exec("INSERT INTO test006 VALUES(2, 'A')"); +$db->exec("INSERT INTO test006 VALUES(3, 'C')"); $stmt = $db->prepare('SELECT val, id from test006'); diff --git a/ext/pdo/tests/pdo_007.phpt b/ext/pdo/tests/pdo_007.phpt index 136d2f7a78456..44c3ed1e5d1f7 100644 --- a/ext/pdo/tests/pdo_007.phpt +++ b/ext/pdo/tests/pdo_007.phpt @@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test007(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test007 VALUES('A', 'A'), ('B', 'A'), ('C', 'C')"); +$db->exec("INSERT INTO test007 VALUES('A', 'A')"); +$db->exec("INSERT INTO test007 VALUES('B', 'A')"); +$db->exec("INSERT INTO test007 VALUES('C', 'C')"); $stmt = $db->prepare('SELECT id, val from test007'); diff --git a/ext/pdo/tests/pdo_009.phpt b/ext/pdo/tests/pdo_009.phpt index 22b67250ea4fa..556dc486f7d33 100644 --- a/ext/pdo/tests/pdo_009.phpt +++ b/ext/pdo/tests/pdo_009.phpt @@ -16,11 +16,16 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE classtypes009(id int NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)'); -$db->exec("INSERT INTO classtypes009 VALUES(0, 'stdClass'), (1, 'Test1'), (2, 'Test2')"); +$db->exec("INSERT INTO classtypes009 VALUES(0, 'stdClass')"); +$db->exec("INSERT INTO classtypes009 VALUES(1, 'Test1')"); +$db->exec("INSERT INTO classtypes009 VALUES(2, 'Test2')"); $db->exec('CREATE TABLE test009(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10))'); -$db->exec("INSERT INTO test009 VALUES(1, 0, 'A'), (2, 1, 'B'), (3, 2, 'C'), (4, 3, 'D')"); +$db->exec("INSERT INTO test009 VALUES(1, 0, 'A')"); +$db->exec("INSERT INTO test009 VALUES(2, 1, 'B')"); +$db->exec("INSERT INTO test009 VALUES(3, 2, 'C')"); +$db->exec("INSERT INTO test009 VALUES(4, 3, 'D')"); -$stmt = $db->prepare('SELECT classtypes.name, test.id AS id, test.val AS val FROM test009 LEFT JOIN classtypes009 ON test.classtype=classtypes.id'); +$stmt = $db->prepare('SELECT classtypes009.name, test009.id AS id, test009.val AS val FROM test009 LEFT JOIN classtypes009 ON test009.classtype=classtypes009.id'); class Test1 { diff --git a/ext/pdo/tests/pdo_010.phpt b/ext/pdo/tests/pdo_010.phpt index 8953104b595c4..942e0a9568b25 100644 --- a/ext/pdo/tests/pdo_010.phpt +++ b/ext/pdo/tests/pdo_010.phpt @@ -16,11 +16,16 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE classtypes010(id int NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)'); -$db->exec("INSERT INTO classtypes010 VALUES(0, 'stdClass'), (1, 'Test1'), (2, 'Test2')); +$db->exec("INSERT INTO classtypes010 VALUES(0, 'stdClass')"); +$db->exec("INSERT INTO classtypes010 VALUES(1, 'Test1')"); +$db->exec("INSERT INTO classtypes010 VALUES(2, 'Test2')"); $db->exec('CREATE TABLE test010(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec("INSERT INTO test010 VALUES(1, 0, 'A', 'Group1'), (2, 1, 'B', 'Group1'), (3, 2, 'C', 'Group2'), (4, 3, 'D', 'Group2')"); +$db->exec("INSERT INTO test010 VALUES(1, 0, 'A', 'Group1')"); +$db->exec("INSERT INTO test010 VALUES(2, 1, 'B', 'Group1')"); +$db->exec("INSERT INTO test010 VALUES(3, 2, 'C', 'Group2')"); +$db->exec("INSERT INTO test010 VALUES(4, 3, 'D', 'Group2')"); -$stmt = $db->prepare('SELECT classtypes.name, test.grp AS grp, test.id AS id, test.val AS val FROM test010 LEFT JOIN classtypes010 ON test.classtype=classtypes.id'); +$stmt = $db->prepare('SELECT classtypes010.name, test010.grp AS grp, test010.id AS id, test010.val AS val FROM test010 LEFT JOIN classtypes010 ON test010.classtype=classtypes010.id'); class Test1 { diff --git a/ext/pdo/tests/pdo_011.phpt b/ext/pdo/tests/pdo_011.phpt index 225a0f268dce9..950fd278b7316 100644 --- a/ext/pdo/tests/pdo_011.phpt +++ b/ext/pdo/tests/pdo_011.phpt @@ -16,7 +16,10 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test011(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec("INSERT INTO test011 VALUES(1, 'A', 'Group1'), (2, 'B', 'Group1'), (3, 'C', 'Group2'), (4, 'D', 'Group2')"); +$db->exec("INSERT INTO test011 VALUES(1, 'A', 'Group1')"); +$db->exec("INSERT INTO test011 VALUES(2, 'B', 'Group1')"); +$db->exec("INSERT INTO test011 VALUES(3, 'C', 'Group2')"); +$db->exec("INSERT INTO test011 VALUES(4, 'D', 'Group2')"); class DerivedStatement extends PDOStatement { diff --git a/ext/pdo/tests/pdo_012.phpt b/ext/pdo/tests/pdo_012.phpt index 7b0473fdbacb3..2db0ca82fd132 100644 --- a/ext/pdo/tests/pdo_012.phpt +++ b/ext/pdo/tests/pdo_012.phpt @@ -16,7 +16,8 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test012(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec("INSERT INTO test012 VALUES(1, 'A', 'Group1'), (2, 'B', 'Group2')"); +$db->exec("INSERT INTO test012 VALUES(1, 'A', 'Group1')"); +$db->exec("INSERT INTO test012 VALUES(2, 'B', 'Group2')"); $SELECT = 'SELECT val, grp FROM test012'; diff --git a/ext/pdo/tests/pdo_013.phpt b/ext/pdo/tests/pdo_013.phpt index 9af1749d3118a..44d1f41d7be61 100644 --- a/ext/pdo/tests/pdo_013.phpt +++ b/ext/pdo/tests/pdo_013.phpt @@ -16,7 +16,8 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test013(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec("INSERT INTO test013 VALUES(1, 'A', 'Group1'), (2, 'B', 'Group2')"); +$db->exec("INSERT INTO test013 VALUES(1, 'A', 'Group1')"); +$db->exec("INSERT INTO test013 VALUES(2, 'B', 'Group2')"); $SELECT = 'SELECT val, grp FROM test013'; diff --git a/ext/pdo/tests/pdo_014.phpt b/ext/pdo/tests/pdo_014.phpt index f467e835fee5f..4231db64f6f60 100644 --- a/ext/pdo/tests/pdo_014.phpt +++ b/ext/pdo/tests/pdo_014.phpt @@ -16,7 +16,8 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test014(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -$db->exec("INSERT INTO test014 VALUES(1, 'A', 'Group1'), (2, 'B', 'Group2')"); +$db->exec("INSERT INTO test014 VALUES(1, 'A', 'Group1')"); +$db->exec("INSERT INTO test014 VALUES(2, 'B', 'Group2')"); $SELECT = 'SELECT val, grp FROM test014'; class Test diff --git a/ext/pdo/tests/pdo_015.phpt b/ext/pdo/tests/pdo_015.phpt index 8aa5e9f22e259..15e73a0a87846 100644 --- a/ext/pdo/tests/pdo_015.phpt +++ b/ext/pdo/tests/pdo_015.phpt @@ -16,7 +16,8 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test015(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(20))'); -$db->exec("INSERT INTO test015 VALUES(1, 'A', 'A2'), (2, 'A', 'B2')"); +$db->exec("INSERT INTO test015 VALUES(1, 'A', 'A2')"); +$db->exec("INSERT INTO test015 VALUES(2, 'A', 'B2')"); $select1 = $db->prepare('SELECT id, val, val2 FROM test015'); $select2 = $db->prepare('SELECT val, val2 FROM test015'); diff --git a/ext/pdo/tests/pdo_016.phpt b/ext/pdo/tests/pdo_016.phpt index dd902bbe1be44..5b99930f2495c 100644 --- a/ext/pdo/tests/pdo_016.phpt +++ b/ext/pdo/tests/pdo_016.phpt @@ -21,7 +21,9 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { } $db->exec('CREATE TABLE test016(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$db->exec("INSERT INTO test016 VALUES(0, 'String0'), (1, 'String1'), (2, 'String2')"); +$db->exec("INSERT INTO test016 VALUES(0, 'String0')"); +$db->exec("INSERT INTO test016 VALUES(1, 'String1')"); +$db->exec("INSERT INTO test016 VALUES(2, 'String2')"); $stmt1 = $db->prepare('SELECT COUNT(idx) FROM test016'); $stmt2 = $db->prepare('SELECT idx, txt FROM test016 ORDER by idx'); diff --git a/ext/pdo/tests/pdo_016a.phpt b/ext/pdo/tests/pdo_016a.phpt index 52db2850b27f7..d7dcb2c65430b 100644 --- a/ext/pdo/tests/pdo_016a.phpt +++ b/ext/pdo/tests/pdo_016a.phpt @@ -21,7 +21,9 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { } $db->exec('CREATE TABLE test016a(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$db->exec("INSERT INTO test016a VALUES(0, 'String0'), (1, 'String1'), (2, 'String2')"); +$db->exec("INSERT INTO test016a VALUES(0, 'String0')"); +$db->exec("INSERT INTO test016a VALUES(1, 'String1')"); +$db->exec("INSERT INTO test016a VALUES(2, 'String2')"); $stmt1 = $db->prepare('SELECT COUNT(idx) FROM test016a'); $stmt2 = $db->prepare('SELECT idx, txt FROM test016a ORDER by idx'); diff --git a/ext/pdo/tests/pdo_017.phpt b/ext/pdo/tests/pdo_017.phpt index 17decb42c9704..83e3fe8ca4a8f 100644 --- a/ext/pdo/tests/pdo_017.phpt +++ b/ext/pdo/tests/pdo_017.phpt @@ -37,7 +37,9 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { } $db->exec('CREATE TABLE test017(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'.$suf); -$db->exec("INSERT INTO test017 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); +$db->exec("INSERT INTO test017 VALUES(1, 'A')"); +$db->exec("INSERT INTO test017 VALUES(2, 'B')"); +$db->exec("INSERT INTO test017 VALUES(3, 'C')"); $delete = $db->prepare('DELETE FROM test017'); function countRows($action) { diff --git a/ext/pdo/tests/pdo_018.phpt b/ext/pdo/tests/pdo_018.phpt index 7ff9828d48551..63789e682ccc5 100644 --- a/ext/pdo/tests/pdo_018.phpt +++ b/ext/pdo/tests/pdo_018.phpt @@ -68,7 +68,9 @@ class TestLeaf extends TestDerived } $db->exec('CREATE TABLE classtypes018(id int NOT NULL PRIMARY KEY, name VARCHAR(20) NOT NULL UNIQUE)'); -$db->exec("INSERT INTO classtypes018 VALUES(0, 'stdClass'), (1, 'TestBase'), (2, 'TestDerived')"); +$db->exec("INSERT INTO classtypes018 VALUES(0, 'stdClass')"); +$db->exec("INSERT INTO classtypes018 VALUES(1, 'TestBase')"); +$db->exec("INSERT INTO classtypes018 VALUES(2, 'TestDerived')"); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'dblib': diff --git a/ext/pdo/tests/pdo_019.phpt b/ext/pdo/tests/pdo_019.phpt index 1ec8054f2a93e..4be3a9376c8f1 100644 --- a/ext/pdo/tests/pdo_019.phpt +++ b/ext/pdo/tests/pdo_019.phpt @@ -16,7 +16,10 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test019(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -$db->exec("INSERT INTO test019 VALUES(0, 'String0'), (1, 'String1'), (2, 'String2'), (3, 'String3')"); +$db->exec("INSERT INTO test019 VALUES(0, 'String0')"); +$db->exec("INSERT INTO test019 VALUES(1, 'String1')"); +$db->exec("INSERT INTO test019 VALUES(2, 'String2')"); +$db->exec("INSERT INTO test019 VALUES(3, 'String3')"); var_dump($db->query('SELECT COUNT(*) FROM test019')->fetchColumn()); diff --git a/ext/pdo/tests/pdo_020.phpt b/ext/pdo/tests/pdo_020.phpt index d6aec12b97334..57875ff831fb3 100644 --- a/ext/pdo/tests/pdo_020.phpt +++ b/ext/pdo/tests/pdo_020.phpt @@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test020(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -$db->exec("INSERT INTO test020 VALUES(1, 'A', 'A'), (2, 'B', 'B'), (3, 'C', 'C')"); +$db->exec("INSERT INTO test020 VALUES(1, 'A', 'A')"); +$db->exec("INSERT INTO test020 VALUES(2, 'B', 'B')"); +$db->exec("INSERT INTO test020 VALUES(3, 'C', 'C')"); foreach (array('SELECT id, val FROM test020', 'SELECT id, val, val2 FROM test020', 'SELECT COUNT(*) FROM test020') as $sql) { diff --git a/ext/pdo/tests/pdo_023.phpt b/ext/pdo/tests/pdo_023.phpt index 32cd497d1c8cd..e8f857abc2e35 100644 --- a/ext/pdo/tests/pdo_023.phpt +++ b/ext/pdo/tests/pdo_023.phpt @@ -64,7 +64,8 @@ $db->test(); var_dump($db); $db->query('CREATE TABLE test023(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->query("INSERT INTO test023 VALUES(0, 'A'), (1, 'B')"); +$db->query("INSERT INTO test023 VALUES(0, 'A')"); +$db->query("INSERT INTO test023 VALUES(1, 'B')"); $stmt = $db->query('SELECT val, id FROM test023'); diff --git a/ext/pdo/tests/pdo_027.phpt b/ext/pdo/tests/pdo_027.phpt index 808e905dc64b3..a18f9b83c6ac5 100644 --- a/ext/pdo/tests/pdo_027.phpt +++ b/ext/pdo/tests/pdo_027.phpt @@ -16,7 +16,8 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('create table test027 (id int, name varchar(10))'); -$db->exec("INSERT INTO test027 (id,name) VALUES(1,'test1'), (2,'test2')"); +$db->exec("INSERT INTO test027 (id,name) VALUES(1,'test1')"); +$db->exec("INSERT INTO test027 (id,name) VALUES(2,'test2')"); foreach ($db->query("SELECT * FROM test027", PDO::FETCH_LAZY) as $v) { echo "lazy: " . $v->id.$v->name."\n"; diff --git a/ext/pdo/tests/pdo_032.phpt b/ext/pdo/tests/pdo_032.phpt index a0633d5305481..07d05332b8e76 100644 --- a/ext/pdo/tests/pdo_032.phpt +++ b/ext/pdo/tests/pdo_032.phpt @@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test032(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test032 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); +$db->exec("INSERT INTO test032 VALUES(1, 'A')"); +$db->exec("INSERT INTO test032 VALUES(2, 'B')"); +$db->exec("INSERT INTO test032 VALUES(3, 'C')"); // Lower case columns $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); diff --git a/ext/pdo_oci/tests/bug54379.phpt b/ext/pdo_oci/tests/bug54379.phpt index 8d393a4727abd..a17ac63d5e11d 100644 --- a/ext/pdo_oci/tests/bug54379.phpt +++ b/ext/pdo_oci/tests/bug54379.phpt @@ -17,7 +17,8 @@ $db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->exec("CREATE TABLE test54379 (col1 NVARCHAR2(20))"); -$db->exec("INSERT INTO test54379 VALUES('12345678901234567890'), ('ใ‚ใ„ใ†ใˆใŠใ‹ใใใ‘ใ“ใ•ใ—ใ™ใ›ใใŸใกใคใฆใจ')"); +$db->exec("INSERT INTO test54379 VALUES('12345678901234567890')"); +$db->exec("INSERT INTO test54379 VALUES('ใ‚ใ„ใ†ใˆใŠใ‹ใใใ‘ใ“ใ•ใ—ใ™ใ›ใใŸใกใคใฆใจ')"); $stmt = $db->prepare("SELECT * FROM test54379"); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); From b7ec7b05f296b05b69679a4b8f88451501c57a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Tue, 17 Oct 2023 21:35:19 +0200 Subject: [PATCH 04/14] Really fix tests --- ext/pdo/tests/pdo_008.phpt | 4 ++- ext/pdo/tests/pdo_test.inc | 28 +++++++++---------- ext/pdo_firebird/tests/bug_47415.phpt | 2 +- ext/pdo_firebird/tests/bug_48877.phpt | 6 ++-- ext/pdo_firebird/tests/bug_53280.phpt | 2 +- ext/pdo_firebird/tests/bug_62024.phpt | 2 +- ext/pdo_firebird/tests/bug_64037.phpt | 6 ++-- ext/pdo_firebird/tests/bug_72583.phpt | 2 +- ext/pdo_firebird/tests/bug_72931.phpt | 2 +- ext/pdo_firebird/tests/bug_73087.phpt | 2 +- ext/pdo_firebird/tests/bug_74462.phpt | 6 ++-- ext/pdo_firebird/tests/bug_aaa.phpt | 2 +- ext/pdo_firebird/tests/dialect_1.phpt | 2 +- ext/pdo_firebird/tests/execute.phpt | 2 +- ext/pdo_firebird/tests/rowCount.phpt | 6 ++-- .../tests/pdo_oci_attr_autocommit_2.phpt | 2 +- 16 files changed, 43 insertions(+), 33 deletions(-) diff --git a/ext/pdo/tests/pdo_008.phpt b/ext/pdo/tests/pdo_008.phpt index a1498f24f2917..1f2deb332a948 100644 --- a/ext/pdo/tests/pdo_008.phpt +++ b/ext/pdo/tests/pdo_008.phpt @@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); $db->exec('CREATE TABLE test008(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); -$db->exec("INSERT INTO test008 VALUES('A', 'A'), ('B', 'A'), ('C', 'C')"); +$db->exec("INSERT INTO test008 VALUES('A', 'A')"); +$db->exec("INSERT INTO test008 VALUES('B', 'A')"); +$db->exec("INSERT INTO test008 VALUES('C', 'C')"); $stmt = $db->prepare('SELECT val, id from test008'); diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc index 7093be01b41e3..b56cc11dc9f82 100644 --- a/ext/pdo/tests/pdo_test.inc +++ b/ext/pdo/tests/pdo_test.inc @@ -75,21 +75,21 @@ class PDOTest { return; } - if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) === "oci") { - $db->exec(<<getAttribute(PDO::ATTR_DRIVER_NAME)) { + "oci" => $db->exec(<<exec("DROP TABLE IF EXISTS $tableName"); - } + SQL + ), + "firebird" => $db->exec("DROP TABLE $tableName"), + default => $db->exec("DROP TABLE IF EXISTS $tableName"), + }; } } ?> diff --git a/ext/pdo_firebird/tests/bug_47415.phpt b/ext/pdo_firebird/tests/bug_47415.phpt index a1a36d6a11ccf..b61f839cf3450 100644 --- a/ext/pdo_firebird/tests/bug_47415.phpt +++ b/ext/pdo_firebird/tests/bug_47415.phpt @@ -39,7 +39,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE IF EXISTS test47415"); +$dbh->exec("DROP TABLE test47415"); ?> --EXPECT-- bool(false) diff --git a/ext/pdo_firebird/tests/bug_48877.phpt b/ext/pdo_firebird/tests/bug_48877.phpt index 3c2203cd8c6d4..b9f355a3786f8 100644 --- a/ext/pdo_firebird/tests/bug_48877.phpt +++ b/ext/pdo_firebird/tests/bug_48877.phpt @@ -14,7 +14,9 @@ require("testdb.inc"); $value = '2'; $dbh->exec('CREATE TABLE test48877 (A integer)'); -$dbh->exec("INSERT INTO test48877 VALUES ('1'), ('2'), ('3')"); +$dbh->exec("INSERT INTO test48877 VALUES ('1')"); +$dbh->exec("INSERT INTO test48877 VALUES ('2')"); +$dbh->exec("INSERT INTO test48877 VALUES ('3')"); $dbh->commit(); $query = "SELECT * FROM test48877 WHERE A = :paramno"; @@ -38,7 +40,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE IF EXISTS test48877"); +$dbh->exec("DROP TABLE test48877"); ?> --EXPECT-- bool(false) diff --git a/ext/pdo_firebird/tests/bug_53280.phpt b/ext/pdo_firebird/tests/bug_53280.phpt index 6aa79bf35225a..d1e5d4db2339f 100644 --- a/ext/pdo_firebird/tests/bug_53280.phpt +++ b/ext/pdo_firebird/tests/bug_53280.phpt @@ -38,7 +38,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE IF EXISTS test53280"); +$dbh->exec("DROP TABLE test53280"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo_firebird/tests/bug_62024.phpt b/ext/pdo_firebird/tests/bug_62024.phpt index 10331deda4894..0f0af396c040e 100644 --- a/ext/pdo_firebird/tests/bug_62024.phpt +++ b/ext/pdo_firebird/tests/bug_62024.phpt @@ -46,7 +46,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE IF EXISTS test62024"); +$dbh->exec("DROP TABLE test62024"); ?> --EXPECT-- bool(true) diff --git a/ext/pdo_firebird/tests/bug_64037.phpt b/ext/pdo_firebird/tests/bug_64037.phpt index eb6f8ee2f221b..24dc6552dc617 100644 --- a/ext/pdo_firebird/tests/bug_64037.phpt +++ b/ext/pdo_firebird/tests/bug_64037.phpt @@ -13,7 +13,9 @@ require("testdb.inc"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $dbh->exec("CREATE TABLE test64037 (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15, 2))"); -$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (1, 'test', -1.0), (2, 'test', -0.99), (3, 'test', -1.01)"); +$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (1, 'test', -1.0)"); +$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (2, 'test', -0.99)"); +$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (3, 'test', -1.01)"); $dbh->commit(); @@ -38,7 +40,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE IF EXISTS test64037"); +$dbh->exec("DROP TABLE test64037"); ?> --EXPECT-- string(5) "-1.00" diff --git a/ext/pdo_firebird/tests/bug_72583.phpt b/ext/pdo_firebird/tests/bug_72583.phpt index e1c22142c2540..ef8864b03b091 100644 --- a/ext/pdo_firebird/tests/bug_72583.phpt +++ b/ext/pdo_firebird/tests/bug_72583.phpt @@ -22,7 +22,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE IF EXISTS test72583"); +$dbh->exec("DROP TABLE test72583"); ?> --EXPECT-- integer diff --git a/ext/pdo_firebird/tests/bug_72931.phpt b/ext/pdo_firebird/tests/bug_72931.phpt index a0f2f1066f259..8d3cd2ec2963b 100644 --- a/ext/pdo_firebird/tests/bug_72931.phpt +++ b/ext/pdo_firebird/tests/bug_72931.phpt @@ -21,7 +21,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE IF EXISTS test72931"); +$dbh->exec("DROP TABLE test72931"); ?> --EXPECT-- 1 diff --git a/ext/pdo_firebird/tests/bug_73087.phpt b/ext/pdo_firebird/tests/bug_73087.phpt index 2c13d1f40326c..64987fdfe4bf0 100644 --- a/ext/pdo_firebird/tests/bug_73087.phpt +++ b/ext/pdo_firebird/tests/bug_73087.phpt @@ -28,7 +28,7 @@ echo 'OK'; --CLEAN-- exec("DROP TABLE IF EXISTS test73087"); +$dbh->exec("DROP TABLE test73087"); ?> --EXPECT-- OK diff --git a/ext/pdo_firebird/tests/bug_74462.phpt b/ext/pdo_firebird/tests/bug_74462.phpt index 3adf8ee3079d6..6f412a4767095 100644 --- a/ext/pdo_firebird/tests/bug_74462.phpt +++ b/ext/pdo_firebird/tests/bug_74462.phpt @@ -11,7 +11,9 @@ LSAN_OPTIONS=detect_leaks=0 require 'testdb.inc'; $dbh->exec('recreate table test74462 (id integer not null, abool boolean)'); -$dbh->exec('insert into test74462 (id, abool) values (1, true), (2, false), (3, null)'); +$dbh->exec('insert into test74462 (id, abool) values (1, true)'); +$dbh->exec('insert into test74462 (id, abool) values (2, false)'); +$dbh->exec('insert into test74462 (id, abool) values (3, null)'); $S = $dbh->query('select abool from test74462 order by id'); $D = $S->fetchAll(PDO::FETCH_COLUMN); unset($S); @@ -21,7 +23,7 @@ var_dump($D); --CLEAN-- exec("DROP TABLE IF EXISTS test74462"); +$dbh->exec("DROP TABLE test74462"); ?> --EXPECT-- array(3) { diff --git a/ext/pdo_firebird/tests/bug_aaa.phpt b/ext/pdo_firebird/tests/bug_aaa.phpt index 64f976b8c57f3..2e0572ae065dc 100644 --- a/ext/pdo_firebird/tests/bug_aaa.phpt +++ b/ext/pdo_firebird/tests/bug_aaa.phpt @@ -23,7 +23,7 @@ echo 'OK'; --CLEAN-- exec("DROP TABLE IF EXISTS test_aaa"); +$dbh->exec("DROP TABLE test_aaa"); ?> --EXPECT-- OK diff --git a/ext/pdo_firebird/tests/dialect_1.phpt b/ext/pdo_firebird/tests/dialect_1.phpt index 5a65018984913..ba7d9878f4da2 100644 --- a/ext/pdo_firebird/tests/dialect_1.phpt +++ b/ext/pdo_firebird/tests/dialect_1.phpt @@ -55,7 +55,7 @@ echo "done\n"; --CLEAN-- exec('DROP TABLE IF EXISTS test_dialect_1'); +$dbh->exec('DROP TABLE test_dialect_1'); --EXPECT-- int(1) string(8) "2.000000" diff --git a/ext/pdo_firebird/tests/execute.phpt b/ext/pdo_firebird/tests/execute.phpt index 1db5a14c96e7c..544bf3088c373 100644 --- a/ext/pdo_firebird/tests/execute.phpt +++ b/ext/pdo_firebird/tests/execute.phpt @@ -46,7 +46,7 @@ echo "done\n"; --CLEAN-- exec('DROP TABLE IF EXISTS test_execute'); +$dbh->exec('DROP TABLE test_execute'); --EXPECT-- bool(true) int(1) diff --git a/ext/pdo_firebird/tests/rowCount.phpt b/ext/pdo_firebird/tests/rowCount.phpt index 07c8b835718cf..e6fe2d3d9429e 100644 --- a/ext/pdo_firebird/tests/rowCount.phpt +++ b/ext/pdo_firebird/tests/rowCount.phpt @@ -12,7 +12,9 @@ LSAN_OPTIONS=detect_leaks=0 require("testdb.inc"); $dbh->exec('CREATE TABLE test_rowcount (A VARCHAR(10))'); -$dbh->exec("INSERT INTO test_rowcount VALUES ('A'), ('A'), ('B')"); +$dbh->exec("INSERT INTO test_rowcount VALUES ('A')"); +$dbh->exec("INSERT INTO test_rowcount VALUES ('A')"); +$dbh->exec("INSERT INTO test_rowcount VALUES ('B')"); $dbh->commit(); $query = "SELECT * FROM test_rowcount WHERE A = ?"; @@ -42,7 +44,7 @@ unset($dbh); --CLEAN-- exec('DROP TABLE IF EXISTS test_rowcount'); +$dbh->exec('DROP TABLE test_rowcount'); --EXPECT-- bool(false) int(2) diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt index 468fa61326adb..88a50ba25dd90 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt @@ -110,7 +110,7 @@ PDOTest::dropTableIfExists($db, test_pdo_oci_attr_autocommit_2"); --EXPECTF-- Test 1 Check beginTransaction insertion Test 2 Cause an exception and test beginTransaction rollback -Caught expected exception at line 35 +Caught expected exception at line 33 SQLSTATE[HY000]: General error: 12899 OCIStmtExecute: ORA-12899: %s %s Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction From df0b902d8f8cb073e7ba48dd9988b8e988896911 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 18 Oct 2023 01:08:21 +0100 Subject: [PATCH 05/14] Apply suggestions from code review --- ext/pdo_pgsql/tests/bug36727.phpt | 2 +- ext/pdo_pgsql/tests/bug43925.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pdo_pgsql/tests/bug36727.phpt b/ext/pdo_pgsql/tests/bug36727.phpt index 8ab244926c1ea..c1902da213c9f 100644 --- a/ext/pdo_pgsql/tests/bug36727.phpt +++ b/ext/pdo_pgsql/tests/bug36727.phpt @@ -24,7 +24,7 @@ echo "Done\n"; exec("DROP TABLE IF EXIST test36727"); +$db->exec("DROP TABLE IF EXISTS test36727"); ?> --EXPECTF-- Warning: PDOStatement::bindValue(): SQLSTATE[HY093]: Invalid parameter number: :test in %s on line %d diff --git a/ext/pdo_pgsql/tests/bug43925.phpt b/ext/pdo_pgsql/tests/bug43925.phpt index 2141d8b52ebf4..e4b8bd7ab1418 100644 --- a/ext/pdo_pgsql/tests/bug43925.phpt +++ b/ext/pdo_pgsql/tests/bug43925.phpt @@ -52,7 +52,7 @@ foreach ($stmt->fetchAll() as $row) { exec("DROP TABLE IF EXIST test43925"); +$db->exec("DROP TABLE IF EXISTS test43925"); ?> --EXPECT-- 1 - 1 - 1 - 1 - 1 - 1 - 6 - 6 From 586e2ea330c39eef1a2db542dae9de219bf3a551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 19 Oct 2023 19:24:01 +0200 Subject: [PATCH 06/14] Fix the rest of the tests --- ext/pdo/tests/bug_36798.phpt | 4 ++-- ext/pdo/tests/pdo_test.inc | 2 +- ext/pdo_firebird/tests/bug_47415.phpt | 2 +- ext/pdo_firebird/tests/bug_48877.phpt | 2 +- ext/pdo_firebird/tests/bug_53280.phpt | 2 +- ext/pdo_firebird/tests/bug_62024.phpt | 2 +- ext/pdo_firebird/tests/bug_64037.phpt | 2 +- ext/pdo_firebird/tests/bug_72583.phpt | 2 +- ext/pdo_firebird/tests/bug_72931.phpt | 2 +- ext/pdo_firebird/tests/bug_73087.phpt | 2 +- ext/pdo_firebird/tests/bug_74462.phpt | 2 +- ext/pdo_firebird/tests/bug_80521.phpt | 2 +- ext/pdo_firebird/tests/bug_aaa.phpt | 3 +-- ext/pdo_firebird/tests/ddl.phpt | 9 ++++--- ext/pdo_firebird/tests/dialect_1.phpt | 2 +- ext/pdo_firebird/tests/execute.phpt | 2 +- ext/pdo_firebird/tests/gh10908.phpt | 2 +- ext/pdo_firebird/tests/gh8576.phpt | 2 +- ext/pdo_firebird/tests/rowCount.phpt | 2 +- .../tests/pdo_oci_attr_autocommit_2.phpt | 24 +++++++++---------- ext/pdo_pgsql/tests/bug62498-32bit.phpt | 2 +- 21 files changed, 36 insertions(+), 38 deletions(-) diff --git a/ext/pdo/tests/bug_36798.phpt b/ext/pdo/tests/bug_36798.phpt index e3a3d31b10b7b..34d812e0d0e73 100644 --- a/ext/pdo/tests/bug_36798.phpt +++ b/ext/pdo/tests/bug_36798.phpt @@ -29,7 +29,7 @@ $db = PDOTest::factory(); $db->exec("CREATE TABLE test36798 (id INTEGER)"); $db->exec("INSERT INTO test36798 (id) VALUES (1)"); -$stmt = $db->prepare("SELECT 'รƒ' as test FROM test36798 WHERE id = :id"); +$stmt = $db->prepare("SELECT '๏ฟฝ' as test FROM test36798 WHERE id = :id"); $stmt->execute(array(":id" => 1)); $row = $stmt->fetch(PDO::FETCH_NUM); @@ -45,5 +45,5 @@ PDOTest::dropTableIfExists($db, "test36798"); --EXPECT-- array(1) { [0]=> - string(2) "รƒ" + string(1) "๏ฟฝ" } diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc index b56cc11dc9f82..22f653e238261 100644 --- a/ext/pdo/tests/pdo_test.inc +++ b/ext/pdo/tests/pdo_test.inc @@ -87,7 +87,7 @@ class PDOTest { END; SQL ), - "firebird" => $db->exec("DROP TABLE $tableName"), + "firebird" => @$db->exec("DROP TABLE $tableName"), default => $db->exec("DROP TABLE IF EXISTS $tableName"), }; } diff --git a/ext/pdo_firebird/tests/bug_47415.phpt b/ext/pdo_firebird/tests/bug_47415.phpt index b61f839cf3450..ef768cc2f1a0d 100644 --- a/ext/pdo_firebird/tests/bug_47415.phpt +++ b/ext/pdo_firebird/tests/bug_47415.phpt @@ -39,7 +39,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE test47415"); +@$dbh->exec("DROP TABLE test47415"); ?> --EXPECT-- bool(false) diff --git a/ext/pdo_firebird/tests/bug_48877.phpt b/ext/pdo_firebird/tests/bug_48877.phpt index b9f355a3786f8..afb5139a2f06b 100644 --- a/ext/pdo_firebird/tests/bug_48877.phpt +++ b/ext/pdo_firebird/tests/bug_48877.phpt @@ -40,7 +40,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE test48877"); +@$dbh->exec("DROP TABLE test48877"); ?> --EXPECT-- bool(false) diff --git a/ext/pdo_firebird/tests/bug_53280.phpt b/ext/pdo_firebird/tests/bug_53280.phpt index d1e5d4db2339f..c0c378467236c 100644 --- a/ext/pdo_firebird/tests/bug_53280.phpt +++ b/ext/pdo_firebird/tests/bug_53280.phpt @@ -38,7 +38,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE test53280"); +@$dbh->exec("DROP TABLE test53280"); ?> --EXPECT-- array(1) { diff --git a/ext/pdo_firebird/tests/bug_62024.phpt b/ext/pdo_firebird/tests/bug_62024.phpt index 0f0af396c040e..fc96a3b65912b 100644 --- a/ext/pdo_firebird/tests/bug_62024.phpt +++ b/ext/pdo_firebird/tests/bug_62024.phpt @@ -46,7 +46,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE test62024"); +@$dbh->exec("DROP TABLE test62024"); ?> --EXPECT-- bool(true) diff --git a/ext/pdo_firebird/tests/bug_64037.phpt b/ext/pdo_firebird/tests/bug_64037.phpt index 24dc6552dc617..f45970bbd0601 100644 --- a/ext/pdo_firebird/tests/bug_64037.phpt +++ b/ext/pdo_firebird/tests/bug_64037.phpt @@ -40,7 +40,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE test64037"); +@$dbh->exec("DROP TABLE test64037"); ?> --EXPECT-- string(5) "-1.00" diff --git a/ext/pdo_firebird/tests/bug_72583.phpt b/ext/pdo_firebird/tests/bug_72583.phpt index ef8864b03b091..1c53ded31be8a 100644 --- a/ext/pdo_firebird/tests/bug_72583.phpt +++ b/ext/pdo_firebird/tests/bug_72583.phpt @@ -22,7 +22,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE test72583"); +@$dbh->exec("DROP TABLE test72583"); ?> --EXPECT-- integer diff --git a/ext/pdo_firebird/tests/bug_72931.phpt b/ext/pdo_firebird/tests/bug_72931.phpt index 8d3cd2ec2963b..88b997c3d6e55 100644 --- a/ext/pdo_firebird/tests/bug_72931.phpt +++ b/ext/pdo_firebird/tests/bug_72931.phpt @@ -21,7 +21,7 @@ unset($dbh); --CLEAN-- exec("DROP TABLE test72931"); +@$dbh->exec("DROP TABLE test72931"); ?> --EXPECT-- 1 diff --git a/ext/pdo_firebird/tests/bug_73087.phpt b/ext/pdo_firebird/tests/bug_73087.phpt index 64987fdfe4bf0..bd1bc97e1d617 100644 --- a/ext/pdo_firebird/tests/bug_73087.phpt +++ b/ext/pdo_firebird/tests/bug_73087.phpt @@ -28,7 +28,7 @@ echo 'OK'; --CLEAN-- exec("DROP TABLE test73087"); +@$dbh->exec("DROP TABLE test73087"); ?> --EXPECT-- OK diff --git a/ext/pdo_firebird/tests/bug_74462.phpt b/ext/pdo_firebird/tests/bug_74462.phpt index 6f412a4767095..8c82963ecd17f 100644 --- a/ext/pdo_firebird/tests/bug_74462.phpt +++ b/ext/pdo_firebird/tests/bug_74462.phpt @@ -23,7 +23,7 @@ var_dump($D); --CLEAN-- exec("DROP TABLE test74462"); +@$dbh->exec("DROP TABLE test74462"); ?> --EXPECT-- array(3) { diff --git a/ext/pdo_firebird/tests/bug_80521.phpt b/ext/pdo_firebird/tests/bug_80521.phpt index e2c00c6a81159..43260e47e53d7 100644 --- a/ext/pdo_firebird/tests/bug_80521.phpt +++ b/ext/pdo_firebird/tests/bug_80521.phpt @@ -21,5 +21,5 @@ object(PDOStatement)#%d (1) { --CLEAN-- exec("DROP TABLE bug80521"); +@$dbh->exec("DROP TABLE bug80521"); ?> diff --git a/ext/pdo_firebird/tests/bug_aaa.phpt b/ext/pdo_firebird/tests/bug_aaa.phpt index 2e0572ae065dc..27a04e58580d9 100644 --- a/ext/pdo_firebird/tests/bug_aaa.phpt +++ b/ext/pdo_firebird/tests/bug_aaa.phpt @@ -11,7 +11,6 @@ LSAN_OPTIONS=detect_leaks=0 require 'testdb.inc'; $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -@$dbh->exec('drop table test_aaa'); $dbh->exec('create table test_aaa (id integer)'); $S = $dbh->prepare('insert into test_aaa (id) values (:id) returning id'); $S->execute(['id' => 1]); @@ -23,7 +22,7 @@ echo 'OK'; --CLEAN-- exec("DROP TABLE test_aaa"); +@$dbh->exec("DROP TABLE test_aaa"); ?> --EXPECT-- OK diff --git a/ext/pdo_firebird/tests/ddl.phpt b/ext/pdo_firebird/tests/ddl.phpt index 56e3e431feff5..a0807282e5b51 100644 --- a/ext/pdo_firebird/tests/ddl.phpt +++ b/ext/pdo_firebird/tests/ddl.phpt @@ -31,14 +31,13 @@ $dbh->commit(); unset($dbh); echo "done\n"; - -?> +-?> --CLEAN-- exec('DROP TABLE test_ddl'); -$dbh->exec('DROP GENERATOR gen_ddl_id'); -$dbh->exec('DROP TRIGGER ddl_bi'); +@$dbh->exec('DROP TABLE test_ddl'); +@$dbh->exec('DROP GENERATOR gen_ddl_id'); +@$dbh->exec('DROP TRIGGER ddl_bi'); ?> --EXPECT-- int(1) diff --git a/ext/pdo_firebird/tests/dialect_1.phpt b/ext/pdo_firebird/tests/dialect_1.phpt index ba7d9878f4da2..fd135ce24fe8b 100644 --- a/ext/pdo_firebird/tests/dialect_1.phpt +++ b/ext/pdo_firebird/tests/dialect_1.phpt @@ -55,7 +55,7 @@ echo "done\n"; --CLEAN-- exec('DROP TABLE test_dialect_1'); +@$dbh->exec('DROP TABLE test_dialect_1'); --EXPECT-- int(1) string(8) "2.000000" diff --git a/ext/pdo_firebird/tests/execute.phpt b/ext/pdo_firebird/tests/execute.phpt index 544bf3088c373..6437d9d22d354 100644 --- a/ext/pdo_firebird/tests/execute.phpt +++ b/ext/pdo_firebird/tests/execute.phpt @@ -46,7 +46,7 @@ echo "done\n"; --CLEAN-- exec('DROP TABLE test_execute'); +@$dbh->exec('DROP TABLE test_execute'); --EXPECT-- bool(true) int(1) diff --git a/ext/pdo_firebird/tests/gh10908.phpt b/ext/pdo_firebird/tests/gh10908.phpt index a1e8271ffd19b..26ce362e0f372 100644 --- a/ext/pdo_firebird/tests/gh10908.phpt +++ b/ext/pdo_firebird/tests/gh10908.phpt @@ -56,7 +56,7 @@ echo "Did not crash\n"; --CLEAN-- exec("DROP TABLE gh10908"); +@$dbh->exec("DROP TABLE gh10908"); ?> --EXPECT-- Array diff --git a/ext/pdo_firebird/tests/gh8576.phpt b/ext/pdo_firebird/tests/gh8576.phpt index cc1ebc3b7a134..7fa31b1350f85 100644 --- a/ext/pdo_firebird/tests/gh8576.phpt +++ b/ext/pdo_firebird/tests/gh8576.phpt @@ -26,5 +26,5 @@ array(1) { --CLEAN-- exec("DROP TABLE gh8576"); +@$dbh->exec("DROP TABLE gh8576"); ?> diff --git a/ext/pdo_firebird/tests/rowCount.phpt b/ext/pdo_firebird/tests/rowCount.phpt index e6fe2d3d9429e..a2efc6edf09f2 100644 --- a/ext/pdo_firebird/tests/rowCount.phpt +++ b/ext/pdo_firebird/tests/rowCount.phpt @@ -44,7 +44,7 @@ unset($dbh); --CLEAN-- exec('DROP TABLE test_rowcount'); +@$dbh->exec('DROP TABLE test_rowcount'); --EXPECT-- bool(false) int(2) diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt index 88a50ba25dd90..54272e62e646e 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt @@ -16,14 +16,14 @@ $dbh = PDOTest::factory(); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$dbh->exec("create table pdo_ac_tab (col1 varchar2(25))"); +$dbh->exec("create table test_pdo_oci_attr_autocommit_2 (col1 varchar2(25))"); echo "Test 1 Check beginTransaction insertion\n"; $dbh->beginTransaction(); try { - $dbh->exec("insert into pdo_ac_tab (col1) values ('data 1')"); - $dbh->exec("insert into pdo_ac_tab (col1) values ('data 2')"); + $dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 1')"); + $dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 2')"); $dbh->commit(); } catch (PDOException $e) { @@ -36,8 +36,8 @@ echo "Test 2 Cause an exception and test beginTransaction rollback\n"; $dbh->beginTransaction(); try { - $dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #1')"); - $dbh->exec("insert into pdo_ac_tab (col1) values ('data that is too long to fit and will barf')"); + $dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('not committed #1')"); + $dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data that is too long to fit and will barf')"); $dbh->commit(); } catch (PDOException $e) { @@ -48,7 +48,7 @@ catch (PDOException $e) { echo "Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction\n"; -$dbh->exec("insert into pdo_ac_tab (col1) values ('data 3')"); +$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 3')"); $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, true); print "PDO::ATTR_AUTOCOMMIT: "; var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT)); @@ -63,7 +63,7 @@ catch (PDOException $e) { echo "Test 4 Setting ATTR_AUTOCOMMIT to false will commit and end the transaction\n"; $dbh->beginTransaction(); -$dbh->exec("insert into pdo_ac_tab (col1) values ('data 4')"); +$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 4')"); $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false); print "PDO::ATTR_AUTOCOMMIT: "; var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT)); @@ -80,10 +80,10 @@ echo "Test 5 Handle transactions ourselves\n"; print "PDO::ATTR_AUTOCOMMIT: "; var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT)); -$dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #2')"); +$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('not committed #2')"); $dbh->exec("rollback"); -$dbh->exec("insert into pdo_ac_tab (col1) values ('data 5')"); -$dbh->exec("insert into pdo_ac_tab (col1) values ('data 6')"); +$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 5')"); +$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 6')"); $dbh->exec("commit"); @@ -92,7 +92,7 @@ $dbh->exec("commit"); $dbh2 = PDOTest::factory(); echo "Query Results are:\n"; -$s = $dbh2->prepare("select col1 from pdo_ac_tab"); +$s = $dbh2->prepare("select col1 from test_pdo_oci_attr_autocommit_2"); $s->execute(); while ($r = $s->fetch()) { echo $r[0] . "\n"; @@ -105,7 +105,7 @@ echo "Done\n"; --EXPECTF-- Test 1 Check beginTransaction insertion diff --git a/ext/pdo_pgsql/tests/bug62498-32bit.phpt b/ext/pdo_pgsql/tests/bug62498-32bit.phpt index 1d11155648be7..37ba9941a8b4c 100644 --- a/ext/pdo_pgsql/tests/bug62498-32bit.phpt +++ b/ext/pdo_pgsql/tests/bug62498-32bit.phpt @@ -49,7 +49,7 @@ Done exec("DROP TABLE IF EXIST test62498_32"); +$db->exec("DROP TABLE IF EXISTS test62498_32"); ?> --EXPECTF-- Begin test... From b663919db34c2d5179880fd989ca826f90e603a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Fri, 20 Oct 2023 20:56:58 +0200 Subject: [PATCH 07/14] Try to fix character encoding --- ext/pdo/tests/bug_36798.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pdo/tests/bug_36798.phpt b/ext/pdo/tests/bug_36798.phpt index 34d812e0d0e73..0275b39c958d3 100644 --- a/ext/pdo/tests/bug_36798.phpt +++ b/ext/pdo/tests/bug_36798.phpt @@ -29,7 +29,7 @@ $db = PDOTest::factory(); $db->exec("CREATE TABLE test36798 (id INTEGER)"); $db->exec("INSERT INTO test36798 (id) VALUES (1)"); -$stmt = $db->prepare("SELECT '๏ฟฝ' as test FROM test36798 WHERE id = :id"); +$stmt = $db->prepare("SELECT 'ร' as test FROM test36798 WHERE id = :id"); $stmt->execute(array(":id" => 1)); $row = $stmt->fetch(PDO::FETCH_NUM); @@ -45,5 +45,5 @@ PDOTest::dropTableIfExists($db, "test36798"); --EXPECT-- array(1) { [0]=> - string(1) "๏ฟฝ" + string(1) "ร" } From 9de4ea5ff8132d04b63e867458f0dbf96714f424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Fri, 20 Oct 2023 22:21:33 +0200 Subject: [PATCH 08/14] Readd conflicts to firebird As I suppose there is still some concurrency issue. --- ext/pdo_firebird/tests/CONFLICTS | 1 + 1 file changed, 1 insertion(+) create mode 100644 ext/pdo_firebird/tests/CONFLICTS diff --git a/ext/pdo_firebird/tests/CONFLICTS b/ext/pdo_firebird/tests/CONFLICTS new file mode 100644 index 0000000000000..4667cdfa07662 --- /dev/null +++ b/ext/pdo_firebird/tests/CONFLICTS @@ -0,0 +1 @@ +firebird From 6f1c8b907d875d1d2d1ed1774b3f19beb50fd94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sat, 21 Oct 2023 11:55:35 +0200 Subject: [PATCH 09/14] Fixes --- ext/pdo_firebird/tests/CONFLICTS | 1 - ext/pdo_firebird/tests/ddl.phpt | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) delete mode 100644 ext/pdo_firebird/tests/CONFLICTS diff --git a/ext/pdo_firebird/tests/CONFLICTS b/ext/pdo_firebird/tests/CONFLICTS deleted file mode 100644 index 4667cdfa07662..0000000000000 --- a/ext/pdo_firebird/tests/CONFLICTS +++ /dev/null @@ -1 +0,0 @@ -firebird diff --git a/ext/pdo_firebird/tests/ddl.phpt b/ext/pdo_firebird/tests/ddl.phpt index a0807282e5b51..e1c99541a6dc2 100644 --- a/ext/pdo_firebird/tests/ddl.phpt +++ b/ext/pdo_firebird/tests/ddl.phpt @@ -14,9 +14,9 @@ require("testdb.inc"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $dbh->exec("CREATE TABLE test_ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)"); -$dbh->exec("CREATE GENERATOR gen_ddl_id"); -$dbh->exec("CREATE TRIGGER ddl_bi FOR test_ddl BEFORE INSERT AS - BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END"); +$dbh->exec("CREATE GENERATOR gen_test_ddl_id"); +$dbh->exec("CREATE TRIGGER test_ddl_bi FOR test_ddl BEFORE INSERT AS + BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_test_ddl_id,1); END"); $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT,0); @@ -31,13 +31,15 @@ $dbh->commit(); unset($dbh); echo "done\n"; --?> ---CLEAN-- +?> +-CLEAN-- exec('DROP TABLE test_ddl'); -@$dbh->exec('DROP GENERATOR gen_ddl_id'); -@$dbh->exec('DROP TRIGGER ddl_bi'); +@$dbh->exec('DROP GENERATOR gen_test_ddl_id'); +@$dbh->exec('DROP TRIGGER test_ddl_bi'); + ?> --EXPECT-- int(1) From 0ea3181c4129626088ad7e34cfa7a5d07e2c0cc7 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 21 Oct 2023 12:20:51 +0100 Subject: [PATCH 10/14] Update ext/pdo_firebird/tests/ddl.phpt Co-authored-by: Jorg Adam Sowa --- ext/pdo_firebird/tests/ddl.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pdo_firebird/tests/ddl.phpt b/ext/pdo_firebird/tests/ddl.phpt index e1c99541a6dc2..60db364ebbcf4 100644 --- a/ext/pdo_firebird/tests/ddl.phpt +++ b/ext/pdo_firebird/tests/ddl.phpt @@ -32,7 +32,7 @@ $dbh->commit(); unset($dbh); echo "done\n"; ?> --CLEAN-- +--CLEAN-- Date: Sat, 21 Oct 2023 18:43:03 +0200 Subject: [PATCH 11/14] Fixes --- ext/pdo_dblib/tests/bug_45876.phpt | 2 ++ ext/pdo_dblib/tests/bug_50755.phpt | 2 ++ ext/pdo_firebird/tests/CONFLICTS | 1 + ext/pdo_firebird/tests/bug_47415.phpt | 1 + ext/pdo_firebird/tests/bug_48877.phpt | 1 + ext/pdo_firebird/tests/bug_53280.phpt | 1 + ext/pdo_firebird/tests/bug_62024.phpt | 1 + ext/pdo_firebird/tests/bug_64037.phpt | 1 + ext/pdo_firebird/tests/bug_72583.phpt | 1 + ext/pdo_firebird/tests/bug_72931.phpt | 1 + ext/pdo_firebird/tests/bug_73087.phpt | 1 + ext/pdo_firebird/tests/bug_74462.phpt | 1 + ext/pdo_firebird/tests/bug_80521.phpt | 1 + ext/pdo_firebird/tests/bug_aaa.phpt | 1 + ext/pdo_firebird/tests/ddl.phpt | 1 + ext/pdo_firebird/tests/dialect_1.phpt | 1 + ext/pdo_firebird/tests/execute.phpt | 1 + ext/pdo_firebird/tests/gh10908.phpt | 1 + ext/pdo_firebird/tests/gh8576.phpt | 1 + ext/pdo_firebird/tests/rowCount.phpt | 1 + 20 files changed, 22 insertions(+) create mode 100644 ext/pdo_firebird/tests/CONFLICTS diff --git a/ext/pdo_dblib/tests/bug_45876.phpt b/ext/pdo_dblib/tests/bug_45876.phpt index f56b7f94ff7e7..0d7ab02db785d 100644 --- a/ext/pdo_dblib/tests/bug_45876.phpt +++ b/ext/pdo_dblib/tests/bug_45876.phpt @@ -6,6 +6,8 @@ pdo_dblib +--CONFLICTS-- +pdo_dblib --FILE-- +--CONFLICTS-- +pdo_dblib --FILE-- exec("DROP TABLE test47415"); +unset($dbh); ?> --EXPECT-- bool(false) diff --git a/ext/pdo_firebird/tests/bug_48877.phpt b/ext/pdo_firebird/tests/bug_48877.phpt index afb5139a2f06b..e3cb6e93518d8 100644 --- a/ext/pdo_firebird/tests/bug_48877.phpt +++ b/ext/pdo_firebird/tests/bug_48877.phpt @@ -41,6 +41,7 @@ unset($dbh); exec("DROP TABLE test48877"); +unset($dbh); ?> --EXPECT-- bool(false) diff --git a/ext/pdo_firebird/tests/bug_53280.phpt b/ext/pdo_firebird/tests/bug_53280.phpt index c0c378467236c..2a4c19a44aa8c 100644 --- a/ext/pdo_firebird/tests/bug_53280.phpt +++ b/ext/pdo_firebird/tests/bug_53280.phpt @@ -39,6 +39,7 @@ unset($dbh); exec("DROP TABLE test53280"); +unset($dbh); ?> --EXPECT-- array(1) { diff --git a/ext/pdo_firebird/tests/bug_62024.phpt b/ext/pdo_firebird/tests/bug_62024.phpt index fc96a3b65912b..e46fad61fdad8 100644 --- a/ext/pdo_firebird/tests/bug_62024.phpt +++ b/ext/pdo_firebird/tests/bug_62024.phpt @@ -47,6 +47,7 @@ unset($dbh); exec("DROP TABLE test62024"); +unset($dbh); ?> --EXPECT-- bool(true) diff --git a/ext/pdo_firebird/tests/bug_64037.phpt b/ext/pdo_firebird/tests/bug_64037.phpt index f45970bbd0601..a86fe5f10914e 100644 --- a/ext/pdo_firebird/tests/bug_64037.phpt +++ b/ext/pdo_firebird/tests/bug_64037.phpt @@ -41,6 +41,7 @@ unset($dbh); exec("DROP TABLE test64037"); +unset($dbh); ?> --EXPECT-- string(5) "-1.00" diff --git a/ext/pdo_firebird/tests/bug_72583.phpt b/ext/pdo_firebird/tests/bug_72583.phpt index 1c53ded31be8a..5d22bd67736b2 100644 --- a/ext/pdo_firebird/tests/bug_72583.phpt +++ b/ext/pdo_firebird/tests/bug_72583.phpt @@ -23,6 +23,7 @@ unset($dbh); exec("DROP TABLE test72583"); +unset($dbh); ?> --EXPECT-- integer diff --git a/ext/pdo_firebird/tests/bug_72931.phpt b/ext/pdo_firebird/tests/bug_72931.phpt index 88b997c3d6e55..73ca7f07aee78 100644 --- a/ext/pdo_firebird/tests/bug_72931.phpt +++ b/ext/pdo_firebird/tests/bug_72931.phpt @@ -22,6 +22,7 @@ unset($dbh); exec("DROP TABLE test72931"); +unset($dbh); ?> --EXPECT-- 1 diff --git a/ext/pdo_firebird/tests/bug_73087.phpt b/ext/pdo_firebird/tests/bug_73087.phpt index bd1bc97e1d617..a8359c1690941 100644 --- a/ext/pdo_firebird/tests/bug_73087.phpt +++ b/ext/pdo_firebird/tests/bug_73087.phpt @@ -29,6 +29,7 @@ echo 'OK'; exec("DROP TABLE test73087"); +unset($dbh); ?> --EXPECT-- OK diff --git a/ext/pdo_firebird/tests/bug_74462.phpt b/ext/pdo_firebird/tests/bug_74462.phpt index 8c82963ecd17f..a5a12f4361173 100644 --- a/ext/pdo_firebird/tests/bug_74462.phpt +++ b/ext/pdo_firebird/tests/bug_74462.phpt @@ -24,6 +24,7 @@ var_dump($D); exec("DROP TABLE test74462"); +unset($dbh); ?> --EXPECT-- array(3) { diff --git a/ext/pdo_firebird/tests/bug_80521.phpt b/ext/pdo_firebird/tests/bug_80521.phpt index 43260e47e53d7..d1ab551d81fda 100644 --- a/ext/pdo_firebird/tests/bug_80521.phpt +++ b/ext/pdo_firebird/tests/bug_80521.phpt @@ -22,4 +22,5 @@ object(PDOStatement)#%d (1) { exec("DROP TABLE bug80521"); +unset($dbh); ?> diff --git a/ext/pdo_firebird/tests/bug_aaa.phpt b/ext/pdo_firebird/tests/bug_aaa.phpt index 27a04e58580d9..cb5aa8956f2f5 100644 --- a/ext/pdo_firebird/tests/bug_aaa.phpt +++ b/ext/pdo_firebird/tests/bug_aaa.phpt @@ -23,6 +23,7 @@ echo 'OK'; exec("DROP TABLE test_aaa"); +unset($dbh); ?> --EXPECT-- OK diff --git a/ext/pdo_firebird/tests/ddl.phpt b/ext/pdo_firebird/tests/ddl.phpt index 60db364ebbcf4..fe5088f898c07 100644 --- a/ext/pdo_firebird/tests/ddl.phpt +++ b/ext/pdo_firebird/tests/ddl.phpt @@ -39,6 +39,7 @@ require("testdb.inc"); @$dbh->exec('DROP TABLE test_ddl'); @$dbh->exec('DROP GENERATOR gen_test_ddl_id'); @$dbh->exec('DROP TRIGGER test_ddl_bi'); +unset($dbh); ?> --EXPECT-- diff --git a/ext/pdo_firebird/tests/dialect_1.phpt b/ext/pdo_firebird/tests/dialect_1.phpt index fd135ce24fe8b..f6e58dcafbdad 100644 --- a/ext/pdo_firebird/tests/dialect_1.phpt +++ b/ext/pdo_firebird/tests/dialect_1.phpt @@ -56,6 +56,7 @@ echo "done\n"; exec('DROP TABLE test_dialect_1'); +unset($dbh); --EXPECT-- int(1) string(8) "2.000000" diff --git a/ext/pdo_firebird/tests/execute.phpt b/ext/pdo_firebird/tests/execute.phpt index 6437d9d22d354..54731e2fbbcef 100644 --- a/ext/pdo_firebird/tests/execute.phpt +++ b/ext/pdo_firebird/tests/execute.phpt @@ -47,6 +47,7 @@ echo "done\n"; exec('DROP TABLE test_execute'); +unset($dbh); --EXPECT-- bool(true) int(1) diff --git a/ext/pdo_firebird/tests/gh10908.phpt b/ext/pdo_firebird/tests/gh10908.phpt index 26ce362e0f372..e3c5c0cffd7be 100644 --- a/ext/pdo_firebird/tests/gh10908.phpt +++ b/ext/pdo_firebird/tests/gh10908.phpt @@ -57,6 +57,7 @@ echo "Did not crash\n"; exec("DROP TABLE gh10908"); +unset($dbh); ?> --EXPECT-- Array diff --git a/ext/pdo_firebird/tests/gh8576.phpt b/ext/pdo_firebird/tests/gh8576.phpt index 7fa31b1350f85..5854bf355b589 100644 --- a/ext/pdo_firebird/tests/gh8576.phpt +++ b/ext/pdo_firebird/tests/gh8576.phpt @@ -27,4 +27,5 @@ array(1) { exec("DROP TABLE gh8576"); +unset($dbh); ?> diff --git a/ext/pdo_firebird/tests/rowCount.phpt b/ext/pdo_firebird/tests/rowCount.phpt index a2efc6edf09f2..bf3a9be0b49de 100644 --- a/ext/pdo_firebird/tests/rowCount.phpt +++ b/ext/pdo_firebird/tests/rowCount.phpt @@ -45,6 +45,7 @@ unset($dbh); exec('DROP TABLE test_rowcount'); +unset($dbh); --EXPECT-- bool(false) int(2) From 13760c2d091e8199614490c403bf66d74cae40ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 22 Oct 2023 22:25:35 +0200 Subject: [PATCH 12/14] Fix firebird? --- ext/pdo/tests/pdo_017.phpt | 2 +- ext/pdo_firebird/tests/ddl.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pdo/tests/pdo_017.phpt b/ext/pdo/tests/pdo_017.phpt index 83e3fe8ca4a8f..d24aff1c15f32 100644 --- a/ext/pdo/tests/pdo_017.phpt +++ b/ext/pdo/tests/pdo_017.phpt @@ -12,6 +12,7 @@ PDOTest::skip(); $db = PDOTest::factory(); try { $db->beginTransaction(); + $db->rollback(); } catch (PDOException $e) { die('skip no working transactions: ' . $e->getMessage()); } @@ -65,7 +66,6 @@ echo countRows('delete'); $db->commit(); echo countRows('commit'); - ?> --CLEAN-- --CLEAN-- setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); @$dbh->exec('DROP TABLE test_ddl'); @$dbh->exec('DROP GENERATOR gen_test_ddl_id'); @$dbh->exec('DROP TRIGGER test_ddl_bi'); From 298d60eabd62a72a72baef04c51d537bd1cd882f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Tue, 24 Oct 2023 21:26:03 +0200 Subject: [PATCH 13/14] Another attempt to fix Firebird + debug --- ext/pdo/tests/pdo_017.phpt | 1 + ext/pdo_dblib/tests/bug_45876.phpt | 2 +- ext/pdo_dblib/tests/bug_50755.phpt | 2 +- ext/pdo_firebird/tests/ddl.phpt | 13 +++++-------- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ext/pdo/tests/pdo_017.phpt b/ext/pdo/tests/pdo_017.phpt index d24aff1c15f32..bc514bff2c32b 100644 --- a/ext/pdo/tests/pdo_017.phpt +++ b/ext/pdo/tests/pdo_017.phpt @@ -8,6 +8,7 @@ $dir = getenv('REDIR_TEST_DIR'); if (false == $dir) die('skip no driver'); require_once $dir . 'pdo_test.inc'; PDOTest::skip(); +if (str_starts_with(getenv('PDOTEST_DSN'), "firebird")) die('xfail firebird driver does not behave as expected'); $db = PDOTest::factory(); try { diff --git a/ext/pdo_dblib/tests/bug_45876.phpt b/ext/pdo_dblib/tests/bug_45876.phpt index 0d7ab02db785d..13db577f90487 100644 --- a/ext/pdo_dblib/tests/bug_45876.phpt +++ b/ext/pdo_dblib/tests/bug_45876.phpt @@ -7,7 +7,7 @@ pdo_dblib require __DIR__ . '/config.inc'; ?> --CONFLICTS-- -pdo_dblib +all --FILE-- --CONFLICTS-- -pdo_dblib +all --FILE-- setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); +@$dbh->exec('DROP TABLE test_ddl'); +@$dbh->exec('DROP GENERATOR gen_test_ddl_id'); +@$dbh->exec('DROP TRIGGER test_ddl_bi'); $dbh->exec("CREATE TABLE test_ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)"); $dbh->exec("CREATE GENERATOR gen_test_ddl_id"); @@ -29,18 +32,12 @@ $dbh->beginTransaction(); var_dump($dbh->exec("DELETE FROM test_ddl")); $dbh->commit(); -unset($dbh); -echo "done\n"; -?> ---CLEAN-- -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); @$dbh->exec('DROP TABLE test_ddl'); @$dbh->exec('DROP GENERATOR gen_test_ddl_id'); @$dbh->exec('DROP TRIGGER test_ddl_bi'); -unset($dbh); +unset($dbh); +echo "done\n"; ?> --EXPECT-- int(1) From 191227fd783369087c1b7cfbd61fa5282426615c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sat, 28 Oct 2023 10:28:32 +0200 Subject: [PATCH 14/14] Use different notification channel names in pdo_pgsql tests --- ext/pdo_pgsql/tests/bug68199.phpt | 24 ++++++++++++------------ ext/pdo_pgsql/tests/getnotify.phpt | 26 +++++++++++++------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ext/pdo_pgsql/tests/bug68199.phpt b/ext/pdo_pgsql/tests/bug68199.phpt index 3c6e5ea962841..8801b4255d5f0 100644 --- a/ext/pdo_pgsql/tests/bug68199.phpt +++ b/ext/pdo_pgsql/tests/bug68199.phpt @@ -29,12 +29,12 @@ var_dump($pid > 0); var_dump($db->pgsqlGetNotify()); // Listen started, no notifies -$db->exec("LISTEN notifies_phpt"); +$db->exec("LISTEN channel_bug68199"); var_dump($db->pgsqlGetNotify()); // No parameters with payload, use default PDO::FETCH_NUM $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM); -$db->exec("NOTIFY notifies_phpt, 'payload'"); +$db->exec("NOTIFY channel_bug68199, 'payload'"); $notify = $db->pgsqlGetNotify(); var_dump(count($notify)); var_dump($notify[0]); @@ -43,7 +43,7 @@ var_dump($notify[2]); // No parameters with payload, use default PDO::FETCH_ASSOC $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); -$db->exec("NOTIFY notifies_phpt, 'payload'"); +$db->exec("NOTIFY channel_bug68199, 'payload'"); $notify = $db->pgsqlGetNotify(); var_dump(count($notify)); var_dump($notify['message']); @@ -51,7 +51,7 @@ var_dump($notify['pid'] == $pid); var_dump($notify['payload']); // Test PDO::FETCH_NUM as parameter with payload -$db->exec("NOTIFY notifies_phpt, 'payload'"); +$db->exec("NOTIFY channel_bug68199, 'payload'"); $notify = $db->pgsqlGetNotify(PDO::FETCH_NUM); var_dump(count($notify)); var_dump($notify[0]); @@ -59,7 +59,7 @@ var_dump($notify[1] == $pid); var_dump($notify[2]); // Test PDO::FETCH_ASSOC as parameter with payload -$db->exec("NOTIFY notifies_phpt, 'payload'"); +$db->exec("NOTIFY channel_bug68199, 'payload'"); $notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC); var_dump(count($notify)); var_dump($notify['message']); @@ -67,7 +67,7 @@ var_dump($notify['pid'] == $pid); var_dump($notify['payload']); // Test PDO::FETCH_BOTH as parameter with payload -$db->exec("NOTIFY notifies_phpt, 'payload'"); +$db->exec("NOTIFY channel_bug68199, 'payload'"); $notify = $db->pgsqlGetNotify(PDO::FETCH_BOTH); var_dump(count($notify)); var_dump($notify['message']); @@ -86,26 +86,26 @@ bool(true) bool(false) bool(false) int(3) -string(13) "notifies_phpt" +string(16) "channel_bug68199" bool(true) string(7) "payload" int(3) -string(13) "notifies_phpt" +string(16) "channel_bug68199" bool(true) string(7) "payload" int(3) -string(13) "notifies_phpt" +string(16) "channel_bug68199" bool(true) string(7) "payload" int(3) -string(13) "notifies_phpt" +string(16) "channel_bug68199" bool(true) string(7) "payload" int(6) -string(13) "notifies_phpt" +string(16) "channel_bug68199" bool(true) string(7) "payload" -string(13) "notifies_phpt" +string(16) "channel_bug68199" bool(true) string(7) "payload" bool(false) diff --git a/ext/pdo_pgsql/tests/getnotify.phpt b/ext/pdo_pgsql/tests/getnotify.phpt index bb700ee1f2c37..172fec9e6d7dc 100644 --- a/ext/pdo_pgsql/tests/getnotify.phpt +++ b/ext/pdo_pgsql/tests/getnotify.phpt @@ -23,12 +23,12 @@ var_dump($pid > 0); var_dump($db->pgsqlGetNotify()); // Listen started, no notifies -$db->exec("LISTEN notifies_phpt"); +$db->exec("LISTEN channel_getnotify"); var_dump($db->pgsqlGetNotify()); // No parameters, use default PDO::FETCH_NUM $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM); -$db->exec("NOTIFY notifies_phpt"); +$db->exec("NOTIFY channel_getnotify"); $notify = $db->pgsqlGetNotify(); var_dump(count($notify)); var_dump($notify[0]); @@ -36,28 +36,28 @@ var_dump($notify[1] == $pid); // No parameters, use default PDO::FETCH_ASSOC $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); -$db->exec("NOTIFY notifies_phpt"); +$db->exec("NOTIFY channel_getnotify"); $notify = $db->pgsqlGetNotify(); var_dump(count($notify)); var_dump($notify['message']); var_dump($notify['pid'] == $pid); // Test PDO::FETCH_NUM as parameter -$db->exec("NOTIFY notifies_phpt"); +$db->exec("NOTIFY channel_getnotify"); $notify = $db->pgsqlGetNotify(PDO::FETCH_NUM); var_dump(count($notify)); var_dump($notify[0]); var_dump($notify[1] == $pid); // Test PDO::FETCH_ASSOC as parameter -$db->exec("NOTIFY notifies_phpt"); +$db->exec("NOTIFY channel_getnotify"); $notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC); var_dump(count($notify)); var_dump($notify['message']); var_dump($notify['pid'] == $pid); // Test PDO::FETCH_BOTH as parameter -$db->exec("NOTIFY notifies_phpt"); +$db->exec("NOTIFY channel_getnotify"); $notify = $db->pgsqlGetNotify(PDO::FETCH_BOTH); var_dump(count($notify)); var_dump($notify['message']); @@ -77,7 +77,7 @@ var_dump($diff >= 1 || 1 - abs($diff) < .05); var_dump($notify); // Test second parameter, should return immediately because a notify is queued -$db->exec("NOTIFY notifies_phpt"); +$db->exec("NOTIFY channel_getnotify"); $t = microtime(1); $notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 5000); $diff = microtime(1) - $t; @@ -90,21 +90,21 @@ bool(true) bool(false) bool(false) int(2) -string(13) "notifies_phpt" +string(17) "channel_getnotify" bool(true) int(2) -string(13) "notifies_phpt" +string(17) "channel_getnotify" bool(true) int(2) -string(13) "notifies_phpt" +string(17) "channel_getnotify" bool(true) int(2) -string(13) "notifies_phpt" +string(17) "channel_getnotify" bool(true) int(4) -string(13) "notifies_phpt" +string(17) "channel_getnotify" bool(true) -string(13) "notifies_phpt" +string(17) "channel_getnotify" bool(true) bool(false) bool(true)