summaryrefslogtreecommitdiff
path: root/ext/pgsql/tests
diff options
context:
space:
mode:
authorHartmut Holzgraefe <hholzgra@php.net>2008-07-23 00:17:19 +0000
committerHartmut Holzgraefe <hholzgra@php.net>2008-07-23 00:17:19 +0000
commit432b57b2ae87d2d724a02301550d46527a7b99ad (patch)
tree589a5ebc37beac88349da15b8f4ee7984e34733b /ext/pgsql/tests
parent8c56a23a2659ee240524d568110133e0e80543dd (diff)
downloadphp-git-432b57b2ae87d2d724a02301550d46527a7b99ad.tar.gz
added support for object ids in pg_lo_create() and pg_lo_import() where available
(based on code provided by Tatsuo Ishii)
Diffstat (limited to 'ext/pgsql/tests')
-rw-r--r--ext/pgsql/tests/27large_object_oid.phpt70
1 files changed, 70 insertions, 0 deletions
diff --git a/ext/pgsql/tests/27large_object_oid.phpt b/ext/pgsql/tests/27large_object_oid.phpt
new file mode 100644
index 0000000000..7d935cabd5
--- /dev/null
+++ b/ext/pgsql/tests/27large_object_oid.phpt
@@ -0,0 +1,70 @@
+--TEST--
+PostgreSQL large object with given oid
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+
+echo "create LO from int\n";
+pg_exec ($db, "begin");
+$oid = pg_lo_create ($db, 21000);
+if (!$oid) echo ("pg_lo_create() error\n");
+if ($oid != 21000) echo ("pg_lo_create() wrong id\n");
+pg_lo_unlink ($db, $oid);
+pg_exec ($db, "commit");
+
+echo "create LO from string\n";
+pg_exec ($db, "begin");
+$oid = pg_lo_create ($db, "21001");
+if (!$oid) echo ("pg_lo_create() error\n");
+if ($oid != 21001) echo ("pg_lo_create() wrong id\n");
+pg_lo_unlink ($db, $oid);
+pg_exec ($db, "commit");
+
+echo "create LO using default connection\n";
+pg_exec ("begin");
+$oid = pg_lo_create (21002);
+if (!$oid) echo ("pg_lo_create() error\n");
+if ($oid != 21002) echo ("pg_lo_create() wrong id\n");
+pg_lo_unlink ($oid);
+pg_exec ("commit");
+
+echo "import LO from int\n";
+pg_exec($db, 'begin');
+$oid = pg_lo_import($db, __FILE__, 21003);
+if (!$oid) echo ("pg_lo_import() error\n");
+if ($oid != 21003) echo ("pg_lo_import() wrong id\n");
+pg_lo_unlink ($db, $oid);
+pg_exec($db, 'commit');
+
+echo "import LO from string\n";
+pg_exec($db, 'begin');
+$oid = pg_lo_import($db, __FILE__, "21004");
+if (!$oid) echo ("pg_lo_import() error\n");
+if ($oid != 21004) echo ("pg_lo_import() wrong id\n");
+pg_lo_unlink ($db, $oid);
+pg_exec($db, 'commit');
+
+echo "import LO using default connection\n";
+pg_exec('begin');
+$oid = pg_lo_import($db, __FILE__, 21005);
+if (!$oid) echo ("pg_lo_import() error\n");
+if ($oid != 21005) echo ("pg_lo_import() wrong id\n");
+pg_lo_unlink ($oid);
+pg_exec('commit');
+
+
+echo "OK";
+?>
+--EXPECT--
+create LO from int
+create LO from string
+create LO using default connection
+import LO from int
+import LO from string
+import LO using default connection
+OK