summaryrefslogtreecommitdiff
path: root/ext/sqlite/tests/sqlite_oo_025.phpt
blob: b5680a78cd354ace3329ba2e36fbe325cc60de56 (plain)
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
101
102
103
--TEST--
sqlite-oo: sqlite / foreach
--INI--
sqlite.assoc_case=0
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded("sqlite")) print "skip"; 
?>
--FILE--
<?php 
include "blankdb_oo.inc";

$data = array(
	"one",
	"two",
	"three"
	);

$db->query("CREATE TABLE strings(a VARCHAR)");

foreach ($data as $str) {
	$db->query("INSERT INTO strings VALUES('$str')");
}

echo "====UNBUFFERED====\n";
$r = $db->unbuffered_query("SELECT a from strings", SQLITE_NUM);
//var_dump(class_implements($r));
foreach($r as $row) {
	var_dump($row);
}
echo "====NO-MORE====\n";
foreach($r as $row) {
	var_dump($row);
}
echo "====DIRECT====\n";
foreach($db->unbuffered_query("SELECT a from strings", SQLITE_NUM) as $row) {
	var_dump($row);
}
echo "====BUFFERED====\n";
$r = $db->query("SELECT a from strings", SQLITE_NUM);
//var_dump(class_implements($r));
foreach($r as $row) {
	var_dump($row);
}
foreach($r as $row) {
	var_dump($row);
}
echo "DONE!\n";
?>
--EXPECT--
====UNBUFFERED====
array(1) {
  [0]=>
  string(3) "one"
}
array(1) {
  [0]=>
  string(3) "two"
}
array(1) {
  [0]=>
  string(5) "three"
}
====NO-MORE====
====DIRECT====
array(1) {
  [0]=>
  string(3) "one"
}
array(1) {
  [0]=>
  string(3) "two"
}
array(1) {
  [0]=>
  string(5) "three"
}
====BUFFERED====
array(1) {
  [0]=>
  string(3) "one"
}
array(1) {
  [0]=>
  string(3) "two"
}
array(1) {
  [0]=>
  string(5) "three"
}
array(1) {
  [0]=>
  string(3) "one"
}
array(1) {
  [0]=>
  string(3) "two"
}
array(1) {
  [0]=>
  string(5) "three"
}
DONE!