On Tue, 2 Jun 2009 08:40:01 -0300, Karl Brandt
<brandk...@gmail.com> wrote:

>I'm trying to set the conflict resolution of an entire transaction by
>using the ON CONFLICT clause without success.
>
>I'm using the following syntax:
>
>BEGIN ON CONFLICT ROLLBACK;
>INSERT INTO TableX (Id) Values (1);
>INSERT INTO TableX (Id) Values (2);
>INSERT INTO TableX (Id) Values (3);
>COMMIT;
>
>But get the error (using 3.6.14.2): SQLITE_ERROR - near "on": syntax error
>
>I found that syntax at the mail archives:
>
>http://thread.gmane.org/gmane.comp.db.sqlite.general/1563
>http://thread.gmane.org/gmane.comp.db.sqlite.general/5200
>http://thread.gmane.org/gmane.comp.db.sqlite.general/2276
>http://thread.gmane.org/gmane.comp.db.sqlite.general/1562
>
>I also tried the syntax found in the SQL wikipedia page:
>
>BEGIN;
>[..]
>IF ERRORS=0 COMMIT;
>IF ERRORS<>0 ROLLBACK;
>
>Also no luck.
>
>Is there a way to set the conflict resolution for an entire transaction?

It's not part of the syntax of BEGIN.
http://www.sqlite.org/lang_transaction.html

As far as I can tell you'll have to use it in every INSERT
statement, which has implications for your program flow.
http://www.sqlite.org/lang_insert.html
http://www.sqlite.org/lang_conflict.html

(You probably already read those pages, I included the links
for the convenience of other readers)

>Luiz
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to