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

43 lines
637 B
Plaintext
Raw Normal View History

--TEST--
large objects
--SKIPIF--
2013-02-14 14:54:22 +01:00
<?php include "_skipif.inc"; ?>
--FILE--
<?php
echo "Test\n";
include "_setup.inc";
$c = new pq\Connection(PQ_DSN);
$t = $c->startTransaction();
$lob = $t->createLOB();
2013-05-14 13:50:22 +02:00
var_dump($lob->transaction === $t);
$lob->write(file_get_contents(__FILE__));
var_dump($lob->tell());
2013-02-14 14:54:22 +01:00
$lob->seek(0, SEEK_SET);
$dat = $lob->read(filesize(__FILE__));
2013-02-14 14:54:22 +01:00
var_dump(hash("md5", $dat)==hash_file("md5", __FILE__));
$lob->truncate(5);
2013-02-14 14:54:22 +01:00
$lob = new pq\Lob($t, $lob->oid);
var_dump($lob->read(123));
2013-02-14 14:54:22 +01:00
$t->commit();
$t->unlinkLOB($lob->oid);
?>
DONE
2013-02-14 14:54:22 +01:00
--EXPECTF--
Test
2013-05-14 13:50:22 +02:00
bool(true)
int(489)
2013-02-14 14:54:22 +01:00
bool(true)
string(5) "%c?php"
DONE