mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-03 11:21:06 +00:00
no message
This commit is contained in:
parent
8c2020cd1c
commit
4701bcddb5
@ -1017,6 +1017,7 @@ final class MutableMessageHistoryView {
|
|||||||
|
|
||||||
public final class MessageHistoryView {
|
public final class MessageHistoryView {
|
||||||
public let id: MessageHistoryViewId
|
public let id: MessageHistoryViewId
|
||||||
|
public let tagMask: MessageTags?
|
||||||
public let anchorIndex: MessageIndex
|
public let anchorIndex: MessageIndex
|
||||||
public let earlierId: MessageIndex?
|
public let earlierId: MessageIndex?
|
||||||
public let laterId: MessageIndex?
|
public let laterId: MessageIndex?
|
||||||
@ -1028,6 +1029,7 @@ public final class MessageHistoryView {
|
|||||||
|
|
||||||
init(_ mutableView: MutableMessageHistoryView) {
|
init(_ mutableView: MutableMessageHistoryView) {
|
||||||
self.id = mutableView.id
|
self.id = mutableView.id
|
||||||
|
self.tagMask = mutableView.tagMask
|
||||||
self.anchorIndex = mutableView.anchorIndex.index
|
self.anchorIndex = mutableView.anchorIndex.index
|
||||||
|
|
||||||
var earlierId = mutableView.earlier?.index
|
var earlierId = mutableView.earlier?.index
|
||||||
|
@ -43,7 +43,7 @@ private struct SqlitePreparedStatement {
|
|||||||
sqlite3_clear_bindings(statement)
|
sqlite3_clear_bindings(statement)
|
||||||
}
|
}
|
||||||
|
|
||||||
func step(handle: OpaquePointer?, _ initial: Bool = false, path: String? = nil) -> Bool {
|
func step(handle: OpaquePointer?, _ initial: Bool = false, path: String?) -> Bool {
|
||||||
let res = sqlite3_step(statement)
|
let res = sqlite3_step(statement)
|
||||||
if res != SQLITE_ROW && res != SQLITE_DONE {
|
if res != SQLITE_ROW && res != SQLITE_DONE {
|
||||||
if initial {
|
if initial {
|
||||||
@ -114,7 +114,7 @@ private struct SqlitePreparedStatement {
|
|||||||
final class SqliteValueBox: ValueBox {
|
final class SqliteValueBox: ValueBox {
|
||||||
private let lock = NSRecursiveLock()
|
private let lock = NSRecursiveLock()
|
||||||
|
|
||||||
private let basePath: String
|
fileprivate let basePath: String
|
||||||
private var database: Database!
|
private var database: Database!
|
||||||
private var tables: [Int32: ValueBoxTable] = [:]
|
private var tables: [Int32: ValueBoxTable] = [:]
|
||||||
private var fullTextTables: [Int32: ValueBoxFullTextTable] = [:]
|
private var fullTextTables: [Int32: ValueBoxFullTextTable] = [:]
|
||||||
@ -274,7 +274,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
let status = sqlite3_prepare_v2(database.handle, "PRAGMA user_version", -1, &statement, nil)
|
let status = sqlite3_prepare_v2(database.handle, "PRAGMA user_version", -1, &statement, nil)
|
||||||
assert(status == SQLITE_OK)
|
assert(status == SQLITE_OK)
|
||||||
let preparedStatement = SqlitePreparedStatement(statement: statement)
|
let preparedStatement = SqlitePreparedStatement(statement: statement)
|
||||||
let _ = preparedStatement.step(handle: database.handle)
|
let result = preparedStatement.step(handle: database.handle, path: self.basePath)
|
||||||
let value = preparedStatement.int64At(0)
|
let value = preparedStatement.int64At(0)
|
||||||
preparedStatement.destroy()
|
preparedStatement.destroy()
|
||||||
return value
|
return value
|
||||||
@ -960,7 +960,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
|
|
||||||
var buffer: ReadBuffer?
|
var buffer: ReadBuffer?
|
||||||
|
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
buffer = statement.valueAt(0)
|
buffer = statement.valueAt(0)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -1017,7 +1017,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
|
|
||||||
startTime = currentTime
|
startTime = currentTime
|
||||||
|
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
startTime = CFAbsoluteTimeGetCurrent()
|
startTime = CFAbsoluteTimeGetCurrent()
|
||||||
|
|
||||||
let key = statement.keyAt(0)
|
let key = statement.keyAt(0)
|
||||||
@ -1052,7 +1052,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
|
|
||||||
startTime = currentTime
|
startTime = currentTime
|
||||||
|
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
startTime = CFAbsoluteTimeGetCurrent()
|
startTime = CFAbsoluteTimeGetCurrent()
|
||||||
|
|
||||||
let key = statement.int64KeyAt(0)
|
let key = statement.int64KeyAt(0)
|
||||||
@ -1102,7 +1102,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
|
|
||||||
startTime = currentTime
|
startTime = currentTime
|
||||||
|
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
startTime = CFAbsoluteTimeGetCurrent()
|
startTime = CFAbsoluteTimeGetCurrent()
|
||||||
|
|
||||||
let key = statement.keyAt(0)
|
let key = statement.keyAt(0)
|
||||||
@ -1136,7 +1136,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
|
|
||||||
startTime = currentTime
|
startTime = currentTime
|
||||||
|
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
startTime = CFAbsoluteTimeGetCurrent()
|
startTime = CFAbsoluteTimeGetCurrent()
|
||||||
|
|
||||||
let key = statement.int64KeyAt(0)
|
let key = statement.int64KeyAt(0)
|
||||||
@ -1170,7 +1170,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
|
|
||||||
startTime = currentTime
|
startTime = currentTime
|
||||||
|
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
startTime = CFAbsoluteTimeGetCurrent()
|
startTime = CFAbsoluteTimeGetCurrent()
|
||||||
|
|
||||||
let key = statement.keyAt(0)
|
let key = statement.keyAt(0)
|
||||||
@ -1201,7 +1201,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
|
|
||||||
startTime = currentTime
|
startTime = currentTime
|
||||||
|
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
startTime = CFAbsoluteTimeGetCurrent()
|
startTime = CFAbsoluteTimeGetCurrent()
|
||||||
|
|
||||||
let key = statement.int64KeyValueAt(0)
|
let key = statement.int64KeyValueAt(0)
|
||||||
@ -1227,25 +1227,25 @@ final class SqliteValueBox: ValueBox {
|
|||||||
|
|
||||||
if case .int64 = table.keyType {
|
if case .int64 = table.keyType {
|
||||||
let statement = self.insertOrReplaceStatement(table, key: key, value: value)
|
let statement = self.insertOrReplaceStatement(table, key: key, value: value)
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
}
|
}
|
||||||
statement.reset()
|
statement.reset()
|
||||||
} else {
|
} else {
|
||||||
var exists = false
|
var exists = false
|
||||||
let existsStatement = self.existsStatement(table, key: key)
|
let existsStatement = self.existsStatement(table, key: key)
|
||||||
if existsStatement.step(handle: self.database.handle) {
|
if existsStatement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
exists = true
|
exists = true
|
||||||
}
|
}
|
||||||
existsStatement.reset()
|
existsStatement.reset()
|
||||||
|
|
||||||
if exists {
|
if exists {
|
||||||
let statement = self.updateStatement(table, key: key, value: value)
|
let statement = self.updateStatement(table, key: key, value: value)
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
}
|
}
|
||||||
statement.reset()
|
statement.reset()
|
||||||
} else {
|
} else {
|
||||||
let statement = self.insertStatement(table, key: key, value: value)
|
let statement = self.insertStatement(table, key: key, value: value)
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
}
|
}
|
||||||
statement.reset()
|
statement.reset()
|
||||||
}
|
}
|
||||||
@ -1260,7 +1260,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
let startTime = CFAbsoluteTimeGetCurrent()
|
let startTime = CFAbsoluteTimeGetCurrent()
|
||||||
|
|
||||||
let statement = self.deleteStatement(table, key: key)
|
let statement = self.deleteStatement(table, key: key)
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
}
|
}
|
||||||
statement.reset()
|
statement.reset()
|
||||||
|
|
||||||
@ -1292,7 +1292,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let statement = statement {
|
if let statement = statement {
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
let resultCollectionId = statement.stringAt(0)
|
let resultCollectionId = statement.stringAt(0)
|
||||||
let resultItemId = statement.stringAt(1)
|
let resultItemId = statement.stringAt(1)
|
||||||
|
|
||||||
@ -1323,7 +1323,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let statement = self.fullTextInsertStatement(table, collectionId: collectionIdData, itemId: itemIdData, contents: contentsData, tags: tagsData)
|
let statement = self.fullTextInsertStatement(table, collectionId: collectionIdData, itemId: itemIdData, contents: contentsData, tags: tagsData)
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
}
|
}
|
||||||
statement.reset()
|
statement.reset()
|
||||||
|
|
||||||
@ -1339,7 +1339,7 @@ final class SqliteValueBox: ValueBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let statement = self.fullTextDeleteStatement(table, itemId: itemIdData)
|
let statement = self.fullTextDeleteStatement(table, itemId: itemIdData)
|
||||||
while statement.step(handle: self.database.handle) {
|
while statement.step(handle: self.database.handle, path: self.basePath) {
|
||||||
}
|
}
|
||||||
statement.reset()
|
statement.reset()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user