Created
April 27, 2017 07:15
-
-
Save izmajlowiczl/3b5977264de2de5f5b029b31b04df29f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun SQLiteDatabase.doesTableExistIncludingTemps(tableName: String): Boolean { | |
val sql = """SELECT name | |
FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) | |
WHERE type='table';""" | |
val c = rawQuery(sql, null) | |
while (c.moveToNext()) { | |
if (c.getString(0) == tableName) return true else continue | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment