Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. fun SQLiteDatabase.doesTableExistIncludingTemps(tableName: String): Boolean {
  2. val sql = """SELECT name
  3. FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master)
  4. WHERE type='table';"""
  5. val c = rawQuery(sql, null)
  6.  
  7. while (c.moveToNext()) {
  8. if (c.getString(0) == tableName) return true else continue
  9. }
  10.  
  11. return false
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement