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