1--TEST-- 2PDO ODBC auto commit mode 3--EXTENSIONS-- 4pdo_odbc 5--SKIPIF-- 6<?php 7require 'ext/pdo/tests/pdo_test.inc'; 8PDOTest::skip(); 9?> 10--XLEAK-- 11A bug in msodbcsql causes a memory leak when reconnecting after closing. See GH-12306 12--FILE-- 13<?php 14require 'ext/pdo/tests/pdo_test.inc'; 15 16$table = 'autocommit_pdo_odbc'; 17 18$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); 19$db->exec("CREATE TABLE {$table} (id INT, name VARCHAR(255))"); 20unset($db); 21 22$db = new PDO(getenv('PDOTEST_DSN'), getenv('PDOTEST_USER'), getenv('PDOTEST_PASS'), [ 23 PDO::ATTR_AUTOCOMMIT => 0, 24]); 25 26$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1); 27$db->query("INSERT INTO {$table} (id, name) VALUES (1, 'test')"); 28unset($db); 29 30$db = new PDO(getenv('PDOTEST_DSN'), getenv('PDOTEST_USER'), getenv('PDOTEST_PASS')); 31 32$r = $db->query("SELECT * FROM {$table}"); 33var_dump($r->fetchAll(PDO::FETCH_ASSOC)); 34 35echo "done!"; 36?> 37--CLEAN-- 38<?php 39require 'ext/pdo/tests/pdo_test.inc'; 40$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); 41$db->exec("DROP TABLE IF EXISTS autocommit_pdo_odbc"); 42?> 43--EXPECT-- 44array(1) { 45 [0]=> 46 array(2) { 47 ["id"]=> 48 string(1) "1" 49 ["name"]=> 50 string(4) "test" 51 } 52} 53done! 54