summaryrefslogtreecommitdiff
path: root/ext/pgsql/tests
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2002-04-23 03:42:26 +0000
committerYasuo Ohgaki <yohgaki@php.net>2002-04-23 03:42:26 +0000
commite7e0eddadd0931c45208c393b340085e9c550852 (patch)
treed2d01b04c412d28831810711f154d9660be7ab67 /ext/pgsql/tests
parentf54f199906f6cff7ba2c0aac0372f1311e7f55f3 (diff)
downloadphp-git-e7e0eddadd0931c45208c393b340085e9c550852.tar.gz
Make pg_convert/pg_insert/pg_select/pg_update/pg_delete a bit more flexible.
pg_convert() may ignore, NOT NULL and/or DEFAULT. pg_insert/pg_update/pg_select/pg_update may return query string.
Diffstat (limited to 'ext/pgsql/tests')
-rw-r--r--ext/pgsql/tests/12pg_insert.phpt1
-rw-r--r--ext/pgsql/tests/13pg_select.phpt1
-rw-r--r--ext/pgsql/tests/14pg_update.phpt1
-rw-r--r--ext/pgsql/tests/pg_delete.inc2
-rw-r--r--ext/pgsql/tests/pg_insert.inc11
-rw-r--r--ext/pgsql/tests/pg_select.inc15
-rw-r--r--ext/pgsql/tests/pg_update.inc14
7 files changed, 20 insertions, 25 deletions
diff --git a/ext/pgsql/tests/12pg_insert.phpt b/ext/pgsql/tests/12pg_insert.phpt
index 8070df1539..104b6fe662 100644
--- a/ext/pgsql/tests/12pg_insert.phpt
+++ b/ext/pgsql/tests/12pg_insert.phpt
@@ -7,4 +7,5 @@ PostgreSQL pg_insert()
include("pg_insert.inc");
?>
--EXPECT--
+INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','BBB');
Ok
diff --git a/ext/pgsql/tests/13pg_select.phpt b/ext/pgsql/tests/13pg_select.phpt
index 7c61436089..43c94c037f 100644
--- a/ext/pgsql/tests/13pg_select.phpt
+++ b/ext/pgsql/tests/13pg_select.phpt
@@ -18,4 +18,5 @@ array(1) {
string(3) "BBB"
}
}
+SELECT * FROM php_pgsql_test WHERE num=1234;
Ok
diff --git a/ext/pgsql/tests/14pg_update.phpt b/ext/pgsql/tests/14pg_update.phpt
index da78eeac92..7dd4dd2d95 100644
--- a/ext/pgsql/tests/14pg_update.phpt
+++ b/ext/pgsql/tests/14pg_update.phpt
@@ -7,4 +7,5 @@ PostgreSQL pg_update()
include("pg_update.inc");
?>
--EXPECT--
+UPDATE php_pgsql_test SET num=1234,str='ABC',bin='XYZ' WHERE num=1234;
Ok
diff --git a/ext/pgsql/tests/pg_delete.inc b/ext/pgsql/tests/pg_delete.inc
index 33e001081b..33ba80e727 100644
--- a/ext/pgsql/tests/pg_delete.inc
+++ b/ext/pgsql/tests/pg_delete.inc
@@ -7,7 +7,7 @@ $db = pg_connect($conn_str);
$fields = array('num'=>'1234', 'str'=>'XXX', 'bin'=>'YYY');
$ids = array('num'=>'1234');
-if (!pg_delete($db, $table_name, $ids, 1)) {
+if (!pg_delete($db, $table_name, $ids)) {
echo "Error\n";
}
else {
diff --git a/ext/pgsql/tests/pg_insert.inc b/ext/pgsql/tests/pg_insert.inc
index bfb2e90e83..e0777a215e 100644
--- a/ext/pgsql/tests/pg_insert.inc
+++ b/ext/pgsql/tests/pg_insert.inc
@@ -4,13 +4,10 @@ error_reporting(E_ALL);
include 'config.inc';
$db = pg_connect($conn_str);
-
$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
-if (!pg_insert($db, $table_name, $fields, 1, 0)) {
- echo "Error\n";
-}
-else {
- echo "Ok\n";
-}
+pg_insert($db, $table_name, $fields) or print "Error in test 1\n";
+echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
+
+echo "Ok\n";
?>
diff --git a/ext/pgsql/tests/pg_select.inc b/ext/pgsql/tests/pg_select.inc
index 04ca501deb..4d251bc992 100644
--- a/ext/pgsql/tests/pg_select.inc
+++ b/ext/pgsql/tests/pg_select.inc
@@ -4,15 +4,12 @@ error_reporting(E_ALL);
include 'config.inc';
$db = pg_connect($conn_str);
-
-$fields = array('num'=>'1234', 'str'=>'XXX', 'bin'=>'YYY');
+$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
$ids = array('num'=>'1234');
-if (!($res = pg_select($db, $table_name, $ids, 1))) {
- echo "Error\n";
-}
-else {
- var_dump($res);
- echo "Ok\n";
-}
+
+$res = pg_select($db, $table_name, $ids) or print "Error\n";
+var_dump($res);
+echo pg_select($db, $table_name, $ids, PGSQL_DML_STRING)."\n";
+echo "Ok\n";
?> \ No newline at end of file
diff --git a/ext/pgsql/tests/pg_update.inc b/ext/pgsql/tests/pg_update.inc
index 6501c09af5..8fc8bb168b 100644
--- a/ext/pgsql/tests/pg_update.inc
+++ b/ext/pgsql/tests/pg_update.inc
@@ -4,14 +4,12 @@ error_reporting(E_ALL);
include 'config.inc';
$db = pg_connect($conn_str);
-
-$fields = array('num'=>'1234', 'str'=>'XXX', 'bin'=>'YYY');
+$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
$ids = array('num'=>'1234');
-if (!pg_update($db, $table_name, $fields, $ids, 1, 0)) {
- echo "Error\n";
-}
-else {
- echo "Ok\n";
-}
+
+pg_update($db, $table_name, $fields, $ids) or print "Error in test 1\n";
+echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
+
+echo "Ok\n";
?>