Re: PDO Transaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simon Dániel wrote:
2013/3/15 Lester Caine <lester@xxxxxxxxxxx>

Simon Dániel wrote:

Hi,

I have a trouble with PDO transactions.

I would like to start using transactions, but I am not familiar with it. I
have got a 'There is no active transaction' exception, however, I am using
beginTransaction method, and also I have set PDO::ATTR_AUTOCOMMIT to false
right after connecting to the database.
In my whole code I have used the commit method only once.

Between beginTransaction and commit methods, as far as I know, I did not
use anything that could activate auto-commit. In my test code, there is
only an exec method of PDO, and an execute of PDOStatement. Maybe one of
these activated auto-commit?

And what are the possible commands which are able to activate auto-commit?
I know that the commit method can do that, but - as I already wrote - I
have issued it only once, and it is in the destructor of a singleton
class.

So what could be the problem?


You don't say which database you are trying to access. Not all actually
support transactions, and some need a connection correctly set.

I am using MySQL.

Have you read the warning on http://php.net/manual/en/ref.pdo-mysql.php?
It would be of more use if it actually identified what works and what does not :( I think you need to be running in the InnoDB engine to get transactions? MyISAM will throw errors on transactions.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux