mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-01 08:45:48 +00:00
no message
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user