On Wed, Sep 30, 2009 at 11:58 AM, Sam Carleton <scarle...@gmail.com> wrote:
> On Wed, Sep 30, 2009 at 10:02 AM, Scott Hess <sh...@google.com> wrote:
>> Since SQLite is an embedded database, it generally does not pay to
>> count statements, unless they add additional disk I/O.  You can code
>> like this:
>>
>>  BEGIN
>>    SELECT ...
>>    if (select results A)
>>      INSERT ...
>>    else
>>      UPDATE ...
>>  END
>
> I am assuming the conditional stuff is pseudo code in the host
> language, in my case C+, not in SQLite's SQL.  Correct?
>
> In my case, my C+ code will ALWAYS know if it is an insert or update
> because the PK for the update will be greater the -1, for an insert
> the PK is always -1.  So, unless I am mistaken, there is no need to
> "check" for existence first.  Not being a DB guru, I might be making a
> fundamental mistake, though...

Guess I don't understand your question then.  Igor's response of "as
many statements as you need" is probably the right one.

-scott
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to