bug26407.phpt 1.8 KB

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