xref: /PHP-8.3/ext/pdo/tests/pdo_027.phpt (revision 74859783)
1--TEST--
2PDO Common: PDO::FETCH_LAZY
3--EXTENSIONS--
4pdo
5--SKIPIF--
6<?php
7$dir = getenv('REDIR_TEST_DIR');
8if (false == $dir) die('skip no driver');
9require_once $dir . 'pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/');
15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
16$db = PDOTest::factory();
17
18$db->exec('create table test (id int, name varchar(10))');
19$db->exec("INSERT INTO test (id,name) VALUES(1,'test1')");
20$db->exec("INSERT INTO test (id,name) VALUES(2,'test2')");
21
22foreach ($db->query("SELECT * FROM test", PDO::FETCH_LAZY) as $v) {
23    echo "lazy: " . $v->id.$v->name."\n";
24}
25echo "End\n";
26?>
27--EXPECT--
28lazy: 1test1
29lazy: 2test2
30End
31