summaryrefslogtreecommitdiffstats
path: root/src/libstat
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-16 13:39:16 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-16 13:39:16 +0100
commit277d0a32c3327a92fde4a9c8de15e51d2d4c6e89 (patch)
tree526a14df4ac8d1867237164b1016d6732d8c0575 /src/libstat
parent04b317274d893f3f0efbc23ed8481534c0a36014 (diff)
downloadrspamd-277d0a32c3327a92fde4a9c8de15e51d2d4c6e89.tar.gz
rspamd-277d0a32c3327a92fde4a9c8de15e51d2d4c6e89.zip
Revert "[Minor] Joins cleanup"
This reverts commit f803de985a63f31321f3f4fcbed656b692d7d756.
Diffstat (limited to 'src/libstat')
-rw-r--r--src/libstat/backends/sqlite3_backend.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c
index 9904e469b..cf7291ee0 100644
--- a/src/libstat/backends/sqlite3_backend.c
+++ b/src/libstat/backends/sqlite3_backend.c
@@ -151,8 +151,10 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] =
[RSPAMD_STAT_BACKEND_GET_TOKEN] = {
.idx = RSPAMD_STAT_BACKEND_GET_TOKEN,
.sql = "SELECT value FROM tokens "
- "WHERE token=?1 AND users=?2 "
- "AND (language=?3 OR language=0);",
+ "LEFT JOIN languages ON tokens.language=languages.id "
+ "LEFT JOIN users ON tokens.user=users.id "
+ "WHERE token=?1 AND (users.id=?2) "
+ "AND (languages.id=?3 OR languages.id=0);",
.stmt = NULL,
.args = "III",
.result = SQLITE_ROW,