Re: [sqlite] Insert or Update (was: ON DELETE CASCADE along with ON CONFLICT REPLACE)

2010-10-19 Thread Pavel Ivanov
> 2. I suggest that you're better off doing the logic entirely in SQL, rather > than application code, for the sake of portability, data integrity and speed. I'd say this is a very bad advice for the developer using SQLite. First of all "insert or ignore" and "insert or replace" are not portable

Re: [sqlite] Insert or Update (was: ON DELETE CASCADE along with ON CONFLICT REPLACE)

2010-10-18 Thread Mihai Militaru
On Tue, 19 Oct 2010 10:54:13 +1100 BareFeetWare wrote: > -- alternatively you could do this, which will update the existing > row, if exists, or insert a new one if it doesn't: > > update users set "name" = 'Joe C', "type" = 4, where "id" = 1; > insert or ignore into users ("id", "type", "name")

[sqlite] Insert or Update (was: ON DELETE CASCADE along with ON CONFLICT REPLACE)

2010-10-18 Thread BareFeetWare
On 19/10/2010, at 8:10 AM, NSRT Mail account. wrote: > I would use the update if I knew the entry already existed. In my application > however, it doesn't know if the entry already exists. I was looking for > something to replace MySQL's ON DUPLICATE KEY UPDATE. > > I modified my application to