From 6df60761dfa8c210f11077476a4a474219c2419a Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 16 Oct 2021 20:57:41 +0200 Subject: [PATCH] [+] get list of DB_id from given SQLite 3 cursor. the DB_id must the first element in the row --- database/db_get_helpers.anubis | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+), 0 deletions(-) diff --git a/database/db_get_helpers.anubis b/database/db_get_helpers.anubis index c336612..ce95a81 100644 --- a/database/db_get_helpers.anubis +++ b/database/db_get_helpers.anubis @@ -184,7 +184,32 @@ public define Maybe(DB_id) } . +// sqlite3 API +public define List(DB_id) + db_get_List_DB_id + ( + One -> SQLite3Row table_cursor, + List(DB_id) so_far + ) = + if table_cursor(unique) is + { + error(sql_error) then logError("", "DB", db_error(sql_error, "db_get_List_DB_id")); reverse(so_far), + no_more_row then reverse(so_far), //can't find the symbol in the table, because the row is empty + row(explorer) then + with result = (Int)db_integer(explorer)(0), + db_get_List_DB_id(table_cursor, [db_id(result) . so_far]) + }. + +public define List(DB_id) + db_get_List_DB_id + ( + One -> SQLite3Row table_cursor + ) = + db_get_List_DB_id(table_cursor, []). + + /***********************************/ + /* SQLAPI */ public define List(Int) db_get_List_Int -- libgit2 0.21.4