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