Add a preconditionValidQueue to Database.tableExists()

This commit is contained in:
Gwendal Roué committed 2016-02-09 08:53:41 +01:00
1 parent 48ad154079
commit 18b01ca0c5
1 file changed
+2
+2
View File
@@ -607,6 +607,8 @@ extension Database {
/// Returns whether a table exists.
public func tableExists(tableName: String) -> Bool {
preconditionValidQueue()
// SQlite identifiers are case-insensitive, case-preserving (http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html)
return Row.fetchOne(self,
"SELECT sql FROM sqlite_master WHERE type = 'table' AND LOWER(name) = ?",