summaryrefslogtreecommitdiff
path: root/ext/oci8/tests/define_old.phpt
blob: cc07e2ea94fb8cd7f89dcce8c249a364370a84da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--TEST--
ocidefinebyname()
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php

require(dirname(__FILE__)."/connect.inc");

// Initialize

$stmtarray = array(
    "drop table define_old_tab",
    "create table define_old_tab (string varchar(10))",
    "insert into define_old_tab (string) values ('some')",
);

oci8_test_sql_execute($c, $stmtarray);

// Run test

$stmt = ociparse($c, "select string from define_old_tab");

/* the define MUST be done BEFORE ociexecute! */

$string = '';
ocidefinebyname($stmt, "STRING", $string, 20);

ociexecute($stmt);

while (ocifetch($stmt)) {
	var_dump($string);
}

// Cleanup

$stmtarray = array(
    "drop table define_old_tab"
);

oci8_test_sql_execute($c, $stmtarray);

echo "Done\n";

?>
--EXPECTF--
string(4) "some"
Done