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