Hi Zipman

On Jan 27, 5:17 pm, "zipman" <[EMAIL PROTECTED]> wrote:
> Is there any workaround that I can do in any lower level,
>
> in order to get transactions?

First, define what you mean by 'transactions':

http://groups.google.com/group/cake-php/browse_thread/thread/
3e7a8e6085bf5766/7a4ec5130be8452a?
lnk=gst&q=greycells&rnum=5#7a4ec5130be8452a

Assuming you're looking for transactions across models, you'll have to 
use persistent connections (the postgres equivalent of pconnect_mysql) 
but I'm not sure even that will guarantee the same connection is used 
for each save(), because each connect will just pick up an existing 
connection from the pool, not necessarily the *same* existing 
connection.

Without, for now, 'insert' business transactions are easy to emulate - 
validate all your models before saving sequentially (i.e. only save 
the next model if the previous saved successfully) Store the lastId 
for each insert done in your 'transaction', and if any save()s fail, 
then delete the lot.

Updates are more awkward - you have to fetch and hold locally the pre-
update version of your models then use this information to revert if 
anything untoward happens.

Of course, none of the above works if it is a catastrophic db failure, 
only for stuff like duplicate keys etc. Most of the risk of not having 
business transaction support can be mitigated by seperating 
validates() from save() and doing the above.

~GreyCells


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to