1--TEST--
2odbc_free_result(): Basic test
3--EXTENSIONS--
4odbc
5--SKIPIF--
6<?php include 'skipif.inc'; ?>
7--FILE--
8<?php
9
10include 'config.inc';
11
12$conn = odbc_connect($dsn, $user, $pass);
13
14odbc_exec($conn, 'CREATE TABLE free_result (TEST INT NOT NULL)');
15
16odbc_exec($conn, 'INSERT INTO free_result VALUES (1), (2)');
17
18$res = odbc_exec($conn, 'SELECT * FROM free_result');
19
20try {
21    var_dump(odbc_fetch_row($res));
22} catch (Error $e) {
23    echo $e->getMessage(), "\n";
24}
25try {
26    var_dump(odbc_result($res, 'test'));
27} catch (Error $e) {
28    echo $e->getMessage(), "\n";
29}
30try {
31    var_dump(odbc_free_result($res));
32} catch (TypeError $e) {
33    echo $e->getMessage(), "\n";
34}
35try {
36    var_dump(odbc_free_result($conn));
37} catch (Error $e) {
38    echo $e->getMessage(), "\n";
39}
40try {
41    var_dump(odbc_fetch_row($res));
42} catch (Error $e) {
43    echo $e->getMessage(), "\n";
44}
45try {
46    var_dump(odbc_result($res, 'test'));
47} catch (Error $e) {
48    echo $e->getMessage(), "\n";
49}
50?>
51--CLEAN--
52<?php
53require 'config.inc';
54$conn = odbc_connect($dsn, $user, $pass);
55odbc_exec($conn, 'DROP TABLE free_result');
56?>
57--EXPECT--
58bool(true)
59string(1) "1"
60bool(true)
61odbc_free_result(): Argument #1 ($statement) must be of type Odbc\Result, Odbc\Connection given
62ODBC result has already been closed
63ODBC result has already been closed
64