Re: [sqlite] UPSERT again

2012-01-12 Thread Black, Michael (IS)
on Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Tony Caras [tca...@yahoo.com] Sent: Thursday, January 12, 2012 6:48 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] UPSERT again There aren't any tr

Re: [sqlite] UPSERT again

2012-01-12 Thread Simon Slavin
On 13 Jan 2012, at 12:42am, Tony Caras wrote: > No, the insert I referred to actually is an INSERT OR REPLACE, but it doesn't > work because a REPLACE really is a DELETE the original and INSERT the new. > So in the example if the blocked field was true in the original record and > true in

Re: [sqlite] UPSERT again

2012-01-12 Thread Black, Michael (IS)
Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Tony Caras [tca...@yahoo.com] Sent: Thursday, January 12, 2012 6:48 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] UPSERT again There aren't any true

Re: [sqlite] UPSERT again

2012-01-12 Thread Tony Caras
There aren't any true updates, all updates are done using the INSERT OR REPLACE. From: jr <creature.eter...@gmail.com> To: sqlite-users@sqlite.org Sent: Thursday, January 12, 2012 5:47 PM Subject: Re: [sqlite] UPSERT again On 13/01/12 00:17, Tony Caras

Re: [sqlite] UPSERT again

2012-01-12 Thread jr
On 13/01/12 00:17, Tony Caras wrote: UPSERT (really means update the record if it exists otherwise insert the record) AFTER INSERT (I meant a trigger after an insert. In this case I have access to the new value but not the "old" values in the record.) If UPDATE would insert the record if it

Re: [sqlite] UPSERT again

2012-01-12 Thread Tony Caras
e-users@sqlite.org> Sent: Thursday, January 12, 2012 5:37 PM Subject: Re: [sqlite] UPSERT again Does REPLACE do what you want? http://www.sqlite.org/lang_replace.html   Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop

Re: [sqlite] UPSERT again

2012-01-12 Thread Black, Michael (IS)
[sqlite-users-boun...@sqlite.org] on behalf of Tony Caras [tca...@yahoo.com] Sent: Thursday, January 12, 2012 6:17 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] UPSERT again UPSERT (really means update the record if it exists otherwise insert the record) AFTER INSERT (I

Re: [sqlite] UPSERT again

2012-01-12 Thread Tony Caras
could use the trigger you have suggested. From: Simon Slavin <slav...@bigfraud.org> To: Tony Caras <tca...@yahoo.com>; General Discussion of SQLite Database <sqlite-users@sqlite.org> Sent: Thursday, January 12, 2012 4:40 PM Subject: Re: [sqlite] UP

Re: [sqlite] UPSERT again

2012-01-12 Thread Simon Slavin
On 12 Jan 2012, at 11:20pm, Tony Caras wrote: > The problem is, that if I create AFTER INSERT then I don't know what the > original state of the blocked field was so I don't whether to increment or > decrement or leave the counter alone. I don't understand what you mean by 'UPSERT' or

[sqlite] UPSERT again

2012-01-12 Thread Tony Caras
I know there have been discussions in the past about workarounds for UPSERT but I recently encountered another one and I haven't figure out a good workaround.  Any assistance would be greatly appreciated. I have a situation where I need to increment a counter in another table every time a