由于可以在文档中看到的语法,使插入或更新为:插入或更换成<表> (小于列>)VALUES(小于值>)
,我的问题是那里合并以下
as can be seen in the documentation the syntax to make insert or update is : INSERT OR REPLACE INTO <table> (<columns>) VALUES (<values>)
, my question is there any function that merge the following ?
public long insert (String table, String nullColumnHack, ContentValues values)
public int update (String table, ContentValues values, String whereClause, String[] whereArgs)
或它必须用prepared SQL语句并rawQuery?
or it has to be done with a prepared SQL statement and rawQuery?
什么是最好的做法,以做到在Android中插入或更新?
What's the best practices to do an insert or update in Android?
这是你的方法SQLiteDatabase.insertWithOnConflict().要了解它是指在SQLite的这个文件
this is your method SQLiteDatabase.insertWithOnConflict(). to understand what it does refer to this document on sqlite