1--TEST--
2PostgreSQL create large object with given oid
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php
7include("skipif.inc");
8$v = pg_version($conn);
9if (version_compare("8.3", $v["client"]) > 0) die("skip - requires pg client >= 8.3\n");
10if (version_compare("8.3", $v["server"]) > 0) die("skip - requires pg server >= 8.3\n");
11?>
12--FILE--
13<?php
14
15include('config.inc');
16
17$db = pg_connect($conn_str);
18
19echo "create LO from int\n";
20pg_exec ($db, "begin");
21$oid = pg_lo_create ($db, 21000);
22if (!$oid) echo ("pg_lo_create() error\n");
23if ($oid != 21000) echo ("pg_lo_create() wrong id\n");
24pg_lo_unlink ($db, $oid);
25pg_exec ($db, "commit");
26
27echo "create LO from string\n";
28pg_exec ($db, "begin");
29$oid = pg_lo_create ($db, "21001");
30if (!$oid) echo ("pg_lo_create() error\n");
31if ($oid != 21001) echo ("pg_lo_create() wrong id\n");
32pg_lo_unlink ($db, $oid);
33pg_exec ($db, "commit");
34
35echo "create LO using default connection\n";
36pg_exec ("begin");
37$oid = pg_lo_create (21002);
38if (!$oid) echo ("pg_lo_create() error\n");
39if ($oid != 21002) echo ("pg_lo_create() wrong id\n");
40pg_lo_unlink ($oid);
41pg_exec ("commit");
42
43echo "OK";
44?>
45--EXPECTF--
46create LO from int
47create LO from string
48create LO using default connection
49
50Deprecated: pg_exec(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
51
52Deprecated: pg_lo_create(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
53
54Deprecated: pg_lo_unlink(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
55
56Deprecated: pg_exec(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
57OK
58