From ffbcac00d20f83d5e1346a38ef47c9e56b181f19 Mon Sep 17 00:00:00 2001 From: Luis Nassif Date: Tue, 18 Jul 2023 00:28:47 -0300 Subject: [PATCH] '#1774: fix column not found error if recoverDeletedRecords = false --- .../iped/parsers/whatsapp/ExtractorAndroid.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/whatsapp/ExtractorAndroid.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/whatsapp/ExtractorAndroid.java index 034cd0e2e7..61cea5dfc6 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/whatsapp/ExtractorAndroid.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/whatsapp/ExtractorAndroid.java @@ -347,6 +347,8 @@ private List 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) { @@ -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$