mirror of
https://github.com/php/php-src.git
synced 2025-01-20 10:43:40 +08:00
- New tests
This commit is contained in:
parent
4680f6ab3d
commit
1460f722e3
32
ext/interbase/tests/ibase_affected_rows_001.phpt
Normal file
32
ext/interbase/tests/ibase_affected_rows_001.phpt
Normal file
@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
ibase_affected_rows(): Basic test
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
$x = ibase_connect($test_base);
|
||||
|
||||
ibase_query($x, 'INSERT INTO test1 VALUES (1, 100)');
|
||||
ibase_query($x, 'INSERT INTO test1 VALUES (10000, 100)');
|
||||
|
||||
ibase_query($x, 'UPDATE test1 SET i = 10000');
|
||||
var_dump(ibase_affected_rows($x));
|
||||
|
||||
|
||||
ibase_query($x, 'UPDATE test1 SET i = 10000 WHERE i = 2.0');
|
||||
var_dump(ibase_affected_rows($x));
|
||||
|
||||
ibase_query($x, 'UPDATE test1 SET i =');
|
||||
var_dump(ibase_affected_rows($x));
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(3)
|
||||
int(0)
|
||||
|
||||
Warning: ibase_query(): Dynamic SQL Error SQL error code = -104 Unexpected end of command in %s on line %d
|
||||
int(0)
|
22
ext/interbase/tests/ibase_errmsg_001.phpt
Normal file
22
ext/interbase/tests/ibase_errmsg_001.phpt
Normal file
@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
ibase_errmsg(): Basic test
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
$x = ibase_connect($test_base);
|
||||
|
||||
ibase_query('SELECT Foobar');
|
||||
var_dump(ibase_errmsg());
|
||||
|
||||
ibase_close($x);
|
||||
var_dump(ibase_errmsg());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ibase_query(): Dynamic SQL Error SQL error code = -104 Unexpected end of command in %s on line %d
|
||||
string(66) "Dynamic SQL Error SQL error code = -104 Unexpected end of command "
|
||||
bool(false)
|
28
ext/interbase/tests/ibase_free_query_001.phpt
Normal file
28
ext/interbase/tests/ibase_free_query_001.phpt
Normal file
@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
ibase_free_query(): Basic test
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
$x = ibase_connect($test_base);
|
||||
|
||||
$q =ibase_prepare($x, 'SELECT 1 FROM test1 WHERE i = ?');
|
||||
$q =ibase_prepare($x, 'SELECT 1 FROM test1 WHERE i = ?');
|
||||
$q = ibase_prepare($x, 'SELECT 1 FROM test1 WHERE i = ?');
|
||||
|
||||
var_dump(ibase_free_query($q));
|
||||
var_dump(ibase_free_query($q));
|
||||
var_dump(ibase_free_query($x));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: ibase_free_query(): 11 is not a valid Firebird/InterBase query resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: ibase_free_query(): supplied resource is not a valid Firebird/InterBase query resource in %s on line %d
|
||||
bool(false)
|
32
ext/interbase/tests/ibase_num_params_001.phpt
Normal file
32
ext/interbase/tests/ibase_num_params_001.phpt
Normal file
@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
ibase_num_params(): Basic test
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
$x = ibase_connect($test_base);
|
||||
|
||||
$rs = ibase_prepare('SELECT * FROM test1 WHERE 1 = ? AND 2 = ?');
|
||||
var_dump(ibase_num_params($rs));
|
||||
|
||||
$rs = ibase_prepare('SELECT * FROM test1 WHERE 1 = ? AND 2 = ?');
|
||||
var_dump(ibase_num_params());
|
||||
|
||||
$rs = ibase_prepare('SELECT * FROM test1 WHERE 1 = ? AND 2 = ? AND 3 = :x');
|
||||
var_dump(ibase_num_params($rs));
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(2)
|
||||
|
||||
Warning: Wrong parameter count for ibase_num_params() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: ibase_prepare(): Dynamic SQL Error SQL error code = -206 Column unknown X At line 1, column 52. in %s on line %d
|
||||
|
||||
Warning: ibase_num_params(): supplied argument is not a valid Firebird/InterBase query resource in %s on line %d
|
||||
bool(false)
|
53
ext/interbase/tests/ibase_param_info_001.phpt
Normal file
53
ext/interbase/tests/ibase_param_info_001.phpt
Normal file
@ -0,0 +1,53 @@
|
||||
--TEST--
|
||||
ibase_param_info(): Basic test
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
$x = ibase_connect($test_base);
|
||||
|
||||
$rs = ibase_prepare('SELECT * FROM test1 WHERE 1 = ? AND 2 = ?');
|
||||
var_dump(ibase_param_info($rs, 1));
|
||||
|
||||
print "---\n";
|
||||
|
||||
var_dump(ibase_param_info($rs, 100));
|
||||
|
||||
print "---\n";
|
||||
|
||||
var_dump(ibase_param_info(100));
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(10) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
["name"]=>
|
||||
string(0) ""
|
||||
[1]=>
|
||||
string(0) ""
|
||||
["alias"]=>
|
||||
string(0) ""
|
||||
[2]=>
|
||||
string(0) ""
|
||||
["relation"]=>
|
||||
string(0) ""
|
||||
[3]=>
|
||||
string(1) "4"
|
||||
["length"]=>
|
||||
string(1) "4"
|
||||
[4]=>
|
||||
string(7) "INTEGER"
|
||||
["type"]=>
|
||||
string(7) "INTEGER"
|
||||
}
|
||||
---
|
||||
bool(false)
|
||||
---
|
||||
|
||||
Warning: Wrong parameter count for ibase_param_info() in %s on line %d
|
||||
NULL
|
21
ext/interbase/tests/ibase_trans_001.phpt
Normal file
21
ext/interbase/tests/ibase_trans_001.phpt
Normal file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
ibase_trans(): Basic test
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
$x = ibase_connect($test_base);
|
||||
var_dump(ibase_trans($x));
|
||||
var_dump(ibase_trans(1));
|
||||
var_dump(ibase_close());
|
||||
var_dump(ibase_close($x));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (Firebird/InterBase transaction)
|
||||
resource(%d) of type (Firebird/InterBase transaction)
|
||||
bool(true)
|
||||
bool(true)
|
34
ext/interbase/tests/ibase_trans_002.phpt
Normal file
34
ext/interbase/tests/ibase_trans_002.phpt
Normal file
@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
ibase_trans(): Basic operations
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
$x = ibase_connect($test_base);
|
||||
|
||||
$trans = ibase_trans(IBASE_DEFAULT, $x);
|
||||
$sth = ibase_prepare($trans, 'INSERT INTO test1 VALUES (?, ?)');
|
||||
|
||||
$res = ibase_execute($sth, 100, 100);
|
||||
var_dump($res);
|
||||
|
||||
ibase_commit($trans);
|
||||
|
||||
$rs = ibase_query($x, 'SELECT * FROM test1 WHERE i = 100');
|
||||
var_dump(ibase_fetch_assoc($rs));
|
||||
|
||||
ibase_free_query($sth);
|
||||
unset($res);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
array(2) {
|
||||
["I"]=>
|
||||
int(100)
|
||||
["C"]=>
|
||||
string(3) "100"
|
||||
}
|
Loading…
Reference in New Issue
Block a user