1--TEST--
2PostgreSQL import large object with given oid
3--SKIPIF--
4<?php
5include("skipif.inc");
6$v = pg_version($conn);
7if (version_compare("8.4devel", $v["client"]) > 0) die("skip - requires pg client >= 8.4\n");
8if (version_compare("8.4devel", $v["server"]) > 0) die("skip - requires pg server >= 8.4\n");
9?>
10--FILE--
11<?php
12
13include('config.inc');
14
15$db = pg_connect($conn_str);
16
17echo "import LO from int\n";
18pg_exec($db, 'begin');
19$oid = pg_lo_import($db, __FILE__, 21003);
20if (!$oid) echo ("pg_lo_import() error\n");
21if ($oid != 21003) echo ("pg_lo_import() wrong id\n");
22pg_lo_unlink ($db, $oid);
23pg_exec($db, 'commit');
24
25echo "import LO from string\n";
26pg_exec($db, 'begin');
27$oid = pg_lo_import($db, __FILE__, "21004");
28if (!$oid) echo ("pg_lo_import() error\n");
29if ($oid != 21004) echo ("pg_lo_import() wrong id\n");
30pg_lo_unlink ($db, $oid);
31pg_exec($db, 'commit');
32
33echo "import LO using default connection\n";
34pg_exec('begin');
35$oid = pg_lo_import($db, __FILE__, 21005);
36if (!$oid) echo ("pg_lo_import() error\n");
37if ($oid != 21005) echo ("pg_lo_import() wrong id\n");
38pg_lo_unlink ($oid);
39pg_exec('commit');
40
41
42echo "OK";
43?>
44--EXPECT--
45import LO from int
46import LO from string
47import LO using default connection
48OK
49