From 229008fef4182f5f18ce2d14f5cf16c061dcfcfd Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 21 Sep 2025 08:41:53 +0900 Subject: [PATCH] [+] add get_count_by_clause with list of binds --- controller/hk_sql_utils.anubis | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/controller/hk_sql_utils.anubis b/controller/hk_sql_utils.anubis index 034f313..6e14ab2 100644 --- a/controller/hk_sql_utils.anubis +++ b/controller/hk_sql_utils.anubis @@ -169,20 +169,30 @@ public define Int ( SQLite3DataBase db, String table_name, - String clause + String clause, + List(SQLite3Bind) binds )= // with final_clause = if clause = "" then // "" // else // "WHERE "+clause, - if sql_query_timeout(db, "SELECT COUNT(\""+table_name+".id\") FROM "+table_name+" "+clause+";", [], "get_count_by_clause") is + if sql_query_timeout(db, "SELECT COUNT(\""+table_name+".id\") FROM "+table_name+" "+clause+";", binds, "get_count_by_clause") is { error(sql_error) then println("get_count_by_clause SQL ERROR '"+ sql_error.text + "'\n table_name ["+table_name+"]\n clause ["+clause+";]");0, ok(_, cursor, _) then db_get_Int(cursor) } . +public define Int + get_count_by_clause + ( + SQLite3DataBase db, + String table_name, + String clause + )= + get_count_by_clause(db, table_name, clause, []) +. public define Int get_count -- libgit2 0.21.4