xref: /PHP-5.3/ext/oci8/tests/fetch_into.phpt (revision c7a8bd6a)
1--TEST--
2ocifetchinto()
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5--FILE--
6<?php
7
8require(dirname(__FILE__)."/connect.inc");
9
10// Initialize
11
12$stmtarray = array(
13    "drop table fetch_into_tab",
14    "create table fetch_into_tab (id number, value number)",
15    "insert into fetch_into_tab (id, value) values (1,1)",
16    "insert into fetch_into_tab (id, value) values (1,1)",
17    "insert into fetch_into_tab (id, value) values (1,1)",
18);
19
20oci8_test_sql_execute($c, $stmtarray);
21
22// Run Test
23
24if (!($s = oci_parse($c, "select * from fetch_into_tab"))) {
25	die("oci_parse(select) failed!\n");
26}
27
28/* ocifetchinto */
29if (!oci_execute($s)) {
30	die("oci_execute(select) failed!\n");
31}
32var_dump(ocifetchinto($s, $all));
33var_dump($all);
34
35/* ocifetchinto */
36if (!oci_execute($s)) {
37	die("oci_execute(select) failed!\n");
38}
39var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
40var_dump($all);
41
42// Cleanup
43
44$stmtarray = array(
45    "drop table fetch_into_tab"
46);
47
48oci8_test_sql_execute($c, $stmtarray);
49
50echo "Done\n";
51?>
52--EXPECTF--
53int(2)
54array(2) {
55  [0]=>
56  %unicode|string%(1) "1"
57  [1]=>
58  %unicode|string%(1) "1"
59}
60int(2)
61array(4) {
62  [0]=>
63  %unicode|string%(1) "1"
64  [%u|b%"ID"]=>
65  %unicode|string%(1) "1"
66  [1]=>
67  %unicode|string%(1) "1"
68  [%u|b%"VALUE"]=>
69  %unicode|string%(1) "1"
70}
71Done
72