test Statement::bind()
[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
16 var_dump($lob->transaction === $t);
17
18 $lob->write(file_get_contents(__FILE__));
19 var_dump($lob->tell());
20
21 $lob->seek(0, SEEK_SET);
22 $dat = $lob->read(filesize(__FILE__));
23 var_dump(hash("md5", $dat)==hash_file("md5", __FILE__));
24
25 $lob->truncate(5);
26
27 $lob = new pq\Lob($t, $lob->oid);
28 var_dump($lob->read(123));
29
30 $t->commit();
31 $t->unlinkLOB($lob->oid);
32
33 ?>
34 DONE
35 --EXPECTF--
36 Test
37 bool(true)
38 int(489)
39 bool(true)
40 string(5) "%c?php"
41 DONE
42