Commit 7db7d1ac99bddfb2f5697d669ec28eb7dc331903
1 parent
284fba03
Add get_db_id_by_full_clause with a list of bind
Showing
1 changed file
with
18 additions
and
0 deletions
Show diff stats
controller/hk_sql_utils.anubis
| ... | ... | @@ -310,6 +310,24 @@ public define List(DB_id) |
| 310 | 310 | get_db_ids_by_full_clause(db, table_name, id_col, full_clause, []) |
| 311 | 311 | . |
| 312 | 312 | |
| 313 | +public define Maybe(DB_id) | |
| 314 | + get_db_id_by_full_clause | |
| 315 | + ( | |
| 316 | + SQLite3DataBase db, | |
| 317 | + String table_name, | |
| 318 | + String id_col, | |
| 319 | + String full_clause, | |
| 320 | + List(SQLite3Bind) binds | |
| 321 | + )= | |
| 322 | + with the_list = get_db_ids_by_full_clause(db, table_name, id_col, full_clause, binds), | |
| 323 | + println("list size "+length(the_list)); | |
| 324 | + if the_list is | |
| 325 | + { | |
| 326 | + [] then failure, | |
| 327 | + [h . _] then success(h) | |
| 328 | + } | |
| 329 | +. | |
| 330 | + | |
| 313 | 331 | public define Maybe(Int) |
| 314 | 332 | get_mb_id_by_clause |
| 315 | 333 | ( | ... | ... |