test Statement::bind()
authorMichael Wallner <mike@php.net>
Tue, 14 May 2013 12:41:15 +0000 (14:41 +0200)
committerMichael Wallner <mike@php.net>
Tue, 14 May 2013 12:41:15 +0000 (14:41 +0200)
package.xml
tests/stm_bound001.phpt [new file with mode: 0644]

index 4956eda4796cf764324d51a6bda3179b7d5a0a8f..74bbc58b09282baff455a1aae966b3881e197927 100644 (file)
@@ -114,6 +114,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
     <file role="test" name="res001.phpt" />
     <file role="test" name="reset001.phpt" />
     <file role="test" name="savepoint001.phpt" />
+    <file role="test" name="stm_bound001.phpt" />
     <file role="test" name="stm_desc001.phpt" />
     <file role="test" name="stm_desc002.phpt" />
     <file role="test" name="trans001.phpt" />
diff --git a/tests/stm_bound001.phpt b/tests/stm_bound001.phpt
new file mode 100644 (file)
index 0000000..acf93ac
--- /dev/null
@@ -0,0 +1,50 @@
+--TEST--
+statement w/ bound vars
+--SKIPIF--
+<?php
+include "_skipif.inc";
+?>
+--FILE--
+<?php
+echo "Test\n";
+include "_setup.inc";
+
+$c = new pq\Connection(PQ_DSN);
+$s = new pq\Statement($c, "bound1", "SELECT \$1::text, \$2::text, \$3::text");
+$s->bind(0, $_1);
+$s->bind(1, $_2);
+$s->bind(2, $_3);
+$r = $s->exec();
+var_dump($r->fetchAll());
+$_1 = "\$1";
+$_2 = "\$2";
+$_3 = "\$3";
+$r = $s->exec();
+var_dump($r->fetchAll());
+?>
+Done
+--EXPECT--
+Test
+array(1) {
+  [0]=>
+  array(3) {
+    [0]=>
+    NULL
+    [1]=>
+    NULL
+    [2]=>
+    NULL
+  }
+}
+array(1) {
+  [0]=>
+  array(3) {
+    [0]=>
+    string(2) "$1"
+    [1]=>
+    string(2) "$2"
+    [2]=>
+    string(2) "$3"
+  }
+}
+Done