mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-15 07:28:30 +00:00
Possible fix for SQLite error.
This commit is contained in:
committed by
Nicholas
parent
d70213e031
commit
353434e1ef
@@ -56,6 +56,7 @@ import org.signal.core.util.requireNonNullString
|
||||
import org.signal.core.util.requireString
|
||||
import org.signal.core.util.select
|
||||
import org.signal.core.util.toOptional
|
||||
import org.signal.core.util.toSingleLine
|
||||
import org.signal.core.util.update
|
||||
import org.signal.core.util.withinTransaction
|
||||
import org.signal.libsignal.protocol.IdentityKey
|
||||
@@ -373,7 +374,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
||||
'${AttachmentTable.UPLOAD_TIMESTAMP}', ${AttachmentTable.TABLE_NAME}.${AttachmentTable.UPLOAD_TIMESTAMP}
|
||||
)
|
||||
) AS ${AttachmentTable.ATTACHMENT_JSON_ALIAS}
|
||||
"""
|
||||
""".toSingleLine()
|
||||
|
||||
private const val IS_STORY_CLAUSE = "$STORY_TYPE > 0 AND $REMOTE_DELETED = 0"
|
||||
private const val RAW_ID_WHERE = "$TABLE_NAME.$ID = ?"
|
||||
@@ -1881,7 +1882,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
||||
$where
|
||||
GROUP BY
|
||||
$TABLE_NAME.$ID
|
||||
"""
|
||||
""".toSingleLine()
|
||||
|
||||
if (reverse) {
|
||||
rawQueryString += " ORDER BY $TABLE_NAME.$ID DESC"
|
||||
|
||||
@@ -25,3 +25,20 @@ fun String.asListContains(item: String): Boolean {
|
||||
fun String?.emptyIfNull(): String {
|
||||
return this ?: ""
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns a multi-line string into a single-line string stripped of indentation, separated by spaces instead of newlines.
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* a
|
||||
* b
|
||||
* c
|
||||
*
|
||||
* turns into
|
||||
*
|
||||
* a b c
|
||||
*/
|
||||
fun String.toSingleLine(): String {
|
||||
return this.trimIndent().split("\n").joinToString(separator = " ")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user