Cache SQL statements for reactions/attachment fetches
This commit is contained in:
parent
9956bd3ce0
commit
315f2ebbd1
@ -76,8 +76,8 @@ public class AttachmentStoreImpl: AttachmentStore {
|
||||
}
|
||||
let sql = "SELECT * FROM \(recordType.databaseTableName) WHERE \(filterClauses.joined(separator: " OR "));"
|
||||
do {
|
||||
var results = try RecordType
|
||||
.fetchAll(tx.databaseConnection, sql: sql, arguments: arguments)
|
||||
let statement = try tx.databaseConnection.cachedStatement(sql: sql)
|
||||
var results = try RecordType.fetchAll(statement, arguments: arguments)
|
||||
|
||||
// If we have one owner and are capable of sorting, sort in ascending order.
|
||||
if owners.count == 1, let orderInOwnerKey = RecordType.orderInOwnerKey {
|
||||
|
||||
@ -71,7 +71,8 @@ public class ReactionFinder {
|
||||
var reactions = [OWSReaction]()
|
||||
|
||||
do {
|
||||
let cursor = try OWSReaction.fetchCursor(transaction.database, sql: sql, arguments: [uniqueMessageId])
|
||||
let statement = try transaction.database.cachedStatement(sql: sql)
|
||||
let cursor = try OWSReaction.fetchCursor(statement, arguments: [uniqueMessageId])
|
||||
while let reaction = try cursor.next() {
|
||||
reactions.append(reaction)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user