File: lob002.phpt

package info (click to toggle)
php-pq 2.2.3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 788 kB
  • sloc: ansic: 8,210; xml: 175; sh: 102; awk: 40; pascal: 9; makefile: 1
file content (48 lines) | stat: -rw-r--r-- 819 bytes parent folder | download
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
42
43
44
45
46
47
48
--TEST--
large object stream
--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();
fwrite($lob->stream, file_get_contents(__FILE__));
var_dump(ftell($lob->stream));

fseek($lob->stream, 0, SEEK_SET);
$dat = fread($lob->stream, filesize(__FILE__));
var_dump(md5($dat)===md5_file(__FILE__));

ftruncate($lob->stream, 5);

$lob = new pq\Lob($t, $lob->oid);
var_dump(fread($lob->stream, 123));

$t->commit();
$t->unlinkLOB($lob->oid);

?>
DONE
--EXPECTF--
Test
int(488)
bool(true)

Warning: ftruncate(): Can't truncate this stream! in %s on line %d
string(123) "%c?php
echo "Test\n";

include "_setup.inc";

$c = new pq\Connection(PQ_DSN);
$t = $c->startTransaction();

$lob = $t->creat"
DONE