Re: [sqlite] Increment counter or insert row in one statement

2010-09-08 Thread Zack Weinberg
Igor Tandetnik wrote: > Zack Weinberg wrote: [...] >> Is it possible to do this operation in one SQLite statement? > > insert or replace into observations > values (:src, :dest, :verb, > coalesce( >(select occurrences from observations > where src=:src and dest=:dest

Re: [sqlite] Increment counter or insert row in one statement

2010-09-08 Thread Zack Weinberg
On Tue, Sep 7, 2010 at 4:45 AM, Simon Slavin wrote: > On 7 Sep 2010, at 4:34am, Zack Weinberg wrote: > >> I'm not subscribed to the mailing list, please cc: me on replies. > > No.  If you don't read a mailing list, don't post to it. I have one question. You should not

Re: [sqlite] Increment counter or insert row in one statement

2010-09-07 Thread Oliver Peters
Simon Slavin writes: > > This is the last message I'm sending to you. > slow down - life can be so easy http://www.youtube.com/watch?v=bf3ohrAIetg greetings Oliver ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Increment counter or insert row in one statement

2010-09-07 Thread Simon Slavin
On 7 Sep 2010, at 4:09pm, Zack Weinberg wrote: > On Tue, Sep 7, 2010 at 4:45 AM, Simon Slavin wrote: >> On 7 Sep 2010, at 4:34am, Zack Weinberg wrote: >> >>> I'm not subscribed to the mailing list, please cc: me on replies. >> >> No. If you don't read a mailing list,

Re: [sqlite] Increment counter or insert row in one statement

2010-09-07 Thread Igor Tandetnik
Zack Weinberg wrote: > I have this database schema: > > CREATE TABLE observations ( >src TEXT, >dest TEXT, >verb TEXT, >occurrences INTEGER > ); > CREATE UNIQUE INDEX observations_index >ON observations (src, dest, verb); > > My program receives a stream of

Re: [sqlite] Increment counter or insert row in one statement

2010-09-07 Thread Simon Slavin
On 7 Sep 2010, at 4:34am, Zack Weinberg wrote: > I'm not subscribed to the mailing list, please cc: me on replies. No. If you don't read a mailing list, don't post to it. Part of the reason is this: we may have already answered a very similar question recently, and we don't see why we should

[sqlite] Increment counter or insert row in one statement

2010-09-07 Thread Zack Weinberg
I have this database schema: CREATE TABLE observations ( src TEXT, dest TEXT, verb TEXT, occurrences INTEGER ); CREATE UNIQUE INDEX observations_index ON observations (src, dest, verb); My program receives a stream of events, which are (src, dest, verb) tuples. On every