e2624817b6da4a97ea0826c9f18e72a4d9b246b9
[m6w6/pq-gateway] / lib / tmp.php
1 <?php
2
3 require "./pq/Query/Expr.php";
4 require "./pq/Query/Writer.php";
5 require "./pq/Gateway/Table.php";
6 require "./pq/Gateway/Rowset.php";
7 require "./pq/Gateway/Row.php";
8 require "./pq/Gateway/Cell.php";
9
10 class FooModel extends \pq\Gateway\Table {
11 function __construct(\pq\Connection $c) {
12 parent::__construct($c, "foo", "FooCollection");
13 }
14 }
15
16 class Foo extends \pq\Gateway\Row {
17
18 }
19
20 class FooCollection extends \pq\Gateway\Rowset {
21 function __construct(\pq\Gateway\Table $table, \pq\Result $result) {
22 parent::__construct($table, $result, "Foo");
23 }
24 }
25
26 $conn = new \pq\Connection;
27 $types = new \pq\Types($conn);
28 $table = new FooModel($conn);
29 $rowset = $table->find(array(array("id>" => 1), array("id IS" => new pq\Query\Expr("NULL"))));
30 $current = $rowset->current();
31 $current->dt->mod(new pq\Query\Expr("- interval '3 day'"));
32 $current->update();
33 var_dump($current);
34 echo PHP_EOL;