Re: PDO, Persistent Connections

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

 



Jarratt Ingram wrote:
Hi,

I have a little unusual question, we are currently looking into the new PDO
extension with PHP5.1. We are currently use Mysql, InnoDB and transactions.

What we would like to know if we use the PDO extension and persistent
connections, can we start a Transaction on one page and then commit it from
another separate page by carrying the PDO object through a php session? Thus
preventing php from automatically closing that specific DB connection.  The
reason for this we use remote connections to the Database.

Any thoughts or comments if i have missed the boat completely

not quite but in practice what you want is not possible.
in order to continue that transaction on 'page 2' you browser will
need to connect to the same thread/process as the connection of request
of 'page 1' - not impossible but it's _very_ hit and miss (not something you
want to build upon).

oh and php resource datatypes (e.g. a DB connection) cannot be serialized.

in short you don't want to to do what you think you want to do :-) instead
stuff the data in the session until you have it all and only then start and finish
the transaction in a single request.



Regards
Jarratt


--
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