-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
100 lines (61 loc) · 2.09 KB
/
test.php
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
require('PicoDatabase.php');
$d = new PicoDatabase('localhost', 'test', 'test', 'test', 'utf8');
echo '==========', "\n";
var_dump(strval( $d->hello()->world() ));
echo '==========', "\n";
var_dump(strval( $d->select('x', 'y') ));
echo '==========', "\n";
var_dump(strval( $d->select('x')->select('y') ));
echo '==========', "\n";
var_dump(strval( $d->select(array('x', 'y')) ));
echo '==========', "\n";
var_dump(strval( $d->select('?@', 'x') ));
echo '==========', "\n";
try {
var_dump(strval( $d->select('?@', 'x', 'y') ));
} catch(Exception $e) {
var_dump($e->getMessage());
}
echo '==========', "\n";
var_dump(strval( $d->select('?@', array('x', 'y')) ));
echo '==========', "\n";
var_dump(strval( $d->select(array('?@', 'x', 'y')) ));
echo '==========', "\n";
try {
var_dump(strval( $d->select(array('x', 'y'), array('n', 'm')) ));
} catch(Exception $e) {
var_dump($e->getMessage());
}
echo '==========', "\n";
var_dump(strval( $d->select('??', 'f1', 'f2') ));
echo '==========', "\n";
var_dump(strval( $d->insertInto('t1', array('x'), 'y') ));
echo '==========', "\n";
var_dump(strval( $d->insertInto('t1')->set(array('x'))->where('y') ));
echo '==========', "\n";
try {
var_dump(strval( $d->insertInto('t1', array('x'), 'y', 'z') ));
} catch(Exception $e) {
var_dump($e->getMessage());
}
echo '==========', "\n";
var_dump(strval( $d->insertInto('t1', array('x', 'y' => 1, 'z' => array(1, 2, 3)), array('n', 'm' => 1, 'p' => array(1, 2, 3))) ));
echo '==========', "\n";
var_dump(strval( $d->where('x', 1) ));
echo '==========', "\n";
try {
var_dump(strval( $d->where('x', 1, 2) ));
} catch(Exception $e) {
var_dump($e->getMessage());
}
echo '==========', "\n";
var_dump(strval( $d->where(array(
'x' => 1,
'y >' => 2,
'z' => array(1, 2, 3),
'x IN (?_) OR y IN (?_)' => array(array(1,2,3), array(4,5,6)),
)) ));
echo '==========', "\n";
var_dump(strval( $d->where('x LIKE ?_ OR y = ?* OR ?_', '%1/2\3\'?_??%', 'NO\'W()', array('z' => '9', 'zz' => 0)) ));
echo '==========', "\n";