From: Bjorn B. <bri...@cs...> - 2006-07-05 22:39:26
|
On Jul 5, 2006, at 3:20 PM, Matthias Radestock wrote: > I want to be able to select records from a table based on a list of =20= > ids > I have been given. In SQL I would write > > SELECT ... FROM ... WHERE id IN (10,2,13,4,...) > > How do I do this in haskelldb? > > Looking at the haskelldb code and docs, it appears that the 'IN' > operator isn't implemented - it's present in PrimQuery but nothing at > the higher-levels produces it. > > Have I missed something? Is there perhaps a different way to construct > these kinds of queries? That would be a nice feature to have, but it isn't implemented at the =20= moment. You are very welcome to have a go at it and send me a patch. One workaround that I have used (I don't know why I didn't just =20 implement IN instead) is to use something like: t <- ... restrict (foldr (\x y -> t!field .=3D=3D. x .||. y) (const True) values) (not actual tested code, I just made it up since I couldn't find =20 where I had done it). That is, just use a disjunction of a bunch of =20 equalities. /Bj=F6rn |