ManagedSQLiteOpenHelper帮助程序基础结构执行此操作的最佳方法。

 database.use { 
     // what should go in here??? 
     } 

我不一定要查询一个不存在的表,从而抛出异常和使用,作为逻辑控制的形式,有没有更好的办法?

回答了我自己的问题。

这工作

this.query("sqlite_master", arrayOf("name"), "name='userInfo' AND type='table'", null,null,null, null,null).count 

您可以使用此:

db.use{ 
    select("youtTableName").whereSimple("fieldId = ?",id).exec { 
     //your code here 
    } 
} 

相关推荐