1--TEST-- 2oci_define_by_name() on partial number of columns 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 define4_tab", 18 "create table define4_tab (value number, string varchar(10))", 19 "insert into define4_tab (value, string) values (1234, 'some')", 20); 21 22oci8_test_sql_execute($c, $stmtarray); 23 24// Run test 25 26$stmt = oci_parse($c, "select value, string from define4_tab"); 27 28echo "Test 1\n"; 29// Only one of the two columns is defined 30var_dump(oci_define_by_name($stmt, "STRING", $string)); 31 32oci_execute($stmt); 33 34echo "Test 2\n"; 35 36while (oci_fetch($stmt)) { 37 var_dump(oci_result($stmt, 'VALUE')); 38 var_dump($string); 39 var_dump(oci_result($stmt, 'STRING')); 40 var_dump($string); 41 var_dump(oci_result($stmt, 'VALUE')); 42 var_dump(oci_result($stmt, 'STRING')); 43} 44 45echo "Test 3\n"; 46var_dump(oci_free_statement($stmt)); 47var_dump($string); 48 49try { 50 var_dump(oci_result($stmt, 'STRING')); 51} catch(\TypeError $exception) { 52 var_dump($exception->getMessage()); 53} 54// Cleanup 55 56$stmtarray = array( 57 "drop table define4_tab" 58); 59 60oci8_test_sql_execute($c, $stmtarray); 61 62echo "Done\n"; 63 64?> 65--EXPECTF-- 66Test 1 67bool(true) 68Test 2 69string(4) "1234" 70string(4) "some" 71string(4) "some" 72string(4) "some" 73string(4) "1234" 74string(4) "some" 75Test 3 76bool(true) 77string(4) "some" 78string(%d) "oci_result(): supplied resource is not a valid oci8 statement resource" 79Done 80