xref: /PHP-8.3/ext/oci8/tests/conn_attr_3.phpt (revision a53e5617)
1--TEST--
2Set and get of connection attributes with oci_close().
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7if (getenv('SKIP_REPEAT')) die('skip fails with repeat');
8require_once 'skipifconnectfailure.inc';
9$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
10require __DIR__.'/skipif.inc';
11
12if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
13if ($test_drcp) die("skip output might vary with DRCP");
14
15preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
16if (!(isset($matches[0]) && $matches[1] >= 10)) {
17    die("skip expected output only valid when using Oracle 10g or greater database server");
18}
19?>
20--FILE--
21<?php
22
23$testuser     = 'testuser_attr_3';  // Used in conn_attr.inc
24$testpassword = 'testuser';
25
26require __DIR__."/conn_attr.inc";
27
28echo"**Test Set and get values for  the attributes with oci_close() ************\n";
29// With oci_connect ,oci_pconnect ,oci_new_connect
30
31var_dump($conn1 = get_conn(1)); //oci_connect()
32set_attr($conn1,'ACTION',1);
33get_attr($conn1,'ACTION');
34oci_close($conn1);
35
36// Open another connect and verify the value.
37var_dump($conn1 = get_conn(1)); //oci_connect()
38get_attr($conn1,'ACTION');
39oci_close($conn1);
40
41var_dump($pconn1 = get_conn(2)); //oci_pconnect()
42set_attr($pconn1,'MODULE',2);
43get_attr($pconn1,'MODULE');
44oci_close($pconn1);
45
46// Open another connect and verify the value.
47var_dump($pconn1 = get_conn(2)); //oci_pconnect()
48get_attr($pconn1,'MODULE');
49oci_close($pconn1);
50
51var_dump($nconn1 = get_conn(3)); //oci_new_connect()
52set_attr($nconn1,'CLIENT_INFO',3);
53set_attr($nconn1,'CLIENT_IDENTIFIER',3);
54get_attr($nconn1,'CLIENT_INFO');
55get_attr($nconn1,'CLIENT_IDENTIFIER');
56oci_close($nconn1);
57
58// Open another connect and verify the value.
59var_dump($nconn1 = get_conn(3)); //oci_new_connect()
60get_attr($nconn1,'CLIENT_INFO');
61get_attr($nconn1,'CLIENT_IDENTIFIER');
62oci_close($nconn1);
63
64clean_up($c);
65echo "Done\n";
66
67?>
68--EXPECTF--
69**Test Set and get values for  the attributes with oci_close() ************
70Testing with oci_connect()
71resource(%d) of type (oci8 connection)
72Value of ACTION has been set successfully
73The value of ACTION is TASK1
74Testing with oci_connect()
75resource(%d) of type (oci8 connection)
76The value of ACTION is
77Testing with oci_pconnect()
78resource(%d) of type (oci8 persistent connection)
79Value of MODULE has been set successfully
80The value of MODULE is PHP TEST2
81Testing with oci_pconnect()
82resource(%d) of type (oci8 persistent connection)
83The value of MODULE is PHP TEST2
84Testing with oci_new_connect()
85resource(%d) of type (oci8 connection)
86Value of CLIENT_INFO has been set successfully
87Value of CLIENT_IDENTIFIER has been set successfully
88The value of CLIENT_INFO is INFO13
89The value of CLIENT_IDENTIFIER is ID003
90Testing with oci_new_connect()
91resource(%d) of type (oci8 connection)
92The value of CLIENT_INFO is
93The value of CLIENT_IDENTIFIER is
94Done
95