Annotation of embedaddon/php/ext/sqlite/tests/sqlite_oo_022.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: sqlite-oo: sqlite::seek
3: --INI--
4: sqlite.assoc_case=0
5: --SKIPIF--
6: <?php # vim:ft=php
7: if (!extension_loaded("sqlite")) print "skip"; ?>
8: --FILE--
9: <?php
10: include "blankdb_oo.inc";
11:
12: $data = array(
13: "one",
14: "two",
15: "three"
16: );
17:
18: $db->query("CREATE TABLE strings(a)");
19:
20: foreach ($data as $str) {
21: $db->query("INSERT INTO strings VALUES('$str')");
22: }
23:
24: $res = $db->query("SELECT a FROM strings", SQLITE_NUM);
25: for ($idx = -1; $idx < 4; $idx++) {
26: echo "====SEEK:$idx====\n";
27: $res->seek($idx);
28: var_dump($res->current());
29: }
30: echo "====AGAIN====\n";
31: for ($idx = -1; $idx < 4; $idx++) {
32: echo "====SEEK:$idx====\n";
33: $res->seek($idx);
34: var_dump($res->current());
35: }
36: echo "====DONE!====\n";
37: ?>
38: --EXPECTF--
39: ====SEEK:-1====
40:
41: Warning: SQLiteResult::seek(): row -1 out of range in %ssqlite_oo_022.php on line %d
42: array(1) {
43: [0]=>
44: string(3) "one"
45: }
46: ====SEEK:0====
47: array(1) {
48: [0]=>
49: string(3) "one"
50: }
51: ====SEEK:1====
52: array(1) {
53: [0]=>
54: string(3) "two"
55: }
56: ====SEEK:2====
57: array(1) {
58: [0]=>
59: string(5) "three"
60: }
61: ====SEEK:3====
62:
63: Warning: SQLiteResult::seek(): row 3 out of range in %ssqlite_oo_022.php on line %d
64: array(1) {
65: [0]=>
66: string(5) "three"
67: }
68: ====AGAIN====
69: ====SEEK:-1====
70:
71: Warning: SQLiteResult::seek(): row -1 out of range in %ssqlite_oo_022.php on line %d
72: array(1) {
73: [0]=>
74: string(5) "three"
75: }
76: ====SEEK:0====
77: array(1) {
78: [0]=>
79: string(3) "one"
80: }
81: ====SEEK:1====
82: array(1) {
83: [0]=>
84: string(3) "two"
85: }
86: ====SEEK:2====
87: array(1) {
88: [0]=>
89: string(5) "three"
90: }
91: ====SEEK:3====
92:
93: Warning: SQLiteResult::seek(): row 3 out of range in %ssqlite_oo_022.php on line %d
94: array(1) {
95: [0]=>
96: string(5) "three"
97: }
98: ====DONE!====
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>