Hi,
Am I correct in thinking that the standard library/compiler doesn't support
SQL "IN" statements? It's something that I use a lot in my programs, and in
psql for example you can just do:
SELECT *
FROM uw_lesson_lessons
WHERE uw_id in (1, 2, 3)
I made my own function to handle this, using a bunch of sql_or statements:
fun inlist
[a ::: Type]
[otherfields ::: {Type}]
[tablename :: Name]
[columnname :: Name]
[otherfields ~ [columnname = a]]
(_ : sql_injectable a)
(ids: list a)
: sql_exp ([tablename = [columnname = a] ++ otherfields]) ([]) ([]) bool
=
List.foldl
(fn id acc => (SQL {acc} OR {{tablename}}.{columnname} = {[id]}))
(WHERE {[False]})
ids
I'm not sure about the performance characteristics of this though. Anyway,
just wondering if it is already supported but I can't find it, or it's not
supported at all?
Thanks
Simon
_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur