From 0619ecadc5f2882519944168b06638fd87802914 Mon Sep 17 00:00:00 2001 From: lambda-0x <0xlambda@protonmail.com> Date: Wed, 4 Dec 2024 21:26:55 +0530 Subject: [PATCH] opt(torii/core): add explicit limit to sql query Even though we where already using `fetch_one` to only fetch a single row, its documentation says to add a limit to the query explicitly. commit-id:c0a96916 --- crates/torii/core/src/executor/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/torii/core/src/executor/mod.rs b/crates/torii/core/src/executor/mod.rs index 82022d191a..acac0469f0 100644 --- a/crates/torii/core/src/executor/mod.rs +++ b/crates/torii/core/src/executor/mod.rs @@ -614,7 +614,7 @@ impl<'c, P: Provider + Sync + Send + 'static> Executor<'c, P> { let semaphore = self.semaphore.clone(); let provider = self.provider.clone(); let res = sqlx::query_as::<_, (String, String)>(&format!( - "SELECT name, symbol FROM {TOKENS_TABLE} WHERE contract_address = ?" + "SELECT name, symbol FROM {TOKENS_TABLE} WHERE contract_address = ? LIMIT 1" )) .bind(felt_to_sql_string(®ister_erc721_token.contract_address)) .fetch_one(&mut **tx)