Commit 25fea527b5c861ec50d7b95779d7a07de90b6099
1 parent
c7a326a8
[+] add get_db_ids_by_clause which return a list of DB_id according to provided clause
Showing
1 changed file
with
19 additions
and
0 deletions
Show diff stats
controller/hk_sql_utils.anubis
| @@ -127,6 +127,25 @@ public define List(Int) | @@ -127,6 +127,25 @@ public define List(Int) | ||
| 127 | } | 127 | } |
| 128 | . | 128 | . |
| 129 | 129 | ||
| 130 | +public define List(DB_id) | ||
| 131 | + get_db_ids_by_clause | ||
| 132 | + ( | ||
| 133 | + SQLite3DataBase db, | ||
| 134 | + String table_name, | ||
| 135 | + String clause | ||
| 136 | + )= | ||
| 137 | + with final_clause = if clause = "" then | ||
| 138 | + "" | ||
| 139 | + else | ||
| 140 | + "WHERE "+clause, | ||
| 141 | + | ||
| 142 | + if sql_query_timeout(db, "SELECT \"id\" FROM "+table_name+" "+final_clause+";", [], "get_ids_by_clause") is | ||
| 143 | + { | ||
| 144 | + error(_) then [], | ||
| 145 | + ok(_, cursor, _) then db_get_List_DB_id(cursor) | ||
| 146 | + } | ||
| 147 | +. | ||
| 148 | + | ||
| 130 | public define List(Int) | 149 | public define List(Int) |
| 131 | get_ids_by_clause | 150 | get_ids_by_clause |
| 132 | ( | 151 | ( |