xref: /PHP-7.4/ext/oci8/tests/define_old.phpt (revision 26dfce7f)
1--TEST--
2ocidefinebyname()
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_old_tab",
14    "create table define_old_tab (string varchar(10))",
15    "insert into define_old_tab (string) values ('some')",
16);
17
18oci8_test_sql_execute($c, $stmtarray);
19
20// Run test
21
22$stmt = ociparse($c, "select string from define_old_tab");
23
24/* the define MUST be done BEFORE ociexecute! */
25
26$string = '';
27ocidefinebyname($stmt, "STRING", $string, 20);
28
29ociexecute($stmt);
30
31while (ocifetch($stmt)) {
32	var_dump($string);
33}
34
35// Cleanup
36
37$stmtarray = array(
38    "drop table define_old_tab"
39);
40
41oci8_test_sql_execute($c, $stmtarray);
42
43echo "Done\n";
44
45?>
46--EXPECT--
47string(4) "some"
48Done
49