~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to ext/sqlite/tests/sqlite_oo_026.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
sqlite-oo: unbuffered
 
3
--INI--
 
4
sqlite.assoc_case=0
 
5
--SKIPIF--
 
6
<?php # vim:ft=php
 
7
if (!extension_loaded("sqlite")) print "skip"; 
 
8
?>
 
9
--FILE--
 
10
<?php 
 
11
include "blankdb_oo.inc";
 
12
 
 
13
$data = array(
 
14
        "one",
 
15
        "two",
 
16
        "three"
 
17
        );
 
18
 
 
19
$db->query("CREATE TABLE strings(a VARCHAR)");
 
20
 
 
21
foreach ($data as $str) {
 
22
        $db->query("INSERT INTO strings VALUES('$str')");
 
23
}
 
24
 
 
25
echo "====FOREACH====\n";
 
26
$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
 
27
foreach($r as $idx => $row) {
 
28
        var_dump($row[0]);
 
29
        var_dump($row[0]);
 
30
}
 
31
echo "====FOR====\n";
 
32
$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
 
33
for(;$r->valid(); $r->next()) {
 
34
        $v = $r->column(0);
 
35
        var_dump($v);
 
36
        $c = $r->column(0);
 
37
        var_dump(is_null($c) || $c==$v);
 
38
}
 
39
echo "===DONE===\n";
 
40
?>
 
41
--EXPECT--
 
42
====FOREACH====
 
43
string(3) "one"
 
44
string(3) "one"
 
45
string(3) "two"
 
46
string(3) "two"
 
47
string(5) "three"
 
48
string(5) "three"
 
49
====FOR====
 
50
string(3) "one"
 
51
bool(true)
 
52
string(3) "two"
 
53
bool(true)
 
54
string(5) "three"
 
55
bool(true)
 
56
===DONE===