Peter, is "INSTEAD OF" trigger not available on your version of SQLite?
https://sqlite.org/lang_createtrigger.html#instead_of_trigger
CREATE VIEW mytable_UPSERT AS SELECT * FROM mytable;
CREATE TRIGGER mytable_UPSERT INSTEAD OF INSERT ON mytable_UPSERT BEGIN
-->INSERT OR IGNORE ... ;
-->UPDATE ..
execute(sqlUpdate, alldata)
cr.execute(sqlInsert, alldata)
id = None
try:
for row in cr.execute(sqlSelect):
id = row[0]
except:
pass
cr.execute('RELEASE %s%s;' % ('UpSert', table))
cr.close()
return id
---
The fact tha
Thursday, March 22, 2018, 7:18:08 PM, Peter Michaux wrote:
> I think there are a couple main offenders with
>> BEGIN;
>> INSERT OR IGNORE ... ;
>> UPDATE ;
>> COMMIT;
> The first is that it is bulky. If this is in the application code then it
> has to be repeated for each desired UPSERT and
I think there are a couple main offenders with
> BEGIN;
> INSERT OR IGNORE ... ;
> UPDATE ;
> COMMIT;
The first is that it is bulky. If this is in the application code then it
has to be repeated for each desired UPSERT and it has to be repeated in the
code of each application that uses the d
On Wed, 21 Mar 2018 14:05:07 -0700, Peter Michaux
wrote:
> You are right that my purpose does seem kind of confusing.
>
> What I really want is UPSERT to avoid doing an UPDATE, checking if the
> number of rows affected is zero, then doing an INSERT. The lack of UPSERT
> leads to a lot more applic
>Sent: Friday, 16 March, 2018 12:42
> >To: SQLite mailing list
> >Subject: Re: [sqlite] Bug? INSERT OR REPLACE not equivalent to DELETE
> >followed by INSERT
> >
> >Thank you for the information, Keith.
> >
> >It comes as a surprise to me that t
that there's a Highway to Hell but only a Stairway to
>Heaven says
>> a lot about anticipated traffic volume.
>>
>>
>> >-Original Message-
>> >From: sqlite-users [mailto:sqlite-users-
>> >boun...@mailinglists.sqlite.org] On Behalf Of P
Behalf Of Peter Michaux
Sent: Friday, March 16, 2018 2:42 PM
To: SQLite mailing list
Subject: Re: [sqlite] Bug? INSERT OR REPLACE not equivalent to DELETE followed
by INSERT
Thank you for the information, Keith.
It comes as a surprise to me that the conflict resolution clause of the
statement
arch, 2018 21:09
> >To: sqlite-users@mailinglists.sqlite.org
> >Subject: [sqlite] Bug? INSERT OR REPLACE not equivalent to DELETE
> >followed by INSERT
> >
> >Hi,
> >
> >I have read that INSERT OR REPLACE is equivalent to a DELETE followed
> >by an
&g
sts.sqlite.org] On Behalf Of Peter Michaux
>Sent: Monday, 12 March, 2018 21:09
>To: sqlite-users@mailinglists.sqlite.org
>Subject: [sqlite] Bug? INSERT OR REPLACE not equivalent to DELETE
>followed by INSERT
>
>Hi,
>
>I have read that INSERT OR REPLACE is equivalent to a
rg
>Subject: [sqlite] Bug? INSERT OR REPLACE not equivalent to DELETE
>followed by INSERT
>
>Hi,
>
>I have read that INSERT OR REPLACE is equivalent to a DELETE followed
>by an
>INSERT. I came across a case where that is not true.
>
>Set up a test case
>
>$ rm -f
Hi,
I have read that INSERT OR REPLACE is equivalent to a DELETE followed by an
INSERT. I came across a case where that is not true.
Set up a test case
$ rm -f asdf.sqlite && sqlite3 asdf.sqlite
sqlite> .mode columns
sqlite> .headers on
sqlite> PRAGMA foreign_keys=OFF;
sqli
12 matches
Mail list logo