1--TEST-- 2PDO_mysql connect through PDO::connect 3--EXTENSIONS-- 4PDO_odbc 5--SKIPIF-- 6<?php 7require 'ext/pdo/tests/pdo_test.inc'; 8PDOTest::skip(); 9?> 10--FILE-- 11<?php 12 13require 'ext/pdo/tests/pdo_test.inc'; 14$config = PDOTest::get_config(__DIR__ . "/common.phpt"); 15$db = Pdo\Odbc::connect($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'], $config['ENV']['PDOTEST_PASS']); 16if (!$db instanceof Pdo\Odbc) { 17 echo "Wrong class type. Should be Pdo\Odbc but is " . get_class($db) . "\n"; 18} 19 20$db->exec('CREATE TABLE pdoodbc_002(id INT NOT NULL PRIMARY KEY, name VARCHAR(10))'); 21$db->exec("INSERT INTO pdoodbc_002 VALUES(1, 'A'), (2, 'B'), (3, 'C')"); 22 23foreach ($db->query('SELECT name FROM pdoodbc_002') as $row) { 24 var_dump($row); 25} 26 27echo "Fin."; 28?> 29--CLEAN-- 30<?php 31require 'ext/pdo/tests/pdo_test.inc'; 32$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); 33$db->exec("DROP TABLE IF EXISTS pdoodbc_002"); 34?> 35--EXPECT-- 36array(2) { 37 ["name"]=> 38 string(1) "A" 39 [0]=> 40 string(1) "A" 41} 42array(2) { 43 ["name"]=> 44 string(1) "B" 45 [0]=> 46 string(1) "B" 47} 48array(2) { 49 ["name"]=> 50 string(1) "C" 51 [0]=> 52 string(1) "C" 53} 54Fin. 55