[sqlite] "override" table?

2011-07-20 Thread KeithB
I'd like to create a temporary table to "shadow" one of my persistent tables. It will have the same columns and hold "override" values that, when present, take precedence over the real values. So, I'd like to search for a row by primary key, looking first in the override table, and if not found, th

[sqlite] INSERT OR UPDATE?

2011-07-02 Thread KeithB
Is there any way to perform the equivalent of an INSERT OR UPDATE statement? I have something like this: CREATE TABLE t1 (id INTEGER PRIMARY KEY, value INTEGER); CREATE TABLE t2 (parent INTEGER REFERENCES t1 ON DELETE CASCADE, child INTEGER REFERENCES t1); INSERT INTO t1 VALUES(1,100); INSERT INT

[sqlite] INSERT OR UPDATE?

2011-07-01 Thread KeithB
Is there any way to perform the equivalent of an INSERT OR UPDATE statement? I have something like this: CREATE TABLE t1 (id INTEGER PRIMARY KEY, value INTEGER); CREATE TABLE t2 (parent INTEGER REFERENCES t1 ON DELETE CASCADE, child INTEGER REFERENCES t1); INSERT INTO t1 VALUES(1,100); INSERT INT