xref: /PHP-5.3/ext/pdo/tests/bug_38394.phpt (revision 1f655451)
1--TEST--
2PDO Common: Bug #38394 (Prepared statement error stops subsequent statements)
3--SKIPIF--
4<?php # vim:ft=php
5if (!extension_loaded('pdo')) die('skip');
6$dir = getenv('REDIR_TEST_DIR');
7if (false == $dir) die('skip no driver');
8if (!strncasecmp(getenv('PDOTEST_DSN'), 'sqlite2', strlen('sqlite2'))) die('skip not relevant for pdo_sqlite2 driver');
9require_once $dir . 'pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
16
17$db = PDOTest::factory();
18$db->exec("CREATE TABLE test (a INT, b INT, c INT)");
19$s = $db->prepare("INSERT INTO test (a,b,c) VALUES (:a,:b,:c)");
20
21$s->execute(array('a' => 1, 'b' => 2, 'c' => 3));
22
23@$s->execute(array('a' => 5, 'b' => 6, 'c' => 7, 'd' => 8));
24
25$s->execute(array('a' => 9, 'b' => 10, 'c' => 11));
26
27var_dump($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_ASSOC));
28?>
29===DONE===
30--EXPECTF--
31array(2) {
32  [0]=>
33  array(3) {
34    ["a"]=>
35    string(1) "1"
36    ["b"]=>
37    string(1) "2"
38    ["c"]=>
39    string(1) "3"
40  }
41  [1]=>
42  array(3) {
43    ["a"]=>
44    string(1) "9"
45    ["b"]=>
46    string(2) "10"
47    ["c"]=>
48    string(2) "11"
49  }
50}
51===DONE===
52