php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31315 Add a BEGIN or START_TRANSACTION to mysqli
Submitted: 2004-12-27 22:55 UTC Modified: 2004-12-28 00:17 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: cryogen at mac dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.0.2 OS: OSX Server 10.3.7
Private report: No CVE-ID: None
 [2004-12-27 22:55 UTC] cryogen at mac dot com
Description:
------------
I would like to suggest the addition of a START 
TRANSACTION or BEGIN method that would work along with 
the COMMIT and ROLLBACK methods already implemented in 
the mysqli class.

It seems that the only examples using transactions 
always use $mysqli->autocommit(FALSE) in order to toggle 
autocommic on and off.  It is not clear if this 
method turns autocommit on or off for the entire 
session, script, or just for the current transaction?

Many of us prefer to leave autocommit on, and use the 
SQL commands"START TRANSACTION" or "BEGIN" which 
temporarily turn autocommit off for the current 
transaction.  

This seems a much cleaner way of performing 
transactions rather than turning off autocommit and then 
turning it back on for every transaction.

Thanks for your consideration.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-27 23:37 UTC] derick@php.net
You can simply execute those queries yourself with mysqli::query(). We will not add methods for functionality that is already possible, and doesn't have a matching C API function.
 [2004-12-28 00:17 UTC] cryogen at mac dot com
Based on your reponse, I am not sure then why there are 
methods in mysqli supporting COMMIT and ROLLBACK when 
those can just as easily be sent to MySQL as SQl 
commands?  Is there something special in how these work 
compared to their SQl language equivalents?

Just trying to understand the PHP dev team's rationale 
for implementing some SQL commands and not other in the 
mysqli class.

Thanks for the swift response.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 21:01:28 2024 UTC