-
Notifications
You must be signed in to change notification settings - Fork 7
/
lob001.phpt
42 lines (31 loc) · 622 Bytes
/
lob001.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--TEST--
large objects
--SKIPIF--
<?php include "_skipif.inc"; ?>
--FILE--
<?php
echo "Test\n";
include "_setup.inc";
$c = new pq\Connection(PQ_DSN);
$t = $c->startTransaction();
$lob = $t->createLOB();
var_dump($lob->transaction === $t);
$lob->write(file_get_contents(__FILE__));
var_dump($lob->tell());
$lob->seek(0, SEEK_SET);
$dat = $lob->read(filesize(__FILE__));
var_dump(md5($dat)===md5_file(__FILE__));
$lob->truncate(5);
$lob = new pq\Lob($t, $lob->oid);
var_dump($lob->read(123));
$t->commit();
$t->unlinkLOB($lob->oid);
?>
DONE
--EXPECTF--
Test
bool(true)
int(474)
bool(true)
string(5) "%c?php"
DONE