php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24987 autocommit
Submitted: 2003-08-08 10:41 UTC Modified: 2003-08-08 17:17 UTC
From: zotyo at srk dot ro Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.3.2 OS: Win2K
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
14 - 13 = ?
Subscribe to this entry?

 
 [2003-08-08 10:41 UTC] zotyo at srk dot ro
Description:
------------
Hi,

MSSQL 2000 is using autocommit. Normally I can turn this off by entering BEGIN TRANSACTION and can decide later to COMMIT or ROLLBACK the transaction. My problem is that I have the following code:

MSSQL_PCONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
mssql_select_db($dbName) or DIE("Table unavailable");

mssql_query('BEGIN TRANSACTION');

while($query = fgets($fp))
{
	mssql_query($query);
}

mssql_query('ROLLBACK');
---
Errormsg in browser:

Warning: mssql_query(): message: The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. (severity 16) in c:\inetpub\wwwroot\php\restoredb.php on line 22

Is there something I didn't understand related to PHP or is this is a bug? Pls. answer me, because i try to fix this problem since a week and tried a lot of things to trick this out and I have no ideea of what shall I do next... This would solve a huge problem of mine. A transaction from my page can contain over 2K of insert into -s and I have to rollback the transaction if one of the rows cannot be inserted. 

Thank you for your time, Zoltan Papp.

Reproduce code:
---------------
MSSQL_PCONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
mssql_select_db($dbName) or DIE("Table unavailable");

mssql_query('BEGIN TRANSACTION');

while($query = fgets($fp))
{
	mssql_query($query);
}

mssql_query('ROLLBACK');


Expected result:
----------------
Transaction Rolled Back.

Actual result:
--------------
Warning: mssql_query(): message: The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. (severity 16) in c:\inetpub\wwwroot\php\restoredb.php on line 22


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-08 17:17 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Support questions belong elsewhere.

 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed May 25 06:05:43 2022 UTC