Annotation of embedaddon/php/ext/oci8/tests/fetch_all4.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test oci_fetch_* array overwriting when query returns no rows
                      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: // Initialization
                     11: 
                     12: $stmtarray = array(
                     13:        "drop table fetch_all4_tab",
                     14:        "create table fetch_all4_tab (mycol1 number, mycol2 varchar2(20))",
                     15:        "insert into fetch_all4_tab values (1, 'abc')"
                     16: );
                     17: 
                     18: oci8_test_sql_execute($c, $stmtarray);
                     19: 
                     20: // Run Test
                     21: 
                     22: echo "Test 1\n";
                     23: 
                     24: $s = oci_parse($c, "select * from fetch_all4_tab where 1 = 0");
                     25: oci_execute($s);
                     26: $res = array(1,2,3);  // this array is replaced as a result of the query
                     27: $r = oci_fetch_all($s, $res);
                     28: var_dump($r);
                     29: var_dump($res);
                     30: 
                     31: echo "Test 2\n";
                     32: 
                     33: $s = oci_parse($c, "select * from fetch_all4_tab where 1 = 0");
                     34: oci_execute($s);
                     35: $row = array(1,2,3);  // this array is replaced as a result of the query
                     36: $row = oci_fetch_array($s);
                     37: var_dump($row);
                     38: 
                     39: // Clean up
                     40: 
                     41: $stmtarray = array(
                     42:        "drop table fetch_all4_tab"
                     43: );
                     44: 
                     45: oci8_test_sql_execute($c, $stmtarray);
                     46: 
                     47: ?>
                     48: ===DONE===
                     49: <?php exit(0); ?>
                     50: --EXPECTF--
                     51: Test 1
                     52: int(0)
                     53: array(2) {
                     54:   [%u|b%"MYCOL1"]=>
                     55:   array(0) {
                     56:   }
                     57:   [%u|b%"MYCOL2"]=>
                     58:   array(0) {
                     59:   }
                     60: }
                     61: Test 2
                     62: bool(false)
                     63: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>