]> granicus.if.org Git - php/commitdiff
Explicitly allow NULL values for dblib compatibility
authorAdam Baratz <adambaratz@php.net>
Tue, 13 Sep 2016 17:15:06 +0000 (13:15 -0400)
committerAdam Baratz <adambaratz@php.net>
Tue, 13 Sep 2016 20:36:23 +0000 (16:36 -0400)
MSSQL won't necessarily default columns to NULL, see:
https://msdn.microsoft.com/en-us/library/ms174979.aspx

ext/pdo/tests/pdo_018.phpt
ext/pdo/tests/pdo_024.phpt

index 7f27ce36e58dfb3fa7a51365b83686cef2ed6829..d931a2c1c072b04bdeacfca7627736ba66f366bc 100644 (file)
@@ -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);
 
index 1b4f841f36e146735f17e443e52af6991b9e2831..571ea732868d83dc57cffad813a4e082bc83e2bf 100644 (file)
@@ -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;