Req #57206 [Opn->Fbk]: Add ability to change auto_commit
| From: | mike@php.net | Date: | Tue, 01 Oct 2013 10:39:07 +0000 |
| Subject: | Req #57206 [Opn->Fbk]: Add ability to change auto_commit | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-181873@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=57206&edit=1
ID: 57206
Updated by: mike@php.net
Reported by: tiggscharley at charter dot net
Summary: Add ability to change auto_commit
-Status: Open
+Status: Feedback
Type: Feature/Change Request
-Package: PDO_PGSQL
+Package: *General Issues
Operating System: FreeBSD 6.1-Release
PHP Version: 5.1.4
Block user comment: N
Private report: N
New Comment:
What's wrong with BEGIN & COMMIT?
Previous Comments:
------------------------------------------------------------------------
[2006-08-30 12:27:13] tiggscharley at charter dot net
Description:
------------
Would it be possible to have the ability to change the value of PDO::ATTR_AUTOCOMMIT within the
PDO_PGSQL driver at will? Specifically, if a connection is opened where PDO::ATTR_AUTOCOMMIT is
true but there are certain processes that span classes within the currently executing page that use
the same connection, it would be helpful to be able to selectively turn off autocommit and turn it
back on once the transactions are complete. Attempting to set autocommit to off using
$dbh->setAttribute ( PDO::ATTR_AUTOCOMMIT, false ) after the connection has been made results in
an exception.
Reproduce code:
---------------
<?php
$dbh = new PDO('pgsql:host=localhost;dbname=postgres', 'postgres',
'');
$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
?>
Expected result:
----------------
PDO::ATTR_AUTOCOMMIT to be set to false.
Actual result:
--------------
Fatal error: Uncaught exception 'PDOException' with message 'The auto-commit mode
cannot be changed for this driver' in /usr/local/www/test_autocommit.php:4
Stack trace:
#0 /usr/local/www/test_autocommit.php(4): PDO->setAttribute(0, false)
#1 {main}
thrown in /usr/local/www/test_autocommit.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=57206&edit=1