Annotation of embedaddon/php/ext/oci8/tests/define1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: oci_define_by_name()
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: require(dirname(__FILE__)."/connect.inc");
! 9:
! 10: // Initialize
! 11:
! 12: $stmtarray = array(
! 13: "drop table define1_tab",
! 14: "create table define1_tab (string varchar(10))",
! 15: "insert into define1_tab (string) values ('some')",
! 16: );
! 17:
! 18: oci8_test_sql_execute($c, $stmtarray);
! 19:
! 20: // Run test
! 21:
! 22: $stmt = oci_parse($c, "select string from define1_tab");
! 23:
! 24: /* the define MUST be done BEFORE ociexecute! */
! 25:
! 26: $string = '';
! 27: var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
! 28: var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
! 29: var_dump(oci_define_by_name($stmt, "", $string, 20));
! 30: var_dump(oci_define_by_name($stmt, ""));
! 31:
! 32: oci_execute($stmt);
! 33:
! 34: while (oci_fetch($stmt)) {
! 35: var_dump($string);
! 36: }
! 37:
! 38: // Cleanup
! 39:
! 40: $stmtarray = array(
! 41: "drop table define1_tab"
! 42: );
! 43:
! 44: oci8_test_sql_execute($c, $stmtarray);
! 45:
! 46: echo "Done\n";
! 47:
! 48: ?>
! 49: --EXPECTF--
! 50: bool(true)
! 51: bool(false)
! 52:
! 53: Warning: oci_define_by_name(): Column name cannot be empty in %s on line %d
! 54: bool(false)
! 55:
! 56: Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
! 57: NULL
! 58: %unicode|string%(4) "some"
! 59: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>