~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to ext/sybase_ct/tests/bug26407.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: bug26407.phpt,v 1.1 2004/01/24 02:54:33 thekid Exp $ 
 
10
 */
 
11
 
 
12
  require('test.inc');
 
13
 
 
14
  $db= sybase_connect_ex();
 
15
 
 
16
  // Create temporary table
 
17
  $table= basename(__FILE__, '.php');
 
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 #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 %s/test.inc on line %d
 
84
<<< Return: resource
 
85
array(1) {
 
86
  [0]=>
 
87
  array(1) {
 
88
    ["computed"]=>
 
89
    string(3) "foo"
 
90
  }
 
91
}