2009-05-14 09:28:58 +08:00
|
|
|
--TEST--
|
|
|
|
odbc_free_result(): Basic test
|
2021-06-11 20:33:54 +08:00
|
|
|
--EXTENSIONS--
|
|
|
|
odbc
|
2009-05-14 09:28:58 +08:00
|
|
|
--SKIPIF--
|
|
|
|
<?php include 'skipif.inc'; ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
include 'config.inc';
|
|
|
|
|
|
|
|
$conn = odbc_connect($dsn, $user, $pass);
|
|
|
|
|
|
|
|
odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
|
|
|
|
2015-04-02 20:22:56 +08:00
|
|
|
odbc_exec($conn, 'CREATE TABLE FOO (TEST INT NOT NULL)');
|
2014-07-30 10:28:31 +08:00
|
|
|
odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY (TEST)');
|
2009-05-14 09:28:58 +08:00
|
|
|
|
|
|
|
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));
|
2019-05-31 17:51:54 +08:00
|
|
|
try {
|
|
|
|
var_dump(odbc_free_result($conn));
|
|
|
|
} catch (TypeError $e) {
|
|
|
|
echo $e->getMessage(), "\n";
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
var_dump(odbc_fetch_row($res));
|
|
|
|
} catch (TypeError $e) {
|
|
|
|
echo $e->getMessage(), "\n";
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
var_dump(odbc_result($res, 'test'));
|
|
|
|
} catch (TypeError $e) {
|
|
|
|
echo $e->getMessage(), "\n";
|
|
|
|
}
|
2022-01-05 23:45:36 +08:00
|
|
|
?>
|
|
|
|
--CLEAN--
|
|
|
|
<?php
|
|
|
|
require 'config.inc';
|
|
|
|
$conn = odbc_connect($dsn, $user, $pass);
|
2009-05-14 09:28:58 +08:00
|
|
|
odbc_exec($conn, 'DROP TABLE FOO');
|
|
|
|
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
|
|
|
?>
|
2020-06-30 03:31:44 +08:00
|
|
|
--EXPECT--
|
2009-05-14 09:28:58 +08:00
|
|
|
bool(true)
|
|
|
|
string(1) "1"
|
|
|
|
bool(true)
|
2019-05-31 17:51:54 +08:00
|
|
|
odbc_free_result(): supplied resource is not a valid ODBC result resource
|
|
|
|
odbc_fetch_row(): supplied resource is not a valid ODBC result resource
|
|
|
|
odbc_result(): supplied resource is not a valid ODBC result resource
|