MySQL: did anyone start a transaction?

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

 



Hello all,

I asked this question on php-general last month
(http://marc.info/?t=124049230300004&r=1&w=2), and received some answers
-- but I was directed to this list, so here.

My question is: can I tell programatically whether the next query I'm
going to execute is already part of a transaction, using MySQL?

The context is thus: I'm writing a PHP library which attempts to
seamlessly merge database objects and PHP objects. Architecture
discussion aside (which I'm more than open to, if anyone cares enough to
talk), I need to know whether the code outside the library has already
started a transaction or not. I need to know that because I need to
execute both PHP and SQL from a single external call -- if either one of
my internal PHP or SQL calls fail, I need to revert to the original
state before the external call. And since transactions can't be nested,
I can't unconditionally start a new transaction when the external call
is being initiated -- therefore I need to know whether the programmer
has already started a transaction or not.

Thank you,
Bogdan

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux