commit 277d0a3: Revert "[Minor] Joins cleanup"

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Apr 16 12:42:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-04-16 13:39:16 +0100
URL: https://github.com/rspamd/rspamd/commit/277d0a32c3327a92fde4a9c8de15e51d2d4c6e89 (HEAD -> master)

Revert "[Minor] Joins cleanup"
This reverts commit f803de985a63f31321f3f4fcbed656b692d7d756.

---
 src/libstat/backends/sqlite3_backend.c | 6 ++++--
 1 file 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,


More information about the Commits mailing list