[sqlite] insert or increment?

2015-03-20 Thread Felipe Gasper
Hello, I?m looking for logic like this: INSERT data ON CONFLICT oldrow.col1 += oldrow.col2 Does SQLite have anything that would make this simpler than: 1) UPDATE 2) if 0 rows updated, then INSERT Thank you! ?? -FG

[sqlite] insert or increment?

2015-03-20 Thread David King
Both of the answers here are pretty good if you have a primary key/unique constraint on the name https://stackoverflow.com/questions/3647454/increment-counter-or-insert-row-in-one-statement-in-sqlite My personal favourite is there as: BEGIN; INSERT OR IGNORE INTO observations VALUES (:src,