Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / pdo / pdo.php
blob1008f7bd04d3f97dc947e7d1ab84264ff6922cfc
1 <?php
2 dl('pdo.so');
3 dl('pdo_sqlite.so');
5 //$x = new PDO("oci:dbname=hostname", 'php', 'php');
6 $x = new PDO("sqlite::memory:");
8 $x->query("create table test(name string, value string)");
9 debug_zval_dump($x);
11 $stmt = $x->prepare("INSERT INTO test (NAME, VALUE) VALUES (:name, :value)");
13 $stmt->bindParam(":name", $the_name, PDO_PARAM_STR, 32);
14 $stmt->bindParam(":value", $the_value, PDO_PARAM_STR, 32);
16 for ($i = 0; $i < 4; $i++) {
17 $the_name = "foo" . rand();
18 $the_value = "bar" . rand();
20 if (!$stmt->execute()) {
21 break;
25 $stmt = null;
27 echo "DEFAULT:\n";
28 foreach ($x->query("select NAME, VALUE from test") as $row) {
29 print_r($row);
32 echo "OBJ:\n";
34 class Foo {
35 public $NAME = "Don't change me";
38 $foo = new foo;
40 foreach ($x->query("select NAME, VALUE from test", PDO_FETCH_COLUMN, 1) as $row) {
41 debug_zval_dump($row);
44 echo "Done\n";
45 exit;
47 $stmt = $x->prepare("select NAME, VALUE from test where value like ?");
48 $the_name = 'bar%';
49 $stmt->execute(array($the_name)) or die("failed to execute!");
50 $stmt->bindColumn('VALUE', $value);
52 while ($row = $stmt->fetch()) {
53 echo "name=$row[NAME] value=$row[VALUE]\n";
54 echo "value is $value\n";
55 echo "\n";
58 echo "Let's try an update\n";
60 echo "All done\n";