New Storage Refactor #404
|
@ -96,8 +96,8 @@ const getMessageBySignatureFromConversationSQLStmt = `select ID from channel_%d_
|
||||||
// getMessageByContentHashFromConversationSQLStmt is a template for selecting conversation messages by content hash
|
// getMessageByContentHashFromConversationSQLStmt is a template for selecting conversation messages by content hash
|
||||||
const getMessageByContentHashFromConversationSQLStmt = `select ID from channel_%d_%d_chat where ContentHash=(?) order by ID desc limit 1;`
|
const getMessageByContentHashFromConversationSQLStmt = `select ID from channel_%d_%d_chat where ContentHash=(?) order by ID desc limit 1;`
|
||||||
|
|
||||||
// getLocalIndexOfMessageIdSQLStmt is a template for fetching the offset of a message from the bottom of the database.
|
// getLocalIndexOfMessageIDSQLStmt is a template for fetching the offset of a message from the bottom of the database.
|
||||||
const getLocalIndexOfMessageIdSQLStmt = `select count (*) from channel_%d_%d_chat where ID >= (?) order by ID desc;`
|
const getLocalIndexOfMessageIDSQLStmt = `select count (*) from channel_%d_%d_chat where ID >= (?) order by ID desc;`
|
||||||
|
|
||||||
// getMessageCountFromConversationSQLStmt is a template for fetching the count of a messages in a conversation channel
|
// getMessageCountFromConversationSQLStmt is a template for fetching the count of a messages in a conversation channel
|
||||||
const getMessageCountFromConversationSQLStmt = `select count(*) from channel_%d_%d_chat;`
|
const getMessageCountFromConversationSQLStmt = `select count(*) from channel_%d_%d_chat;`
|
||||||
|
@ -546,7 +546,7 @@ func (cps *CwtchProfileStorage) GetRowNumberByMessageID(conversation int, channe
|
||||||
|
|
||||||
_, exists := cps.channelRowNumberStmts[channelID]
|
_, exists := cps.channelRowNumberStmts[channelID]
|
||||||
if !exists {
|
if !exists {
|
||||||
conversationStmt, err := cps.db.Prepare(fmt.Sprintf(getLocalIndexOfMessageIdSQLStmt, conversation, channel))
|
conversationStmt, err := cps.db.Prepare(fmt.Sprintf(getLocalIndexOfMessageIDSQLStmt, conversation, channel))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("error executing transaction: %v", err)
|
log.Errorf("error executing transaction: %v", err)
|
||||||
return -1, err
|
return -1, err
|
||||||
|
|
Loading…
Reference in New Issue