xref: /PHP-5.6/ext/oci8/tests/fetch_into2.phpt (revision c7a8bd6a)
1--TEST--
2ocifetchinto() & wrong number of params
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6require(dirname(__FILE__).'/skipif.inc');
7?>
8--FILE--
9<?php
10
11require dirname(__FILE__)."/connect.inc";
12require dirname(__FILE__).'/create_table.inc';
13
14$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)";
15
16if (!($s = oci_parse($c, $insert_sql))) {
17	die("oci_parse(insert) failed!\n");
18}
19
20for ($i = 0; $i<20; $i++) {
21	if (!oci_execute($s)) {
22		die("oci_execute(insert) failed!\n");
23	}
24}
25
26if (!oci_commit($c)) {
27	die("oci_commit() failed!\n");
28}
29
30$select_sql = "SELECT * FROM ".$schema."".$table_name."";
31
32if (!($s = oci_parse($c, $select_sql))) {
33	die("oci_parse(select) failed!\n");
34}
35
36if (!oci_execute($s)) {
37	die("oci_execute(select) failed!\n");
38}
39var_dump(ocifetchinto($s));
40var_dump($all);
41var_dump(ocifetchinto($s, $all, OCI_ASSOC, 5));
42var_dump($all);
43var_dump(ocifetchinto($c, $all, OCI_RETURN_LOBS));
44var_dump($all);
45var_dump(ocifetchinto($s, $all, 1000000));
46var_dump($all);
47
48require dirname(__FILE__).'/drop_table.inc';
49
50echo "Done\n";
51?>
52--EXPECTF--
53Warning: ocifetchinto() expects at least 2 parameters, 1 given in %s on line %d
54NULL
55
56Notice: Undefined variable: all in %s on line %d
57NULL
58
59Warning: ocifetchinto() expects at most 3 parameters, 4 given in %s on line %d
60NULL
61NULL
62
63Warning: ocifetchinto(): supplied resource is not a valid oci8 statement resource in %s on line %d
64bool(false)
65NULL
66int(5)
67array(2) {
68  [0]=>
69  string(1) "1"
70  [1]=>
71  string(1) "1"
72}
73Done
74