mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
Improve and fix ext/odbc tests
Some test failures are fixed, parallelization is enabled, section order is fixed.
This commit is contained in:
parent
985511e968
commit
8726ae0601
@ -1 +0,0 @@
|
||||
odbc
|
@ -3,7 +3,13 @@ Bug #44618 (Fetching may rely on uninitialized data)
|
||||
--EXTENSIONS--
|
||||
odbc
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
|
||||
if (ODBC_TYPE === "unixODBC") {
|
||||
die("skip Fails with unixODBC");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__ . "/config.inc";
|
||||
|
@ -9,13 +9,13 @@ odbc
|
||||
|
||||
include __DIR__ . "/config.inc";
|
||||
|
||||
$create_table = "CREATE TABLE FOO(
|
||||
$create_table = "CREATE TABLE bug47803(
|
||||
[PAR_ID] [int] NOT NULL,
|
||||
[PAR_INT] [int] NULL,
|
||||
[PAR_CHR] [varchar](500) NULL
|
||||
)";
|
||||
|
||||
$inserts = "INSERT INTO FOO
|
||||
$inserts = "INSERT INTO bug47803
|
||||
([PAR_ID]
|
||||
,[PAR_INT]
|
||||
,[PAR_CHR])
|
||||
@ -37,7 +37,6 @@ date_default_timezone_set('Europe/Warsaw');
|
||||
|
||||
$link = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($link, 'CREATE DATABASE odbcTEST');
|
||||
odbc_exec($link, $create_table);
|
||||
odbc_exec($link, $inserts);
|
||||
|
||||
@ -53,7 +52,7 @@ $upd_params = array(
|
||||
array('id'=>7, 'name'=>'test 7'),
|
||||
array('id'=>6, 'name'=>'test 6'),
|
||||
);
|
||||
$sql = "UPDATE FOO
|
||||
$sql = "UPDATE bug47803
|
||||
SET [PAR_CHR] = ?
|
||||
WHERE [PAR_ID] = ?";
|
||||
$result = odbc_prepare($link, $sql);
|
||||
@ -69,7 +68,7 @@ foreach ($upd_params as &$k) {
|
||||
}
|
||||
odbc_free_result($result);
|
||||
|
||||
$sql = "SELECT * FROM FOO WHERE [PAR_ID] = ?";
|
||||
$sql = "SELECT * FROM bug47803 WHERE [PAR_ID] = ?";
|
||||
$result = odbc_prepare($link, $sql);
|
||||
if (!$result) {
|
||||
print ('[sql] prep: '.$sql);
|
||||
@ -89,6 +88,17 @@ out:
|
||||
if ($result) odbc_free_result($result);
|
||||
odbc_close($link);
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE bug47803');
|
||||
|
||||
odbc_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
@ -171,15 +181,3 @@ array(3) {
|
||||
["PAR_CHR"]=>
|
||||
string(6) "test 7"
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
|
||||
odbc_close($conn);
|
||||
|
||||
?>
|
||||
|
@ -2,12 +2,23 @@
|
||||
odbc_exec(): Getting accurate unicode data from query
|
||||
--EXTENSIONS--
|
||||
odbc
|
||||
mbstring
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
<?php
|
||||
if ("unixODBC" != ODBC_TYPE) {
|
||||
die("skip ODBC_TYPE != unixODBC");
|
||||
include 'skipif.inc';
|
||||
if ("unixODBC" != ODBC_TYPE) {
|
||||
die("skip ODBC_TYPE != unixODBC");
|
||||
}
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
$result = @odbc_exec($conn, "SELECT @@Version");
|
||||
if ($result) {
|
||||
$array = odbc_fetch_array($result);
|
||||
$info = (string) reset($array);
|
||||
if (str_contains($info, "Microsoft SQL Server")) {
|
||||
echo "skip Doesn't work with MS SQL";
|
||||
}
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@ -23,14 +34,12 @@ ini_set("odbc.defaultlrl", 4); // Set artificially low
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE DATABASE odbcTEST ENCODING=\'EUC_JP\'');
|
||||
odbc_exec($conn, 'CREATE DATABASE bug60616Test ENCODING=\'EUC_JP\'');
|
||||
odbc_exec($conn, 'USE bug60616Test');
|
||||
odbc_exec($conn, 'CREATE TABLE bug60616 (ID INT, CHAR_COL CHAR(200), VARCHAR_COL VARCHAR(200), TEXT_COL TEXT)');
|
||||
odbc_exec($conn, "INSERT INTO bug60616(ID, CHAR_COL, VARCHAR_COL, TEXT_COL) VALUES (1, '$euc_jp', '$euc_jp', '$euc_jp'), (2, '$ascii', '$ascii', '$ascii')");
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (ID INT, CHAR_COL CHAR(200), VARCHAR_COL VARCHAR(200), TEXT_COL TEXT)');
|
||||
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, CHAR_COL, VARCHAR_COL, TEXT_COL) VALUES (1, '$euc_jp', '$euc_jp', '$euc_jp')");
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, CHAR_COL, VARCHAR_COL, TEXT_COL) VALUES (2, '$ascii', '$ascii', '$ascii')");
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC');
|
||||
$res = odbc_exec($conn, 'SELECT * FROM bug60616 ORDER BY ID ASC');
|
||||
|
||||
while(odbc_fetch_row($res)) {
|
||||
$char_col = odbc_result($res, "CHAR_COL");
|
||||
@ -61,16 +70,17 @@ while(odbc_fetch_row($res)) {
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
EUC-JP matched
|
||||
ASCII matched
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
|
||||
odbc_exec($conn, 'USE bug60616Test');
|
||||
odbc_exec($conn, 'DROP TABLE bug60616');
|
||||
odbc_exec($conn, 'DROP DATABASE bug60616Test');
|
||||
?>
|
||||
--EXPECT--
|
||||
EUC-JP matched
|
||||
ASCII matched
|
||||
|
||||
|
@ -14,14 +14,11 @@ $id_2_date = '2014-09-24';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'CREATE TABLE bug68087 (ID INT, VARCHAR_COL VARCHAR(100), DATE_COL DATE)');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL VARCHAR(100), DATE_COL DATE)');
|
||||
odbc_exec($conn, "INSERT INTO bug68087(ID, VARCHAR_COL, DATE_COL) VALUES (1, 'hello', '$id_1_date'), (2, 'helloagain', '$id_2_date')");
|
||||
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (1, 'hello', '$id_1_date')");
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (2, 'helloagain', '$id_2_date')");
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC');
|
||||
$res = odbc_exec($conn, 'SELECT * FROM bug68087 ORDER BY ID ASC');
|
||||
|
||||
while(odbc_fetch_row($res)) {
|
||||
$id = odbc_result($res, "ID");
|
||||
@ -44,16 +41,15 @@ while(odbc_fetch_row($res)) {
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Date_1 matched
|
||||
Date_2 matched
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'DROP TABLE bug68087');
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Date_1 matched
|
||||
Date_2 matched
|
||||
|
@ -11,13 +11,11 @@ include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'CREATE TABLE bug69354 (ID INT, VARCHAR_COL VARCHAR(100))');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL VARCHAR(100))');
|
||||
odbc_exec($conn, "INSERT INTO bug69354(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a", 100) . "')");
|
||||
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a", 100) . "')");
|
||||
|
||||
$res = odbc_exec($conn,"select VARCHAR_COL from FOO");
|
||||
$res = odbc_exec($conn,"SELECT VARCHAR_COL FROM bug69354");
|
||||
if ($res) {
|
||||
if (odbc_fetch_row($res)) {
|
||||
$ret = odbc_result($res,'varchar_col');
|
||||
@ -27,17 +25,16 @@ if ($res) {
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
100
|
||||
a
|
||||
a
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'DROP TABLE bug69354');
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
100
|
||||
a
|
||||
a
|
||||
|
@ -9,26 +9,25 @@ odbc
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL NVARCHAR(MAX))');
|
||||
odbc_exec($conn, "INSERT INTO FOO VALUES (1, 'foo')");
|
||||
odbc_exec($conn, 'CREATE TABLE bug69975 (ID INT, VARCHAR_COL NVARCHAR(MAX))');
|
||||
odbc_exec($conn, "INSERT INTO bug69975 VALUES (1, 'foo')");
|
||||
|
||||
$result = odbc_exec($conn, "SELECT VARCHAR_COL FROM FOO");
|
||||
$result = odbc_exec($conn, "SELECT VARCHAR_COL FROM bug69975");
|
||||
var_dump(odbc_fetch_array($result));
|
||||
|
||||
echo "ready";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, 'DROP TABLE bug69975');
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["VARCHAR_COL"]=>
|
||||
string(3) "foo"
|
||||
}
|
||||
ready
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
?>
|
||||
|
@ -11,33 +11,30 @@ include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'CREATE TABLE bug71171 (ID INT, VARCHAR_COL NVARCHAR(40))');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL NVARCHAR(40))');
|
||||
odbc_exec($conn, "INSERT INTO bug71171(ID, VARCHAR_COL) VALUES (1, '" . chr(0x81) . "')");
|
||||
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . chr(0x81) . "')");
|
||||
|
||||
$res = odbc_exec($conn,"SELECT ID FROM FOO WHERE VARCHAR_COL = '" . chr(0x81) . "'");
|
||||
$res = odbc_exec($conn,"SELECT ID FROM bug71171 WHERE VARCHAR_COL = '" . chr(0x81) . "'");
|
||||
if ($res) {
|
||||
while($record = odbc_fetch_array($res)) var_dump($record);
|
||||
}
|
||||
|
||||
odbc_close($conn);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'DROP TABLE bug71171');
|
||||
|
||||
odbc_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ Bug #73448 odbc_errormsg returns trash, always 513 bytes
|
||||
odbc
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--CONFLICTS--
|
||||
odbc
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -13,8 +13,7 @@ $conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_do($conn, "CREATE TABLE bug73725(i int, txt varchar(max), k int)");
|
||||
|
||||
odbc_do($conn, "INSERT INTO bug73725 VALUES(101,'Any text', 33)");
|
||||
odbc_do($conn, "INSERT INTO bug73725 VALUES(102,'Müsliriegel', 34)");
|
||||
odbc_do($conn, "INSERT INTO bug73725 VALUES(101,'Any text', 33), (102,'Lorem ipsum dolor', 34)");
|
||||
|
||||
$rc = odbc_do($conn, "SELECT i, txt, k FROM bug73725");
|
||||
|
||||
@ -24,6 +23,17 @@ var_dump($r);
|
||||
$r = odbc_fetch_array($rc);
|
||||
var_dump($r);
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE bug73725');
|
||||
|
||||
odbc_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
@ -38,18 +48,7 @@ array(3) {
|
||||
["i"]=>
|
||||
string(3) "102"
|
||||
["txt"]=>
|
||||
string(12) "Müsliriegel"
|
||||
string(17) "Lorem ipsum dolor"
|
||||
["k"]=>
|
||||
string(2) "34"
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE bug73725');
|
||||
|
||||
odbc_close($conn);
|
||||
|
||||
?>
|
||||
|
@ -4,6 +4,8 @@ odbc_columns(): Basic test
|
||||
odbc
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--CONFLICTS--
|
||||
odbc
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -13,6 +15,7 @@ $conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
var_dump($result = odbc_columns($conn, '', '', '', ''));
|
||||
var_dump(odbc_fetch_row($result));
|
||||
odbc_free_result($result);
|
||||
|
||||
var_dump($result = odbc_columns($conn));
|
||||
var_dump(odbc_fetch_row($result));
|
||||
@ -24,7 +27,13 @@ var_dump(odbc_free_result($result));
|
||||
|
||||
var_dump($result = odbc_columns($conn, 'FOO', 'FOO', 'FOO', 'FOO'));
|
||||
var_dump(odbc_fetch_row($result));
|
||||
odbc_free_result($result);
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (odbc result)
|
||||
|
@ -4,10 +4,10 @@ odbc_data_source(): Basic test
|
||||
odbc
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
if (odbc_data_source($conn, SQL_FETCH_FIRST) === NULL) {
|
||||
die("skip no data sources defined on this system");
|
||||
}
|
||||
include 'skipif.inc';
|
||||
if (odbc_data_source($conn, SQL_FETCH_FIRST) === NULL) {
|
||||
die("skip no data sources defined on this system");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -3,11 +3,11 @@ odbc_exec(): Basic test
|
||||
--EXTENSIONS--
|
||||
odbc
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
<?php
|
||||
if ("unixODBC" != ODBC_TYPE) {
|
||||
die("skip ODBC_TYPE != unixODBC");
|
||||
}
|
||||
include 'skipif.inc';
|
||||
if ("unixODBC" != ODBC_TYPE) {
|
||||
die("skip ODBC_TYPE != unixODBC");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@ -16,32 +16,14 @@ include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'foo', 'bar');
|
||||
odbc_exec($conn, 'foo');
|
||||
|
||||
odbc_exec($conn, '', '');
|
||||
odbc_exec($conn, '');
|
||||
|
||||
odbc_exec($conn, 1, 1);
|
||||
odbc_exec($conn, 1);
|
||||
|
||||
odbc_exec($conn, NULL, NULL);
|
||||
odbc_exec($conn, NULL);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: odbc_exec(): Argument #3 must be of type int, string given in %s on line %d
|
||||
|
||||
Warning: odbc_exec(): SQL error: %s in %s on line %d
|
||||
|
||||
Warning: odbc_exec(): Argument #3 must be of type int, string given in %s on line %d
|
||||
|
||||
Warning: odbc_exec(): SQL error: %s in %s on line %d
|
||||
|
||||
Warning: odbc_exec(): SQL error: %s in %s on line %d
|
||||
|
||||
Warning: odbc_exec(): SQL error: %s in %s on line %d
|
||||
|
||||
Warning: odbc_exec(): SQL error: %s in %s on line %d
|
||||
|
||||
Warning: odbc_exec(): SQL error: %s in %s on line %d
|
||||
|
@ -11,14 +11,10 @@ include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'CREATE TABLE exec2 (TEST INT)');
|
||||
odbc_exec($conn, 'INSERT INTO exec2 VALUES (1), (2)');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (TEST INT)');
|
||||
|
||||
odbc_exec($conn, 'INSERT INTO FOO VALUES (1)');
|
||||
odbc_exec($conn, 'INSERT INTO FOO VALUES (2)');
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM FOO');
|
||||
$res = odbc_exec($conn, 'SELECT * FROM exec2');
|
||||
|
||||
var_dump(odbc_fetch_row($res));
|
||||
var_dump(odbc_result($res, 'test'));
|
||||
@ -28,8 +24,7 @@ var_dump(odbc_fetch_array($res));
|
||||
<?php
|
||||
require 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'DROP TABLE exec2');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
|
@ -12,15 +12,13 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE fetch_array (foo INT)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_array VALUES (1)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_array VALUES (2)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_array VALUES (3)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_array VALUES (1), (2)');
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM fetch_array');
|
||||
|
||||
var_dump(odbc_fetch_array($res, 1));
|
||||
var_dump(odbc_fetch_array($res));
|
||||
var_dump(odbc_fetch_array($res, 3));
|
||||
var_dump(odbc_fetch_array($res, 0));
|
||||
var_dump(odbc_fetch_array($res, 2));
|
||||
var_dump(odbc_fetch_array($res, 4));
|
||||
|
||||
?>
|
||||
@ -41,6 +39,6 @@ array(1) {
|
||||
}
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
string(1) "3"
|
||||
string(1) "2"
|
||||
}
|
||||
bool(false)
|
||||
|
@ -12,15 +12,10 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE fetch_into (foo INT)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_into VALUES (1)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_into VALUES (2)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_into VALUES (3)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_into VALUES (1), (2)');
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM fetch_into');
|
||||
|
||||
$arr = [];
|
||||
var_dump(odbc_fetch_into($res, $arr, 1));
|
||||
var_dump($arr);
|
||||
$arr = [];
|
||||
var_dump(odbc_fetch_into($res, $arr));
|
||||
var_dump($arr);
|
||||
@ -28,6 +23,9 @@ $arr = [];
|
||||
var_dump(odbc_fetch_into($res, $arr, 0));
|
||||
var_dump($arr);
|
||||
$arr = [];
|
||||
var_dump(odbc_fetch_into($res, $arr, 2));
|
||||
var_dump($arr);
|
||||
$arr = [];
|
||||
var_dump(odbc_fetch_into($res, $arr, 4));
|
||||
var_dump($arr);
|
||||
|
||||
@ -52,7 +50,7 @@ array(1) {
|
||||
int(1)
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "3"
|
||||
string(1) "2"
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
|
@ -12,15 +12,13 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE fetch_object (foo INT)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_object VALUES (1)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_object VALUES (2)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_object VALUES (3)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_object VALUES (1), (2)');
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM fetch_object');
|
||||
|
||||
var_dump(odbc_fetch_object($res, 1));
|
||||
var_dump(odbc_fetch_object($res));
|
||||
var_dump(odbc_fetch_object($res, 0));
|
||||
var_dump(odbc_fetch_object($res, 2));
|
||||
var_dump(odbc_fetch_object($res, 4));
|
||||
|
||||
?>
|
||||
@ -41,6 +39,6 @@ object(stdClass)#%d (%d) {
|
||||
}
|
||||
object(stdClass)#%d (%d) {
|
||||
["foo"]=>
|
||||
string(1) "3"
|
||||
string(1) "2"
|
||||
}
|
||||
bool(false)
|
||||
|
@ -13,9 +13,7 @@ $conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE fetch_row (test INT)');
|
||||
|
||||
odbc_exec($conn, 'INSERT INTO fetch_row VALUES (1)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_row VALUES (2)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_row VALUES (3)');
|
||||
odbc_exec($conn, 'INSERT INTO fetch_row VALUES (1), (2)');
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM fetch_row');
|
||||
|
||||
@ -27,7 +25,7 @@ var_dump(odbc_result($res, 'test'));
|
||||
var_dump(odbc_fetch_row($res, null));
|
||||
var_dump(odbc_result($res, 'test'));
|
||||
|
||||
var_dump(odbc_fetch_row($res, 3));
|
||||
var_dump(odbc_fetch_row($res, 2));
|
||||
var_dump(odbc_result($res, 'test'));
|
||||
|
||||
var_dump(odbc_fetch_row($res, 4));
|
||||
@ -48,5 +46,5 @@ string(1) "1"
|
||||
bool(true)
|
||||
string(1) "2"
|
||||
bool(true)
|
||||
string(1) "3"
|
||||
string(1) "2"
|
||||
bool(false)
|
||||
|
@ -12,7 +12,6 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE field_len (foo INT, bar TEXT, baz VARBINARY(50))');
|
||||
odbc_exec($conn, "INSERT INTO field_len VALUES (1, 'bar', CONVERT(VARBINARY(50), 'baz'))");
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM field_len');
|
||||
try {
|
||||
|
@ -12,7 +12,6 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE field_name (foo INT, bar INT, baz INT)');
|
||||
odbc_exec($conn, 'INSERT INTO field_name VALUES (1, 2, 3)');
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM field_name');
|
||||
try {
|
||||
|
@ -12,7 +12,6 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE field_num (foo INT, bar REAL, baz VARBINARY(50))');
|
||||
odbc_exec($conn, "INSERT INTO field_num VALUES (1, 3.14, CONVERT(VARBINARY(50), 'baz'))");
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM field_num');
|
||||
var_dump(odbc_field_num($res, "foo"));
|
||||
|
@ -12,7 +12,6 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE field_precision (foo INT, bar REAL, baz VARBINARY(50))');
|
||||
odbc_exec($conn, "INSERT INTO field_precision VALUES (1, 3.14, CONVERT(VARBINARY(50), 'baz'))");
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM field_precision');
|
||||
try {
|
||||
|
@ -12,7 +12,6 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE field_scale (foo INT, bar REAL, baz VARBINARY(50))');
|
||||
odbc_exec($conn, "INSERT INTO field_scale VALUES (1, 3.14, CONVERT(VARBINARY(50), 'baz'))");
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM field_scale');
|
||||
try {
|
||||
|
@ -12,7 +12,6 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE field_type (foo INT, bar TEXT, baz VARBINARY(50))');
|
||||
odbc_exec($conn, "INSERT INTO field_type VALUES (1, 'bar', CONVERT(VARBINARY(50), 'baz'))");
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM field_type');
|
||||
try {
|
||||
|
@ -11,15 +11,11 @@ include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'CREATE TABLE free_result (TEST INT NOT NULL)');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (TEST INT NOT NULL)');
|
||||
odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY (TEST)');
|
||||
odbc_exec($conn, 'INSERT INTO free_result VALUES (1), (2)');
|
||||
|
||||
odbc_exec($conn, 'INSERT INTO FOO VALUES (1)');
|
||||
odbc_exec($conn, 'INSERT INTO FOO VALUES (2)');
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM FOO');
|
||||
$res = odbc_exec($conn, 'SELECT * FROM free_result');
|
||||
|
||||
var_dump(odbc_fetch_row($res));
|
||||
var_dump(odbc_result($res, 'test'));
|
||||
@ -44,8 +40,7 @@ try {
|
||||
<?php
|
||||
require 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
odbc_exec($conn, 'DROP TABLE free_result');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
odbc_num_rows(): Getting the number of fields
|
||||
odbc_num_fields(): Getting the number of fields
|
||||
--EXTENSIONS--
|
||||
odbc
|
||||
--SKIPIF--
|
||||
|
@ -12,9 +12,7 @@ include 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE num_rows (test INT)');
|
||||
odbc_exec($conn, 'INSERT INTO num_rows VALUES (1)');
|
||||
odbc_exec($conn, 'INSERT INTO num_rows VALUES (2)');
|
||||
odbc_exec($conn, 'INSERT INTO num_rows VALUES (3)');
|
||||
odbc_exec($conn, 'INSERT INTO num_rows VALUES (1), (2), (3)');
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM num_rows');
|
||||
var_dump(odbc_num_rows($res));
|
||||
|
@ -3,9 +3,20 @@ odbc_primarykeys(): Basic test for odbc_primarykeys()
|
||||
--EXTENSIONS--
|
||||
odbc
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--XFAIL--
|
||||
Doesn't work with MS SQL
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
$result = @odbc_exec($conn, "SELECT @@Version");
|
||||
if ($result) {
|
||||
$array = odbc_fetch_array($result);
|
||||
$info = (string) reset($array);
|
||||
if (!str_contains($info, "Microsoft SQL Server")) {
|
||||
echo "skip MS SQL specific test";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -13,15 +24,28 @@ include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, 'CREATE DATABASE PrimarykeysTest');
|
||||
odbc_exec($conn, 'USE PrimarykeysTest');
|
||||
odbc_exec($conn, 'CREATE TABLE primarykeys (test INT NOT NULL)');
|
||||
|
||||
$res = odbc_primarykeys($conn, "", "PrimarykeysTest", "primarykeys");
|
||||
$res = odbc_primarykeys($conn, "PrimarykeysTest", "dbo", "primarykeys");
|
||||
var_dump(odbc_fetch_array($res));
|
||||
odbc_free_result($res);
|
||||
|
||||
odbc_exec($conn, 'ALTER TABLE primarykeys ADD CONSTRAINT primarykeys_pk PRIMARY KEY (test)');
|
||||
|
||||
$res = odbc_primarykeys($conn, "", "PrimarykeysTest", "primarykeys");
|
||||
$res = odbc_primarykeys($conn, "PrimarykeysTest", "dbo", "");
|
||||
var_dump(odbc_fetch_array($res));
|
||||
odbc_free_result($res);
|
||||
|
||||
$res = odbc_primarykeys($conn, "PrimarykeysTest", "", "primarykeys");
|
||||
var_dump(odbc_fetch_array($res));
|
||||
odbc_free_result($res);
|
||||
|
||||
$res = odbc_primarykeys($conn, null, "dbo", "primarykeys");
|
||||
var_dump(odbc_fetch_array($res));
|
||||
odbc_free_result($res);
|
||||
|
||||
$res = odbc_primarykeys($conn, "PrimarykeysTest", "dbo", "primarykeys");
|
||||
var_dump(odbc_fetch_array($res));
|
||||
odbc_free_result($res);
|
||||
|
||||
@ -30,8 +54,40 @@ odbc_free_result($res);
|
||||
<?php
|
||||
require 'config.inc';
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, 'USE PrimarykeysTest');
|
||||
odbc_exec($conn, 'DROP TABLE primarykeys');
|
||||
odbc_exec($conn, 'USE master');
|
||||
odbc_exec($conn, 'DROP DATABASE PrimarykeysTest');
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
array(%d) {
|
||||
["TABLE_CAT"]=>
|
||||
string(%d) "PrimarykeysTest"
|
||||
["TABLE_SCHEM"]=>
|
||||
string(%d) "dbo"
|
||||
["TABLE_NAME"]=>
|
||||
string(%d) "primarykeys"
|
||||
["COLUMN_NAME"]=>
|
||||
string(%d) "test"
|
||||
["KEY_SEQ"]=>
|
||||
string(%d) "1"
|
||||
["PK_NAME"]=>
|
||||
string(%d) "primarykeys_pk"
|
||||
}
|
||||
array(%d) {
|
||||
["TABLE_CAT"]=>
|
||||
string(%d) "PrimarykeysTest"
|
||||
["TABLE_SCHEM"]=>
|
||||
string(%d) "dbo"
|
||||
["TABLE_NAME"]=>
|
||||
string(%d) "primarykeys"
|
||||
["COLUMN_NAME"]=>
|
||||
string(%d) "test"
|
||||
["KEY_SEQ"]=>
|
||||
string(%d) "1"
|
||||
["PK_NAME"]=>
|
||||
string(%d) "primarykeys_pk"
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))){
|
||||
if (!strpos(strtolower(getenv('PDOTEST_DSN')), 'charset=we8mswin1252')) die('skip expected output valid for Oracle with WE8MSWIN1252 character set');
|
||||
} elseif (!strncasecmp(getenv('PDOTEST_DSN'), 'dblib', strlen('dblib'))) {
|
||||
die('skip not for pdo_dblib');
|
||||
} elseif (!strncasecmp(getenv('PDOTEST_DSN'), 'odbc', strlen('odbc'))) {
|
||||
die('skip not for pdo_odbc');
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -6,6 +6,10 @@ pdo_odbc
|
||||
<?php
|
||||
require 'ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
|
||||
if (ODBC_TYPE === "unixODBC") {
|
||||
die("skip Fails with unixODBC");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
Loading…
Reference in New Issue
Block a user