1--TEST--
2PDO_OCI: Attribute: Set prefetch on connection
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
6require(__DIR__.'/../../pdo/tests/pdo_test.inc');
7PDOTest::skip();
8?>
9--FILE--
10<?php
11
12require(__DIR__ . '/../../pdo/tests/pdo_test.inc');
13
14$dbh = PDOTest::factory();
15
16echo "Test connect\n";
17putenv('PDOTEST_ATTR='.serialize(array(PDO::ATTR_PREFETCH=>101)));
18$dbh = PDOTest::factory();
19
20echo $dbh->getAttribute(PDO::ATTR_PREFETCH), "\n";
21
22// Verify can fetch
23$s = $dbh->prepare("select dummy from dual" );
24$s->execute();
25while ($r = $s->fetch()) {
26    echo $r[0] . "\n";
27}
28
29echo "Test set 102\n";
30$dbh->setAttribute(PDO::ATTR_PREFETCH, 102);
31echo $dbh->getAttribute(PDO::ATTR_PREFETCH), "\n";
32
33// Verify can fetch
34$s = $dbh->prepare("select dummy from dual" );
35$s->execute();
36while ($r = $s->fetch()) {
37    echo $r[0] . "\n";
38}
39
40echo "Test set -1: (Uses 0)\n";
41$dbh->setAttribute(PDO::ATTR_PREFETCH, -1);
42echo $dbh->getAttribute(PDO::ATTR_PREFETCH), "\n";
43
44// Verify can fetch
45$s = $dbh->prepare("select dummy from dual" );
46$s->execute();
47while ($r = $s->fetch()) {
48    echo $r[0] . "\n";
49}
50
51echo "Test set PHP_INT_MAX: (Uses default)\n";
52$dbh->setAttribute(PDO::ATTR_PREFETCH, PHP_INT_MAX);
53echo $dbh->getAttribute(PDO::ATTR_PREFETCH), "\n";
54
55// Verify can fetch
56$s = $dbh->prepare("select dummy from dual" );
57$s->execute();
58while ($r = $s->fetch()) {
59    echo $r[0] . "\n";
60}
61
62echo "Done\n";
63
64?>
65--EXPECT--
66Test connect
67101
68X
69Test set 102
70102
71X
72Test set -1: (Uses 0)
730
74X
75Test set PHP_INT_MAX: (Uses default)
76100
77X
78Done
79