我们经常会用到如果数据库存在则更新,如果不存在则新增
sql一般写为
if exists(select * from table where tableid=1)
insert into table ...
else
update table ....
但是sqlite里没有if exists这种写法,它用的是一种更简单的语句
insert or replace into Forum(forumid, forumname, typeid, forumurl) values(1, 'db', 2, 'http://www.db.com')