From 38c02a967cf446b1ef2c9a902a4825e8809eb14e Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 3 Dec 2024 14:41:55 +0100 Subject: [PATCH] fix: limit comes after order by --- src/db.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db.rs b/src/db.rs index 8a490db..7b4f762 100644 --- a/src/db.rs +++ b/src/db.rs @@ -67,7 +67,7 @@ impl Database { pub async fn get(&self, sid: i64, limit: i64) -> rusqlite::Result> { let db = self.0.lock().await; - let mut stmt = db.prepare("SELECT time, value FROM events WHERE service = :sid LIMIT :limit ORDER BY time DESC")?; + let mut stmt = db.prepare("SELECT time, value FROM events WHERE service = :sid ORDER BY time DESC LIMIT :limit")?; let results = stmt.query_map( named_params! { ":sid": sid, ":limit": limit }, |row| Ok((row.get(0)?, row.get(1)?)),