From 78b7fc6169fc47e4d7d2fc63558621f10597b7aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 26 Mar 2017 13:32:01 +0200 Subject: [PATCH] Workaround PRAGMA table_info bug: check against SQLite version instead of build options --- GRDB/Core/Database.swift | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index f1684786c..97a2a079f 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -1136,16 +1136,13 @@ extension Database { // 1 | firstName | TEXT | 0 | NULL | 0 | // 2 | lastName | TEXT | 0 | NULL | 0 | - #if !USING_CUSTOMSQLITE && !USING_SQLCIPHER - if #available(iOS 8.2, OSX 10.10, *) { - } else { - // Work around a bug in SQLite where PRAGMA table_info would - // return a result even after the table was deleted. - if try !tableExists(tableName) { - throw DatabaseError(message: "no such table: \(tableName)") - } + if sqlite3_libversion_number() < 3008005 { + // Work around a bug in SQLite where PRAGMA table_info would + // return a result even after the table was deleted. + if try !tableExists(tableName) { + throw DatabaseError(message: "no such table: \(tableName)") } - #endif + } let columns = try ColumnInfo.fetchAll(self, "PRAGMA table_info(\(tableName.quotedDatabaseIdentifier))") guard columns.count > 0 else { throw DatabaseError(message: "no such table: \(tableName)")