Doc #65979 [Opn->Wfx]: Commit example and transactions

From: Date: Tue, 31 Dec 2013 19:37:54 +0000
Subject: Doc #65979 [Opn->Wfx]: Commit example and transactions
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10776@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65979&edit=1 ID: 65979 Updated by: frozenfire@php.net Reported by: kbcmdba at gmail dot com Summary: Commit example and transactions -Status: Open +Status: Wont fix Type: Documentation Problem Package: Documentation problem Operating System: Any PHP Version: 5.5Git-2013-10-28 (Git) Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2013-10-28 01:38:22] kbcmdba at gmail dot com Description: ------------ 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. http://dev.mysql.com/doc/refman/5.0/en/commit.html 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: http://www.php.net/mysqli.commit --- ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65979&edit=1

« previous php.doc.bugs (#10776) next »