1--TEST--
2PDO_OCI: Attribute: Setting session client info
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 client_info 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 'CLIENT_INFO NOT SET: ';
21var_dump($row['client_info']);
22
23var_dump($dbh->setAttribute(PDO::OCI_ATTR_CLIENT_INFO, "some client info"));
24
25$stmt = $dbh->query($query);
26$row = $stmt->fetch();
27echo 'CLIENT_INFO SET: ';
28var_dump($row['client_info']);
29
30var_dump($dbh->setAttribute(PDO::OCI_ATTR_CLIENT_INFO, "something else!"));
31
32$stmt = $dbh->query($query);
33$row = $stmt->fetch();
34echo 'CLIENT_INFO RESET: ';
35var_dump($row['client_info']);
36
37var_dump($dbh->setAttribute(PDO::OCI_ATTR_CLIENT_INFO, null));
38
39$stmt = $dbh->query($query);
40$row = $stmt->fetch();
41echo 'CLIENT_INFO NULLED: ';
42var_dump($row['client_info']);
43
44echo "Done\n";
45
46?>
47--EXPECT--
48CLIENT_INFO NOT SET: NULL
49bool(true)
50CLIENT_INFO SET: string(16) "some client info"
51bool(true)
52CLIENT_INFO RESET: string(15) "something else!"
53bool(true)
54CLIENT_INFO NULLED: NULL
55Done
56