Eric S. Johansson <[EMAIL PROTECTED]> wrote:
I'm trying to figure out how to do do the following:

if the record exists
  Update record with calculation ( a = a + v)
else
  insert record with default values

It seems like the "insert or replace into" capabilities is close to
what I need but I can't figure out how to update with a default on
the first record and update with a calculation on existing records.

I can't think of any way to avoid two requests. Run the update statement, use sqlite3_changes to check whether any row has actually been updated. If not, run the insert.

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to