diff --git a/calexium_lib/database/db_utils.anubis b/calexium_lib/database/db_utils.anubis index 312cdc4..ab4c73f 100644 --- a/calexium_lib/database/db_utils.anubis +++ b/calexium_lib/database/db_utils.anubis @@ -91,3 +91,35 @@ public define Maybe(SQLite3HeadersOrRow -> SQLite3Row) error(sql_error) then logError("DB", db_error(sql_error,msg));failure, ok(cursor) then success(cursor) }. + +// -- Extractors HELPERS --------------- + +public define List(String) + db_get_string_list + ( + SQLite3HeadersOrRow -> SQLite3Row table_cursor, + List(String) so_far + ) = + if table_cursor(next_row) is + { + error(sql_error) then logError("DB", db_error(sql_error, "db_get_string_list")); 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 s = text(explorer)(0), + db_get_string_list(table_cursor, [s . so_far]) + }. + +public define List(Int32) + db_get_integer_list + ( + SQLite3HeadersOrRow -> SQLite3Row table_cursor, + List(Int32) so_far + ) = + if table_cursor(next_row) is + { + error(sql_error) then logError("DB", db_error(sql_error, "db_get_integer_list")); 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 s = (Int32)db_integer(explorer)(0), + db_get_integer_list(table_cursor, [s . so_far]) + }. -- libgit2 0.21.4