no message

This commit is contained in:
Peter
2018-09-17 20:32:03 +01:00
parent e4fe95a358
commit 4ecd357a33
2 changed files with 15 additions and 2 deletions

View File

@@ -110,7 +110,20 @@ public final class SqliteInterface {
public func unlock(password: Data) -> Bool {
return password.withUnsafeBytes { (bytes: UnsafePointer<Int8>) -> Bool in
return sqlite3_key(self.database.handle, bytes, Int32(password.count)) == SQLITE_OK
if sqlite3_key(self.database.handle, bytes, Int32(password.count)) != SQLITE_OK {
return false
}
var statement: OpaquePointer? = nil
let status = sqlite3_prepare_v2(self.database.handle, "SELECT * FROM SQLITE_MASTER", -1, &statement, nil)
if status != SQLITE_OK {
return false
}
let preparedStatement = SqlitePreparedStatement(statement: statement)
if !preparedStatement.step(handle: self.database.handle, true, path: "") {
return false
}
preparedStatement.destroy()
return true
}
}

View File

@@ -15,7 +15,7 @@ private func checkTableKey(_ table: ValueBoxTable, _ key: ValueBoxKey) {
}
}
private struct SqlitePreparedStatement {
struct SqlitePreparedStatement {
let statement: OpaquePointer?
func bind(_ index: Int, data: UnsafeRawPointer, length: Int) {