1--TEST--
2PDO_OCI: Attribute: Set prefetch on connection
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
18echo "Test connect\n";
19putenv('PDOTEST_ATTR='.serialize(array(PDO::ATTR_PREFETCH=>101)));
20$dbh = PDOTest::factory();
21
22echo $dbh->getAttribute(PDO::ATTR_PREFETCH), "\n";
23
24// Verify can fetch
25$s = $dbh->prepare("select dummy from dual" );
26$s->execute();
27while ($r = $s->fetch()) {
28    echo $r[0] . "\n";
29}
30
31echo "Test set 102\n";
32$dbh->setAttribute(PDO::ATTR_PREFETCH, 102);
33echo $dbh->getAttribute(PDO::ATTR_PREFETCH), "\n";
34
35// Verify can fetch
36$s = $dbh->prepare("select dummy from dual" );
37$s->execute();
38while ($r = $s->fetch()) {
39    echo $r[0] . "\n";
40}
41
42echo "Test set -1: (Uses 0)\n";
43$dbh->setAttribute(PDO::ATTR_PREFETCH, -1);
44echo $dbh->getAttribute(PDO::ATTR_PREFETCH), "\n";
45
46// Verify can fetch
47$s = $dbh->prepare("select dummy from dual" );
48$s->execute();
49while ($r = $s->fetch()) {
50    echo $r[0] . "\n";
51}
52
53echo "Test set PHP_INT_MAX: (Uses default)\n";
54$dbh->setAttribute(PDO::ATTR_PREFETCH, PHP_INT_MAX);
55echo $dbh->getAttribute(PDO::ATTR_PREFETCH), "\n";
56
57// Verify can fetch
58$s = $dbh->prepare("select dummy from dual" );
59$s->execute();
60while ($r = $s->fetch()) {
61    echo $r[0] . "\n";
62}
63
64echo "Done\n";
65
66?>
67--EXPECT--
68Test connect
69101
70X
71Test set 102
72102
73X
74Test set -1: (Uses 0)
750
76X
77Test set PHP_INT_MAX: (Uses default)
78100
79X
80Done
81