|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65979 Commit example and transactions
Submitted: 2013-10-28 01:38 UTC Modified: 2013-12-31 19:37 UTC
From: kbcmdba at gmail dot com Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: 5.5Git-2013-10-28 (Git) OS: Any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-10-28 01:38 UTC] kbcmdba at gmail dot com
I don't understand why documenters chose to use autocommit(FALSE) to "start" a transaction rather than begin_transaction(). In fact, turning off autocommit doesn't start a transaction at all in environments where autocommit is off by default (depends on how the DBA configured MySQL). The example would be wiser / safer if it had shown users that it's safer to explicitly start a transaction while possibly turning autocommit off. describes the behavior of START TRANSACTION, COMMIT and ROLLBACK.

Note that DBAs can turn off autocommit by default setting the autocommit or the init_connect variables in my.cnf/my.ini. In fact, I tell my developers not to assume that autocommit is on or off. I encourage developers to set it the way they want it for their application's needs in their application's DAL setup. That way, assuming it's "the other way" can't come back to bite you. :-)

From manual page:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-31 19:37 UTC]
-Status: Open +Status: Wont fix
 [2013-12-31 19:37 UTC]
I'm not sure that the documentation needs to be changed in any way. The example code that is currently present in the documentation isn't *wrong* - it's just not in line with your way of doing things.

I agree that one shouldn't ordinarily rely upon autocommit being turned off, but the purpose of the documentation example is purely to demonstrate the invocation of the commit method.

Demonstrating how to initiate a transaction just so as to demonstrate how to use the commit method would require unnecessary added code.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 14:01:32 2024 UTC