On 23/12/2010, at 5:38 PM, Drake Wilson wrote:

> Quoth BareFeetWare <list....@barefeetware.com>, on 2010-12-23 15:10:30 +1100:
>> Is there a way to do this in pure SQL, without my application code
>> having to check for errors along the way and then interrogate the
>> SQL to look for a "commit" type line and replace it? This seems
>> pretty error prone and convoluted.
> 
> Why would you introspect the SQL

I want to avoid having to introspect.

> rather than generating the beginning and end of the transaction from a 
> different part of the application code to each statement inside?  Begin 
> transaction, then start executing statements from a list; if any of them 
> fail, stop executing further statements and roll back, otherwise commit at 
> the end.  Don't
> include the begin/end in the list.  Does that not work for you?

It works, but it requires a whole extra level of interaction, whereas I want to 
SQL to take care of it itself, without needing to dissect and branch the SQL in 
application code.

I want to be able to just send a series of SQL commands in a transaction as a 
one block of text and have SQLite tell me either that it succeeded so 
committed, or that it failed so everything has been rolled back. It is my 
understanding that this is one of the primary purposes of transactions. In this 
way, I can already string together a series of inserts, updates and deletes and 
execute as one block in a transaction, I'd like to be able to do the same with 
other SQL commands (eg drop and create).

Thanks,
Tom
BareFeetWare

 --
Comparison of SQLite GUI tools:
http://www.barefeetware.com/sqlite/compare/?ml

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to