Annotation of embedaddon/php/ext/pdo/tests/pdo_004.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: PDO Common: PDO::FETCH_OBJ
! 3: --SKIPIF--
! 4: <?php # vim:ft=php
! 5: if (!extension_loaded('pdo')) die('skip');
! 6: $dir = getenv('REDIR_TEST_DIR');
! 7: if (false == $dir) die('skip no driver');
! 8: require_once $dir . 'pdo_test.inc';
! 9: PDOTest::skip();
! 10: ?>
! 11: --FILE--
! 12: <?php
! 13: if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
! 14: require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
! 15: $db = PDOTest::factory();
! 16:
! 17: $db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))');
! 18: $db->exec("INSERT INTO test VALUES(1, 'A')");
! 19: $db->exec("INSERT INTO test VALUES(2, 'B')");
! 20: $db->exec("INSERT INTO test VALUES(3, 'C')");
! 21:
! 22: $stmt = $db->prepare('SELECT * from test');
! 23: $stmt->execute();
! 24:
! 25: var_dump($stmt->fetchAll(PDO::FETCH_OBJ));
! 26: ?>
! 27: --EXPECTF--
! 28: array(3) {
! 29: [0]=>
! 30: object(stdClass)#%d (2) {
! 31: ["id"]=>
! 32: string(1) "1"
! 33: ["val"]=>
! 34: string(1) "A"
! 35: }
! 36: [1]=>
! 37: object(stdClass)#%d (2) {
! 38: ["id"]=>
! 39: string(1) "2"
! 40: ["val"]=>
! 41: string(1) "B"
! 42: }
! 43: [2]=>
! 44: object(stdClass)#%d (2) {
! 45: ["id"]=>
! 46: string(1) "3"
! 47: ["val"]=>
! 48: string(1) "C"
! 49: }
! 50: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>