summaryrefslogtreecommitdiff
path: root/ext/odbc/tests/odbc_free_result_001.phpt
blob: 970450141375bfcb9677ad2d8c64a99d592693af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--TEST--
odbc_free_result(): Basic test
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php

include 'config.inc';

$conn = odbc_connect($dsn, $user, $pass);

odbc_exec($conn, 'CREATE DATABASE odbcTEST');

odbc_exec($conn, 'CREATE TABLE FOO (TEST INT)');
odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY (TEST)');

odbc_exec($conn, 'INSERT INTO FOO VALUES (1)');
odbc_exec($conn, 'INSERT INTO FOO VALUES (2)');

$res = odbc_exec($conn, 'SELECT * FROM FOO');

var_dump(odbc_fetch_row($res));
var_dump(odbc_result($res, 'test'));
var_dump(odbc_free_result($res));
var_dump(odbc_free_result($conn));
var_dump(odbc_free_result(NULL));
var_dump(odbc_fetch_row($res));
var_dump(odbc_result($res, 'test'));

odbc_exec($conn, 'DROP TABLE FOO');

odbc_exec($conn, 'DROP DATABASE odbcTEST');

?>
--EXPECTF--
bool(true)
string(1) "1"
bool(true)

Warning: odbc_free_result(): supplied resource is not a valid ODBC result resource in %s on line %d
bool(false)

Warning: odbc_free_result() expects parameter 1 to be resource, null given in %s on line %d
NULL

Warning: odbc_fetch_row(): %d is not a valid ODBC result resource in %s on line %d
bool(false)

Warning: odbc_result(): %d is not a valid ODBC result resource in %s on line %d
bool(false)