1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-12-02 17:28:35 +01:00
ext-pq/tests/lob001.phpt
Michael Wallner 3024b0b5a9 tests & fixes
2013-02-14 14:54:22 +01:00

39 lines
588 B
PHP

--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();
$lob->write(file_get_contents(__FILE__));
var_dump($lob->tell());
$lob->seek(0, SEEK_SET);
$dat = $lob->read(filesize(__FILE__));
var_dump(hash("md5", $dat)==hash_file("md5", __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
int(451)
bool(true)
string(5) "%c?php"
DONE