From: Justin B. <jgb...@gm...> - 2008-04-04 15:51:25
|
On Fri, Apr 4, 2008 at 8:28 AM, Bjorn Bringert <bj...@br...> wrote: > this looks great. How do you substitute in values for parameters in queries? That's something I didn't look at, but is needed. Since I'm using haskelldb just to generate SQL I haven't concentrated on the runtime side. However, see below .. > Here, prepare and queryBind are something along these lines (but more > general to support multiple arguments, and with some type class > constraints): > > prepare :: Database -> (a -> Query (Rel b)) -> PreparedQuery (a -> Rel b) > > queryBind :: Database -> PreparedQuery (a -> Rel b) -> a -> IO [b] I like this, and I wonder if Peter's code (mentioned in another thread) addresses it. I'd be glad to take a shot at unifying the two approaches, once his patch is in. In any case, do you think the parameters should show up in the type of Query (Rel b)? Any ideas how that could look, and how to make sure queries can still be rendered to SQL w/o runtime values (so I can still get my SQL w/o having to execute it)? Justin |