Annotation of embedaddon/php/ext/oci8/tests/bug51291_2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #51291 (oci_error() doesn't report last error when called two times)
3: --SKIPIF--
4: <?php
5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen
6: require(dirname(__FILE__).'/skipif.inc');
7: ?>
8: --FILE--
9: <?php
10:
11: require(dirname(__FILE__).'/connect.inc');
12:
13: echo "\nTest 1 - Execute - after successful 2nd query with same statement\n";
14:
15: $s = oci_parse($c, "declare e exception; begin if :bv = 1 then raise e; end if; end;");
16: $bv = 1;
17: oci_bind_by_name($s, ":bv", $bv);
18: $r = @oci_execute($s, OCI_DEFAULT);
19: if (!$r) {
20: var_dump(oci_error(), oci_error($c), oci_error($s));
21: $bv = 0;
22: $r = oci_execute($s, OCI_DEFAULT);
23: echo "Execute status is ";
24: if (is_null($r)) echo "null";
25: else if ($r === false) echo "false";
26: else if ($r === true) echo "true";
27: else echo $r;
28: echo "\n";
29: echo "2nd call after successful execute\n";
30: var_dump(oci_error(), oci_error($c), oci_error($s));
31: }
32:
33: ?>
34: ===DONE===
35: <?php exit(0); ?>
36: --EXPECTF--
37: Test 1 - Execute - after successful 2nd query with same statement
38: bool(false)
39: bool(false)
40: array(4) {
41: ["code"]=>
42: int(6510)
43: ["message"]=>
44: string(72) "ORA-06510: PL/SQL: %s
45: ORA-06512: %s"
46: ["offset"]=>
47: int(0)
48: ["sqltext"]=>
49: string(64) "declare e exception; begin if :bv = 1 then raise e; end if; end;"
50: }
51: Execute status is true
52: 2nd call after successful execute
53: bool(false)
54: bool(false)
55: bool(false)
56: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>