Code for Database Transaction Processing
Peter Haworth
pete at mollysrevenge.com
Wed Nov 10 02:02:24 EST 2010
This isn't specific example including complete code but the general
flow is:
revExecuteSQL gDBID,"BEGIN TRANSACTION"
.
revdbExecute <your SQL command>
if error
revRollBackDatabase gDBID
exit
end if
.
revdbExecute <your SQL command>
if error
revRollBackDatabase gDBID
exit
end if
.
repeat the above for whatever SQL commands you need.
.
revdb_Commit(gDBID)
Note that if you don't issue the BEGIN and COMMIT commands, SQLite
automatically treats each individual db update command you give it as
a separate transaction.
There's a good write up of the SQLite transaction details at http://www.sqlite.org/lang_transaction.html
.
Pete Haworth
On Nov 9, 2010, at 7:32 PM, Wilde Electric wrote:
> Hello,
>
> I have been unable to find any reference to code examples for doing
> Transaction Processing with SQLite DB
>
> I have only found a note from Trevor revExecuteSQL to BEGIN
> TRANSACTION etc
> without an example.
>
> Could someone provide a code example that starts with the BEGIN
> TRANSACTION
> and finishing with COMMIT TRANSACTION?
>
> Thank You for your help,
>
> David J. Lamp
More information about the use-livecode
mailing list