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

1.1       misho       1: --TEST--
                      2: Sybase-CT bug #26407 (Result set fetching broken around transactions)
                      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: 
                     16:   // Create temporary table
                     17:   $table= 'phpt_bug26407';
                     18:   var_dump(sybase_query('create table #'.$table.' ( the_big_answer int )', $db));
                     19: 
                     20:   // I
                     21:   var_dump(sybase_select_ex($db, '
                     22:     begin transaction
                     23:       -- anything producing a result set here will fail;
                     24:       -- however, print or update statements will work
                     25:       select "foo" 
                     26:     commit
                     27:     -- anything afterwards will fail, too
                     28:   '));  
                     29: 
                     30:   // II
                     31:   var_dump(sybase_select_ex($db, '
                     32:     begin transaction
                     33:       -- no result returned...
                     34:       update #'.$table.' set the_big_answer=42
                     35:     commit
                     36:   '));
                     37:   
                     38:   // III
                     39:   var_dump(sybase_select_ex($db, '
                     40:     select "foo"
                     41:     begin transaction
                     42:       -- do anything, even return a result set
                     43:     commit
                     44:     select "bar"   
                     45:   '));
                     46: 
                     47:   sybase_close($db);
                     48: ?>
                     49: --EXPECTF--
                     50: bool(true)
                     51: >>> Query: 
                     52:     begin transaction
                     53:       -- anything producing a result set here will fail;
                     54:       -- however, print or update statements will work
                     55:       select "foo" 
                     56:     commit
                     57:     -- anything afterwards will fail, too
                     58:   
                     59: <<< Return: resource
                     60: array(1) {
                     61:   [0]=>
                     62:   array(1) {
                     63:     ["computed"]=>
                     64:     string(3) "foo"
                     65:   }
                     66: }
                     67: >>> Query: 
                     68:     begin transaction
                     69:       -- no result returned...
                     70:       update #phpt_bug26407 set the_big_answer=42
                     71:     commit
                     72:   
                     73: <<< Return: boolean
                     74: bool(true)
                     75: >>> Query: 
                     76:     select "foo"
                     77:     begin transaction
                     78:       -- do anything, even return a result set
                     79:     commit
                     80:     select "bar"   
                     81:   
                     82: 
                     83: Notice: sybase_query(): Sybase:  Unexpected results, cancelling current in %stest.inc on line %d
                     84: <<< Return: resource
                     85: array(1) {
                     86:   [0]=>
                     87:   array(1) {
                     88:     ["computed"]=>
                     89:     string(3) "foo"
                     90:   }
                     91: }

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