xref: /PHP-7.1/ext/oci8/tests/field_funcs_old.phpt (revision a2c0f872)
1--TEST--
2ocicolumn*() family
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) VALUES (1,1)";
15
16if (!($s = ociparse($c, $insert_sql))) {
17	die("ociparse(insert) failed!\n");
18}
19
20for ($i = 0; $i<3; $i++) {
21	if (!ociexecute($s)) {
22		die("ociexecute(insert) failed!\n");
23	}
24}
25
26if (!ocicommit($c)) {
27	die("ocicommit() failed!\n");
28}
29
30$select_sql = "SELECT * FROM ".$schema."".$table_name."";
31
32if (!($s = ociparse($c, $select_sql))) {
33	die("ociparse(select) failed!\n");
34}
35
36if (!ociexecute($s)) {
37	die("ociexecute(select) failed!\n");
38}
39
40ocifetchinto($s, $row, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
41var_dump($row);
42
43foreach ($row as $num => $field) {
44	$num++;
45	var_dump(ocicolumnisnull($s, $num));
46	var_dump(ocicolumnname($s, $num));
47	var_dump(ocicolumntype($s, $num));
48	var_dump(ocicolumntyperaw($s, $num));
49	var_dump(ocicolumnscale($s, $num));
50	var_dump(ocicolumnprecision($s, $num));
51	var_dump(ocicolumnsize($s, $num));
52}
53
54
55require dirname(__FILE__).'/drop_table.inc';
56
57echo "Done\n";
58
59?>
60--EXPECT--
61array(5) {
62  [0]=>
63  string(1) "1"
64  [1]=>
65  string(1) "1"
66  [2]=>
67  NULL
68  [3]=>
69  NULL
70  [4]=>
71  NULL
72}
73bool(false)
74string(2) "ID"
75string(6) "NUMBER"
76int(2)
77int(-127)
78int(0)
79int(22)
80bool(false)
81string(5) "VALUE"
82string(6) "NUMBER"
83int(2)
84int(-127)
85int(0)
86int(22)
87bool(true)
88string(4) "BLOB"
89string(4) "BLOB"
90int(113)
91int(0)
92int(0)
93int(4000)
94bool(true)
95string(4) "CLOB"
96string(4) "CLOB"
97int(112)
98int(0)
99int(0)
100int(4000)
101bool(true)
102string(6) "STRING"
103string(8) "VARCHAR2"
104int(1)
105int(0)
106int(0)
107int(10)
108Done
109