1--TEST--
2odbc_free_result(): Basic test
3--SKIPIF--
4<?php include 'skipif.inc'; ?>
5--FILE--
6<?php
7
8include 'config.inc';
9
10$conn = odbc_connect($dsn, $user, $pass);
11
12odbc_exec($conn, 'CREATE DATABASE odbcTEST');
13
14odbc_exec($conn, 'CREATE TABLE FOO (TEST INT NOT NULL)');
15odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY (TEST)');
16
17odbc_exec($conn, 'INSERT INTO FOO VALUES (1)');
18odbc_exec($conn, 'INSERT INTO FOO VALUES (2)');
19
20$res = odbc_exec($conn, 'SELECT * FROM FOO');
21
22var_dump(odbc_fetch_row($res));
23var_dump(odbc_result($res, 'test'));
24var_dump(odbc_free_result($res));
25var_dump(odbc_free_result($conn));
26var_dump(odbc_free_result(NULL));
27var_dump(odbc_fetch_row($res));
28var_dump(odbc_result($res, 'test'));
29
30odbc_exec($conn, 'DROP TABLE FOO');
31
32odbc_exec($conn, 'DROP DATABASE odbcTEST');
33
34?>
35--EXPECTF--
36bool(true)
37string(1) "1"
38bool(true)
39
40Warning: odbc_free_result(): supplied resource is not a valid ODBC result resource in %s on line %d
41bool(false)
42
43Warning: odbc_free_result() expects parameter 1 to be resource, null given in %s on line %d
44NULL
45
46Warning: odbc_fetch_row(): supplied resource is not a valid ODBC result resource in %s on line %d
47bool(false)
48
49Warning: odbc_result(): supplied resource is not a valid ODBC result resource in %s on line %d
50bool(false)
51