Skip to content

Commit

Permalink
'#1774: fix column not found error if recoverDeletedRecords = false
Browse files Browse the repository at this point in the history
  • Loading branch information
lfcnassif committed Jul 18, 2023
1 parent 0534f11 commit ffbcac0
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ private List<Message> extractMessages(Connection conn, WAContact remote, boolean
query = SELECT_MESSAGES_NO_MEDIA_DURATION;
} else if (!hasMediaCaptionCol) {
query = SELECT_MESSAGES_NO_MEDIA_CAPTION;
} else if (!hasForwardedCol) {
query = SELECT_MESSAGES_NO_FORWARDED;
} else if (hasThumbTable) {
query = SELECT_MESSAGES_THUMBS_TABLE;
} else if (hasEditVersionCol) {
Expand Down Expand Up @@ -662,19 +664,28 @@ protected Message.MessageType decodeMessageType(int messageType, int status, Int
+ "key_from_me as fromMe, timestamp, media_url as mediaUrl, " //$NON-NLS-1$
+ "media_mime_type as mediaMime, media_size as mediaSize, media_name as mediaName, " //$NON-NLS-1$
+ "media_wa_type as messageType, null as thumbData, latitude, longitude, " //$NON-NLS-1$
+ "(forwarded & 1) as forwarded, " //$NON-NLS-1$
+ "NULL as forwarded, " //$NON-NLS-1$
+ "NULL as mediaCaption, media_hash as mediaHash, raw_data as rawData FROM " //$NON-NLS-1$
+ "messages WHERE remoteId=? and status!=-1 ORDER BY timestamp"; //$NON-NLS-1$

private static final String SELECT_MESSAGES_NO_MEDIA_CAPTION = "SELECT _id AS id, key_remote_jid " //$NON-NLS-1$
+ "as remoteId, remote_resource AS remoteResource, status, data, " //$NON-NLS-1$
+ "key_from_me as fromMe, timestamp, media_url as mediaUrl, " //$NON-NLS-1$
+ "media_mime_type as mediaMime, media_size as mediaSize, media_name as mediaName, " //$NON-NLS-1$
+ "media_wa_type as messageType, null as thumbData, latitude, longitude, media_duration, " //$NON-NLS-1$
+ "(forwarded & 1) as forwarded, " //$NON-NLS-1$
+ "NULL as forwarded, " //$NON-NLS-1$
+ "NULL as mediaCaption, media_hash as mediaHash, raw_data as rawData FROM " //$NON-NLS-1$
+ "messages WHERE remoteId=? and status!=-1 ORDER BY timestamp"; //$NON-NLS-1$

private static final String SELECT_MESSAGES_NO_FORWARDED = "SELECT _id AS id, key_remote_jid " //$NON-NLS-1$
+ "as remoteId, remote_resource AS remoteResource, status, data, " //$NON-NLS-1$
+ "key_from_me as fromMe, timestamp, media_url as mediaUrl, " //$NON-NLS-1$
+ "media_mime_type as mediaMime, media_size as mediaSize, media_name as mediaName, " //$NON-NLS-1$
+ "media_wa_type as messageType, null as thumbData, latitude, longitude, media_duration, " //$NON-NLS-1$
+ "NULL as forwarded, " //$NON-NLS-1$
+ "media_caption as mediaCaption, media_hash as mediaHash, raw_data as rawData FROM " //$NON-NLS-1$
+ "messages WHERE remoteId=? and status!=-1 ORDER BY timestamp"; //$NON-NLS-1$

private static final String SELECT_MESSAGES_NO_THUMBS_TABLE = "SELECT _id AS id, key_remote_jid " //$NON-NLS-1$
+ "as remoteId, remote_resource AS remoteResource, status, data, " //$NON-NLS-1$
+ "key_from_me as fromMe, timestamp, media_url as mediaUrl, " //$NON-NLS-1$
Expand Down

0 comments on commit ffbcac0

Please sign in to comment.