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

« back to all changes in this revision

Viewing changes to ext/sqlite/tests/sqlite_004.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: binary encoding
 
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.inc";
 
11
 
 
12
$strings = array(
 
13
        "hello",
 
14
        "hello\x01o",
 
15
        "\x01hello there",
 
16
        "hello\x00there",
 
17
        ""
 
18
);
 
19
 
 
20
sqlite_query("CREATE TABLE strings(a)", $db);
 
21
 
 
22
foreach ($strings as $str) {
 
23
        sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($str) . "')", $db);
 
24
}
 
25
 
 
26
$i = 0;
 
27
$r = sqlite_query("SELECT * from strings", $db);
 
28
while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
 
29
        if ($row[0] !== $strings[$i]) {
 
30
                echo "FAIL!\n";
 
31
                var_dump($row[0]);
 
32
                var_dump($strings[$i]);
 
33
        } else {
 
34
                echo "OK!\n";
 
35
        }
 
36
        $i++;
 
37
}
 
38
 
 
39
sqlite_close($db);
 
40
 
 
41
echo "DONE!\n";
 
42
?>
 
43
--EXPECT--
 
44
OK!
 
45
OK!
 
46
OK!
 
47
OK!
 
48
OK!
 
49
DONE!