summaryrefslogtreecommitdiff
path: root/ext/pgsql/tests/large_object.inc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pgsql/tests/large_object.inc')
-rw-r--r--ext/pgsql/tests/large_object.inc36
1 files changed, 36 insertions, 0 deletions
diff --git a/ext/pgsql/tests/large_object.inc b/ext/pgsql/tests/large_object.inc
new file mode 100644
index 0000000000..2a1159c8c4
--- /dev/null
+++ b/ext/pgsql/tests/large_object.inc
@@ -0,0 +1,36 @@
+<?php
+
+include('config.inc');
+
+$db = pg_connect("host=localhost");
+pg_exec ($db, "begin");
+$oid = pg_lo_create ($db);
+if (!$oid) echo ("pg_lo_create() error\n");
+$handle = pg_lo_open ($db, $oid, "w");
+if (!$handle) echo ("pg_lo_open() error\n");
+pg_lo_write ($handle, "large object data\n");
+pg_lo_close ($handle);
+pg_exec ($db, "commit");
+
+pg_exec ($db, "begin");
+$handle = pg_lo_open ($db, $oid, "w");
+pg_lo_read($handle, 100);
+pg_lo_tell($handle);
+pg_lo_seek($handle, 2);
+pg_lo_close($handle);
+pg_exec ($db, "commit");
+
+pg_exec ($db, "begin");
+$handle = pg_lo_open ($db, $oid, "w");
+pg_lo_read_all($handle);
+if (pg_last_error()) echo "pg_lo_read_all() error\n".pg_last_error();
+pg_lo_close($handle);
+pg_exec ($db, "commit");
+
+pg_exec ($db, "begin");
+pg_lo_unlink($oid);
+pg_exec ($db, "commit");
+
+echo "OK";
+
+?> \ No newline at end of file