xref: /PHP-8.4/ext/odbc/tests/odbc_close_001.phpt (revision afd91fb9)
1--TEST--
2odbc_close(): Basic test
3--EXTENSIONS--
4odbc
5--SKIPIF--
6<?php include 'skipif.inc'; ?>
7--FILE--
8<?php
9
10include 'config.inc';
11
12$conn1 = odbc_connect($dsn, $user, $pass);
13$conn2 = odbc_pconnect($dsn, $user, $pass);
14$result1 = odbc_columns($conn1, '', '', '', '');
15$result2 = odbc_columns($conn2, '', '', '', '');
16
17var_dump($conn1);
18var_dump($conn2);
19var_dump($result1);
20var_dump($result2);
21
22odbc_close($conn1);
23odbc_close($conn2);
24
25try {
26    odbc_columns($conn1, '', '', '', '');
27} catch (Error $e) {
28    echo $e->getMessage() . "\n";
29}
30
31try {
32    odbc_columns($conn2, '', '', '', '');
33} catch (Error $e) {
34    echo $e->getMessage() . "\n";
35}
36
37try {
38    odbc_num_rows($result1);
39} catch (Error $e) {
40    echo $e->getMessage() . "\n";
41}
42
43try {
44    odbc_num_rows($result2);
45} catch (Error $e) {
46    echo $e->getMessage() . "\n";
47}
48
49?>
50--EXPECTF--
51object(Odbc\Connection)#%d (%d) {
52}
53object(Odbc\Connection)#%d (%d) {
54}
55object(Odbc\Result)#%d (%d) {
56}
57object(Odbc\Result)#%d (%d) {
58}
59ODBC connection has already been closed
60ODBC connection has already been closed
61ODBC result has already been closed
62ODBC result has already been closed
63