1--TEST--
2PDO_OCI: Attribute: prefetch on statements
3--EXTENSIONS--
4pdo
5pdo_oci
6--SKIPIF--
7<?php
8require(__DIR__.'/../../pdo/tests/pdo_test.inc');
9PDOTest::skip();
10?>
11--FILE--
12<?php
13
14require(__DIR__ . '/../../pdo/tests/pdo_test.inc');
15
16$dbh = PDOTest::factory();
17
18$s = $dbh->prepare("select '' as myempty, null as mynull from dual", array(PDO::ATTR_PREFETCH => 101));
19
20echo "Test 1: Can't set prefetch after prepare\n";
21var_dump($s->setAttribute(PDO::ATTR_PREFETCH, 102));
22
23// Verify can fetch
24$s = $dbh->prepare("select dummy from dual" );
25$s->execute();
26while ($r = $s->fetch()) {
27    echo $r[0] . "\n";
28}
29
30echo "Test 2: Turn off prefetching\n";
31$s = $dbh->prepare("select '' as myempty, null as mynull from dual", array(PDO::ATTR_PREFETCH => 0));
32$s = $dbh->prepare("select dummy from dual" );
33$s->execute();
34while ($r = $s->fetch()) {
35    echo $r[0] . "\n";
36}
37
38echo "Done\n";
39
40?>
41--EXPECTF--
42Test 1: Can't set prefetch after prepare
43
44Warning: PDOStatement::setAttribute(): SQLSTATE[IM001]: Driver does not support this function: This driver doesn't support setting attributes in %s on line %d
45bool(false)
46X
47Test 2: Turn off prefetching
48X
49Done
50