-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
68 lines (63 loc) · 1022 Bytes
/
example.php
File metadata and controls
68 lines (63 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
require 'vendor/autoload.php';
$db = new Ikitiki\DB();
$db->setDbName('test');
$db->setUsername('postgres');
$db->setHost('127.0.0.1');
$res = $db->exec(<<<SQL
select
i,
now(),
'"col1"=>"val1", "col2"=>"val2", "col3"=>"val3"'::hstore,
'{"a":"1", "b":"3"}'::json
from
generate_series(1, 2) i;
SQL
)->fetchArray('i');
var_dump($res);
/* outputs:
array(2) {
[1] =>
array(3) {
'now' =>
int(1429720419)
'hstore' =>
array(3) {
'col1' =>
string(4) "val1"
'col2' =>
string(4) "val2"
'col3' =>
string(4) "val3"
}
'json' =>
array(2) {
'a' =>
string(1) "1"
'b' =>
string(1) "3"
}
}
[2] =>
array(3) {
'now' =>
int(1429720419)
'hstore' =>
array(3) {
'col1' =>
string(4) "val1"
'col2' =>
string(4) "val2"
'col3' =>
string(4) "val3"
}
'json' =>
array(2) {
'a' =>
string(1) "1"
'b' =>
string(1) "3"
}
}
}
*/