php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57206 Add ability to change auto_commit
Submitted: 2006-08-30 12:27 UTC Modified: 2013-10-15 11:54 UTC
Votes:6
Avg. Score:4.5 ± 0.8
Reproduced:6 of 6 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: tiggscharley at charter dot net Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.1.4 OS: FreeBSD 6.1-Release
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
20 - 11 = ?
Subscribe to this entry?

 
 [2006-08-30 12:27 UTC] 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-&gt;setAttribute(0, false)
#1 {main}
  thrown in /usr/local/www/test_autocommit.php on line 4

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [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
What's wrong with BEGIN & COMMIT?
 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 02:01:30 2024 UTC