summaryrefslogtreecommitdiff
path: root/ext/interbase
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-11-10 18:02:56 +0000
committerFelipe Pena <felipe@php.net>2008-11-10 18:02:56 +0000
commit1460f722e3baab33540135790d186f4bbe5f574f (patch)
tree181979ba0acda84cb9415c2fcbe372d9eb09ed3c /ext/interbase
parent4680f6ab3d0b35db4dba269c8c76e0745f97b6ec (diff)
downloadphp-git-1460f722e3baab33540135790d186f4bbe5f574f.tar.gz
- New tests
Diffstat (limited to 'ext/interbase')
-rw-r--r--ext/interbase/tests/ibase_affected_rows_001.phpt32
-rw-r--r--ext/interbase/tests/ibase_errmsg_001.phpt22
-rw-r--r--ext/interbase/tests/ibase_free_query_001.phpt28
-rw-r--r--ext/interbase/tests/ibase_num_params_001.phpt32
-rw-r--r--ext/interbase/tests/ibase_param_info_001.phpt53
-rw-r--r--ext/interbase/tests/ibase_trans_001.phpt21
-rw-r--r--ext/interbase/tests/ibase_trans_002.phpt34
7 files changed, 222 insertions, 0 deletions
diff --git a/ext/interbase/tests/ibase_affected_rows_001.phpt b/ext/interbase/tests/ibase_affected_rows_001.phpt
new file mode 100644
index 0000000000..f72ec90e9e
--- /dev/null
+++ b/ext/interbase/tests/ibase_affected_rows_001.phpt
@@ -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)
diff --git a/ext/interbase/tests/ibase_errmsg_001.phpt b/ext/interbase/tests/ibase_errmsg_001.phpt
new file mode 100644
index 0000000000..e3973ab3f5
--- /dev/null
+++ b/ext/interbase/tests/ibase_errmsg_001.phpt
@@ -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)
diff --git a/ext/interbase/tests/ibase_free_query_001.phpt b/ext/interbase/tests/ibase_free_query_001.phpt
new file mode 100644
index 0000000000..bedec71731
--- /dev/null
+++ b/ext/interbase/tests/ibase_free_query_001.phpt
@@ -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)
diff --git a/ext/interbase/tests/ibase_num_params_001.phpt b/ext/interbase/tests/ibase_num_params_001.phpt
new file mode 100644
index 0000000000..fafbaaaa76
--- /dev/null
+++ b/ext/interbase/tests/ibase_num_params_001.phpt
@@ -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)
diff --git a/ext/interbase/tests/ibase_param_info_001.phpt b/ext/interbase/tests/ibase_param_info_001.phpt
new file mode 100644
index 0000000000..c8054f683b
--- /dev/null
+++ b/ext/interbase/tests/ibase_param_info_001.phpt
@@ -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
diff --git a/ext/interbase/tests/ibase_trans_001.phpt b/ext/interbase/tests/ibase_trans_001.phpt
new file mode 100644
index 0000000000..cceb60e9a1
--- /dev/null
+++ b/ext/interbase/tests/ibase_trans_001.phpt
@@ -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)
diff --git a/ext/interbase/tests/ibase_trans_002.phpt b/ext/interbase/tests/ibase_trans_002.phpt
new file mode 100644
index 0000000000..be7c073ca3
--- /dev/null
+++ b/ext/interbase/tests/ibase_trans_002.phpt
@@ -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"
+}