mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-19 12:10:55 +00:00
Merge branch 'master' of https://github.com/peter-iakovlev/Postbox
This commit is contained in:
commit
81c4b66e31
@ -97,8 +97,8 @@ public final class Database {
|
|||||||
/// Executes a batch of SQL statements.
|
/// Executes a batch of SQL statements.
|
||||||
///
|
///
|
||||||
/// - parameter SQL: A batch of zero or more semicolon-separated SQL statements.
|
/// - parameter SQL: A batch of zero or more semicolon-separated SQL statements.
|
||||||
public func execute(_ SQL: String) {
|
public func execute(_ SQL: String) -> Bool {
|
||||||
sqlite3_exec(self.handle, SQL, nil, nil, nil)
|
return sqlite3_exec(self.handle, SQL, nil, nil, nil) == SQLITE_OK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,9 @@ public final class SqliteInterface {
|
|||||||
|
|
||||||
public init?(databasePath: String) {
|
public init?(databasePath: String) {
|
||||||
if let database = Database(databasePath) {
|
if let database = Database(databasePath) {
|
||||||
|
if !database.execute("pragma schema_version") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
self.database = database
|
self.database = database
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user