xref: /PHP-7.4/ext/oci8/tests/define.phpt (revision 26dfce7f)
1--TEST--
2oci_define_by_name()
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5--FILE--
6<?php
7
8require(__DIR__."/connect.inc");
9
10// Initialize
11
12$stmtarray = array(
13    "drop table define_tab",
14    "create table define_tab (string varchar(10))",
15    "insert into define_tab (string) values ('some')",
16);
17
18oci8_test_sql_execute($c, $stmtarray);
19
20// Run test
21
22$stmt = oci_parse($c, "select string from define_tab");
23
24/* the define MUST be done BEFORE ociexecute! */
25
26$string = '';
27oci_define_by_name($stmt, "STRING", $string, 20);
28
29oci_execute($stmt);
30
31while (oci_fetch($stmt)) {
32	var_dump($string);
33}
34
35// Cleanup
36
37$stmtarray = array(
38    "drop table define_tab"
39);
40
41oci8_test_sql_execute($c, $stmtarray);
42
43echo "Done\n";
44
45?>
46--EXPECTF--
47string(%d) "some"
48Done
49