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