missing bits
[mdref/mdref-pq] / pq / Transaction / createLOB.md
1 # pq\LOB pq\Transaction::createLOB([int $mode = pq\LOB::RW])
2
3 Create a new *large object* and open it.
4 See pq\Transaction::openLOB().
5
6 ## Params:
7
8 * Optional int $mode = pq\LOB::RW
9 How to open the *large object* (read, write or both; see pq\LOB constants).
10
11 ## Returns:
12
13 * pq\LOB, instance of the new *large object*.
14
15 ## Throws:
16
17 * pq\Exception\InvalidArgumentException
18 * pq\Exception\BadMethodCallException
19 * pq\Exception\RuntimeException
20
21 ## Example:
22
23 <?php
24
25 $connection = new pq\Connection;
26 $transaction = $connection->startTransaction();
27
28 $lob = $transaction->createLOB();
29 $lob->write("Hello World!");
30
31 // close the LOB before unlinking
32 $oid = $lob->oid;
33 $lob = null;
34
35 $transaction->unlinkLOB($oid);
36 $transaction->commit();
37
38 ?>