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