From 25fea527b5c861ec50d7b95779d7a07de90b6099 Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 16 Oct 2021 20:45:12 +0200 Subject: [PATCH] [+] add get_db_ids_by_clause which return a list of DB_id according to provided clause --- controller/hk_sql_utils.anubis | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+), 0 deletions(-) diff --git a/controller/hk_sql_utils.anubis b/controller/hk_sql_utils.anubis index 6ec5210..b3d8a35 100644 --- a/controller/hk_sql_utils.anubis +++ b/controller/hk_sql_utils.anubis @@ -127,6 +127,25 @@ public define List(Int) } . +public define List(DB_id) + get_db_ids_by_clause + ( + SQLite3DataBase db, + String table_name, + String clause + )= + with final_clause = if clause = "" then + "" + else + "WHERE "+clause, + + if sql_query_timeout(db, "SELECT \"id\" FROM "+table_name+" "+final_clause+";", [], "get_ids_by_clause") is + { + error(_) then [], + ok(_, cursor, _) then db_get_List_DB_id(cursor) + } +. + public define List(Int) get_ids_by_clause ( -- libgit2 0.21.4