martinrotter / rssguard

Feed reader (and podcast player) which supports RSS/ATOM/JSON and many web-based feed services.
GNU General Public License v3.0
1.64k stars 125 forks source link

Fix LIKE statements using double quotes instead of single ones #1481

Closed martymac closed 2 months ago

martymac commented 3 months ago

Hello,

Thanks for developping rssguard.

On FreeBSD, rssguard 4.6.6 does not list any feed entry at all and the following critical errors appears on stderr :

time="     0.353" type="critical" -> message-model: Error when setting new msg view query: 'no such column: "%." - should this be a string literal in single-quotes? Unable to execute statement'.
time="     0.353" type="critical" -> message-model: Used SQL select statement: 'SELECT Messages.id, Messages.is_read, Messages.is_important, Messages.is_deleted, Messages.is_pdeleted, Messages.feed, Messages.title, Messages.url, Messages.author, Messages.date_created, Messages.contents, Messages.enclosures, Messages.score, Messages.account_id, Messages.custom_id, Messages.custom_hash, Feeds.title, Feeds.is_rtl, CASE WHEN LENGTH(Messages.enclosures) > 10 THEN 'true' ELSE 'false' END AS has_enclosures, (SELECT GROUP_CONCAT(Labels.name) FROM Labels WHERE Messages.labels LIKE "%." || Labels.custom_id || ".%") as msg_labels, Messages.labels FROM Messages LEFT JOIN Feeds ON Messages.feed = Feeds.custom_id AND Messages.account_id = Feeds.account_id WHERE 0 > 1;'.

It seems that comes from using double-quotes instead of single ones in LIKE statements.

The attached patch fixes the situation and allows feeds to be displayed correctly.

Cheers,

Ganael.

martinrotter commented 2 months ago

https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted