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 DATABASE odbcTEST');
15
16odbc_exec($conn, 'CREATE TABLE FOO (TEST INT NOT NULL)');
17odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY (TEST)');
18
19odbc_exec($conn, 'INSERT INTO FOO VALUES (1)');
20odbc_exec($conn, 'INSERT INTO FOO VALUES (2)');
21
22$res = odbc_exec($conn, 'SELECT * FROM FOO');
23
24var_dump(odbc_fetch_row($res));
25var_dump(odbc_result($res, 'test'));
26var_dump(odbc_free_result($res));
27try {
28    var_dump(odbc_free_result($conn));
29} catch (TypeError $e) {
30    echo $e->getMessage(), "\n";
31}
32try {
33    var_dump(odbc_fetch_row($res));
34} catch (TypeError $e) {
35    echo $e->getMessage(), "\n";
36}
37try {
38    var_dump(odbc_result($res, 'test'));
39} catch (TypeError $e) {
40    echo $e->getMessage(), "\n";
41}
42?>
43--CLEAN--
44<?php
45require 'config.inc';
46$conn = odbc_connect($dsn, $user, $pass);
47odbc_exec($conn, 'DROP TABLE FOO');
48odbc_exec($conn, 'DROP DATABASE odbcTEST');
49?>
50--EXPECT--
51bool(true)
52string(1) "1"
53bool(true)
54odbc_free_result(): supplied resource is not a valid ODBC result resource
55odbc_fetch_row(): supplied resource is not a valid ODBC result resource
56odbc_result(): supplied resource is not a valid ODBC result resource
57