Commit 0cd6149f23ba72c9d0a9977740faf94ce7b4975e

Authored by Cédric RICARD
1 parent bb413fe2

Updating DB Extractors helpers for new SQLITE API

Showing 1 changed file with 34 additions and 0 deletions   Show diff stats
calexium_lib/database/db_utils.anubis
... ... @@ -87,6 +87,22 @@ public define Maybe(SQLite3HeadersOrRow -> SQLite3Row)
87 87 public define List(String)
88 88 db_get_string_list
89 89 (
  90 + One -> SQLite3Row table_cursor,
  91 + List(String) so_far
  92 + ) =
  93 + if table_cursor(unique) is
  94 + {
  95 + error(sql_error) then logError("DB", db_error(sql_error, "db_get_string_list")); reverse(so_far),
  96 + no_more_row then reverse(so_far), //can't find the symbol in the table, because the row is empty
  97 + row(explorer) then
  98 + with s = text(explorer)(0),
  99 + db_get_string_list(table_cursor, [s . so_far])
  100 + }.
  101 +
  102 +// Old sqlite3 API
  103 +public define List(String)
  104 + db_get_string_list
  105 + (
90 106 SQLite3HeadersOrRow -> SQLite3Row table_cursor,
91 107 List(String) so_far
92 108 ) =
... ... @@ -115,5 +131,23 @@ public define List(Int)
115 131 }.
116 132  
117 133  
  134 +public define List(Int)
  135 + db_get_integer_list
  136 + (
  137 + One -> SQLite3Row table_cursor,
  138 + List(Int) so_far
  139 + ) =
  140 + if table_cursor(unique) is
  141 + {
  142 + error(sql_error) then logError("DB", db_error(sql_error, "db_get_integer_list")); reverse(so_far),
  143 + no_more_row then reverse(so_far), //can't find the symbol in the table, because the row is empty
  144 + row(explorer) then
  145 + with s = (Int)db_integer(explorer)(0),
  146 + db_get_integer_list(table_cursor, [s . so_far])
  147 + }.
  148 +
  149 +
  150 +
  151 +
118 152  
119 153  
... ...