|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-10-01 10:39 UTC] mike@php.net
-Status: Open
+Status: Feedback
-Package: PDO_PGSQL
+Package: *General Issues
[2013-10-01 10:39 UTC] mike@php.net
[2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 21:00:01 2025 UTC |
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