Annotation of embedaddon/php/ext/sybase_ct/tests/test_unbuffered_query.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Sybase-CT unbuffered query
                      3: --SKIPIF--
                      4: <?php require('skipif.inc'); ?>
                      5: --FILE--
                      6: <?php
                      7: /* This file is part of PHP test framework for ext/sybase_ct
                      8:  *
1.1.1.2 ! misho       9:  * $Id$ 
1.1       misho      10:  */
                     11: 
                     12:   require('test.inc');
                     13: 
                     14:   $db= sybase_connect_ex();
                     15:   var_dump($db);
                     16:   
                     17:   // Test #1: num_rows
                     18:   $q= sybase_unbuffered_query('select name from master..systypes', $db);
                     19:   var_dump($q);
                     20:   $i= 0;
                     21:   while ($r= sybase_fetch_assoc($q)) {
                     22:     $i++;
                     23:   }
                     24:   var_dump($i, sybase_num_rows($q), $i == sybase_num_rows($q), $q);
                     25:   sybase_free_result($q);
                     26:   var_dump($q);
                     27:   
                     28:   // Test #2: after sybase_free_result, this should be an invalid resource
                     29:   var_dump(FALSE == sybase_num_rows($q));
                     30:   
                     31:   // Test #3: Seeking
                     32:   $q= sybase_unbuffered_query('select name from master..systypes', $db);
                     33:   var_dump($q);
                     34:   $j= 0;
                     35:   sybase_data_seek($q, 4);
                     36:   while ($r= sybase_fetch_assoc($q)) {
                     37:     $j++;
                     38:   }
                     39:   var_dump($i, $j, $i - $j);
                     40:   
                     41:   sybase_close($db);
                     42: ?>
                     43: --EXPECTF--
                     44: resource(%d) of type (sybase-ct link)
                     45: resource(%d) of type (sybase-ct result)
                     46: int(%d)
                     47: int(%d)
                     48: bool(true)
                     49: resource(%d) of type (sybase-ct result)
                     50: resource(%d) of type (Unknown)
                     51: 
                     52: Warning: sybase_num_rows(): %d is not a valid Sybase result resource in %stest_unbuffered_query.php on line %d
                     53: bool(true)
                     54: resource(%d) of type (sybase-ct result)
                     55: int(%d)
                     56: int(%d)
                     57: int(4)

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