diff options
author | Adam Baratz <adambaratz@php.net> | 2016-09-13 16:38:56 -0400 |
---|---|---|
committer | Adam Baratz <adambaratz@php.net> | 2016-09-13 16:38:56 -0400 |
commit | 45850213bd1c924e83e4b291bc475788762e103b (patch) | |
tree | c4ccc5cd466181898b059d20deababbd431fa84d /ext | |
parent | c02ff02953d6e6b1910ea7aac2f0a6a52057f734 (diff) | |
parent | 9fb94f03e7b5a3655ae87c819638e3137b729004 (diff) | |
download | php-git-45850213bd1c924e83e4b291bc475788762e103b.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
Explicitly allow NULL values for dblib compatibility
Add dblib-specific query
Remove test cases don't test distinct behavior
Diffstat (limited to 'ext')
-rw-r--r-- | ext/pdo/tests/bug_38253.phpt | 13 | ||||
-rw-r--r-- | ext/pdo/tests/bug_65946.phpt | 23 | ||||
-rw-r--r-- | ext/pdo/tests/pdo_018.phpt | 2 | ||||
-rw-r--r-- | ext/pdo/tests/pdo_024.phpt | 2 |
4 files changed, 19 insertions, 21 deletions
diff --git a/ext/pdo/tests/bug_38253.phpt b/ext/pdo/tests/bug_38253.phpt index e749970a5f..78519a0805 100644 --- a/ext/pdo/tests/bug_38253.phpt +++ b/ext/pdo/tests/bug_38253.phpt @@ -22,19 +22,8 @@ $stmt = $pdo->prepare ("SELECT * FROM test"); $stmt->execute(); var_dump($stmt->fetchAll()); -if ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { - $type = "clob"; -} else if ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') { - $type = 'BLOB SUB_TYPE TEXT'; -} else { - $type = "text"; -} - -$pdo->exec ("create table test2 (id integer primary key, n $type)"); -$pdo->exec ("INSERT INTO test2 (id, n) VALUES (1,'hi')"); - $pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_FUNC); -$stmt = $pdo->prepare ("SELECT * FROM test2"); +$stmt = $pdo->prepare ("SELECT * FROM test"); $stmt->execute(); var_dump($stmt->fetchAll()); diff --git a/ext/pdo/tests/bug_65946.phpt b/ext/pdo/tests/bug_65946.phpt index 13a622ecb8..c636db5204 100644 --- a/ext/pdo/tests/bug_65946.phpt +++ b/ext/pdo/tests/bug_65946.phpt @@ -16,13 +16,22 @@ $db = PDOTest::factory(); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $db->exec('CREATE TABLE test(id int)'); $db->exec('INSERT INTO test VALUES(1)'); -if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') { - $sql = 'SELECT FIRST :limit * FROM test'; -} else if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == '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)"; -} else { - $sql = 'SELECT * FROM test LIMIT :limit'; +switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { + case 'dblib': + // if :limit is used, the value will be quoted as '1', which is invalid syntax + // this is a bug, to be addressed separately from adding these tests to pdo_dblib + $sql = 'SELECT TOP 1 * FROM test'; + break; + case 'firebird': + $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)"; + break; + default: + $sql = 'SELECT * FROM test LIMIT :limit'; + break; } $stmt = $db->prepare($sql); $stmt->bindValue('limit', 1, PDO::PARAM_INT); diff --git a/ext/pdo/tests/pdo_018.phpt b/ext/pdo/tests/pdo_018.phpt index 7f27ce36e5..d931a2c1c0 100644 --- a/ext/pdo/tests/pdo_018.phpt +++ b/ext/pdo/tests/pdo_018.phpt @@ -71,7 +71,7 @@ $db->exec('CREATE TABLE classtypes(id int NOT NULL PRIMARY KEY, name VARCHAR(20) $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 test(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(255))'); +$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, classtype int NULL, val VARCHAR(255) NULL)'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); diff --git a/ext/pdo/tests/pdo_024.phpt b/ext/pdo/tests/pdo_024.phpt index 1b4f841f36..571ea73286 100644 --- a/ext/pdo/tests/pdo_024.phpt +++ b/ext/pdo/tests/pdo_024.phpt @@ -14,7 +14,7 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE_ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); -$db->exec('create table test (id int, name varchar(10))'); +$db->exec('create table test (id int, name varchar(10) null)'); $stmt = $db->prepare('insert into test (id, name) values(0, :name)'); $name = NULL; |