half way through the exception refactoring
[m6w6/ext-pq] / tests / lob001.phpt
1 --TEST--
2 large objects
3 --SKIPIF--
4 <? php include "_skipif.inc"; ?>
5 --FILE--
6 <?php
7 echo "Test\n";
8
9 include "_setup.inc";
10
11 $c = new pq\Connection(PQ_DSN);
12 $t = $c->startTransaction();
13
14 $lob = $t->createLOB();
15 $lob->write(file_get_contents(__FILE__));
16 var_dump($lob->tell());
17 $lob->seek(0, SEEK_SET);
18 $dat = $lob->read(filesize(__FILE__));
19 var_dump(hash("md5", $dat));
20 var_dump(hash_file("md5", __FILE__));
21 $lob->truncate(5);
22 $lob = new pq\Lob($t, $lob->oid);
23 var_dump($lob->read(123));
24 ?>
25 DONE
26 --EXPECT--
27 Test
28 int(416)
29 string(32) "d422937493386635bd56b9a9885e7614"
30 string(32) "d422937493386635bd56b9a9885e7614"
31 string(5) "<?php"
32 DONE
33