1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-12-11 08:59:45 +01:00
ext-pq/tests/lob002.phpt

49 lines
819 B
Plaintext
Raw Normal View History

2013-02-22 17:16:12 +01:00
--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__));
2015-07-30 17:37:28 +02:00
var_dump(md5($dat)===md5_file(__FILE__));
2013-02-22 17:16:12 +01:00
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
2015-07-30 17:37:28 +02:00
int(488)
2013-02-22 17:16:12 +01:00
bool(true)
Warning: ftruncate(): Can't truncate this stream! in %s on line %d
2015-08-17 16:57:23 +02:00
string(123) "%c?php
2013-02-22 17:16:12 +01:00
echo "Test\n";
include "_setup.inc";
$c = new pq\Connection(PQ_DSN);
$t = $c->startTransaction();
$lob = $t->creat"
DONE