diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
|---|---|---|
| committer | <> | 2013-04-03 16:25:08 +0000 |
| commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
| tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/oci8/tests/define0.phpt | |
| download | php2-master.tar.gz | |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/oci8/tests/define0.phpt')
| -rw-r--r-- | ext/oci8/tests/define0.phpt | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/ext/oci8/tests/define0.phpt b/ext/oci8/tests/define0.phpt new file mode 100644 index 0000000..f2f06e3 --- /dev/null +++ b/ext/oci8/tests/define0.phpt @@ -0,0 +1,61 @@ +--TEST-- +oci_define_by_name() +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require(dirname(__FILE__)."/connect.inc"); + +// Initialize + +$stmtarray = array( + "drop table define0_tab", + "create table define0_tab (string varchar(10))", + "insert into define0_tab (string) values ('some')", +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run test + +$stmt = oci_parse($c, "select string from define0_tab"); + +/* the define MUST be done BEFORE ociexecute! */ + +echo "Test 1\n"; + +$string = ''; +oci_define_by_name($stmt, "STRING", $string, 20); +oci_execute($stmt); +while (oci_fetch($stmt)) { + var_dump($string); +} + +echo "Test 2\n"; + +$string = ''; +$s2 = oci_parse($c, 'select string from define0_tab'); +oci_define_by_name($s2, 'STRING', $string); +oci_execute($s2); +while (oci_fetch($s2)) { + var_dump($string); +} + +// Cleanup + +$stmtarray = array( + "drop table define0_tab" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 +string(%d) "some" +Test 2 +string(%d) "some" +===DONE=== |
