Created
April 27, 2017 07:13
-
-
Save izmajlowiczl/7bae5426abb90f62735ade38d78bfeaa 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.doesTableExist(tableName: String): Boolean { | |
val sql = "SELECT name FROM sqlite_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