Re: multiple queries, one transaction - REWORDED

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

 



Crate an Array, where the Key is the ItemId, and the value is the ItemQty.
If the client want to delete an the item, unset the key, if the client
wont to add or remove an item quantity, just change the value.

Then when the items and quantities are correct, just 
<start transaction>
<begin foreach>
If (! (INSERT ..... (order, ItemID (the array key), ItemQty (the array
value of the key))...))
        <rollback transaction>
        <break>
<end foreach>
<commit transaction>

So if the insert is failed, you rollbackit.
No need for a DELETE

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

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