1--TEST--
2PDO_OCI: Attribute: Setting session action
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$query = 'select action from v$session where sid = sys_context(\'USERENV\', \'SID\')';
15
16$dbh = PDOTest::factory();
17
18$stmt = $dbh->query($query);
19$row = $stmt->fetch();
20echo 'ACTION NOT SET: ';
21var_dump($row['action']);
22
23var_dump($dbh->setAttribute(PDO::OCI_ATTR_ACTION, "some action"));
24
25$stmt = $dbh->query($query);
26$row = $stmt->fetch();
27echo 'ACTION SET: ';
28var_dump($row['action']);
29
30var_dump($dbh->setAttribute(PDO::OCI_ATTR_ACTION, "something else!"));
31
32$stmt = $dbh->query($query);
33$row = $stmt->fetch();
34echo 'ACTION RESET: ';
35var_dump($row['action']);
36
37var_dump($dbh->setAttribute(PDO::OCI_ATTR_ACTION, null));
38
39$stmt = $dbh->query($query);
40$row = $stmt->fetch();
41echo 'ACTION NULLED: ';
42var_dump($row['action']);
43
44echo "Done\n";
45
46?>
47--EXPECT--
48ACTION NOT SET: NULL
49bool(true)
50ACTION SET: string(11) "some action"
51bool(true)
52ACTION RESET: string(15) "something else!"
53bool(true)
54ACTION NULLED: NULL
55Done
56