Re: [web-devel] [Haskell-cafe] [ANN] mysql-simple - your go-to package for talking to MySQL

On Tue, Jun 21, 2011 at 7:47 AM, David Virebayre wrote: The problem isn't with the stored procedure, it works if I call it
from the mysql client. Right - as I mentioned in my previous note, the problem is that stored
procedures and multi-statement queries can both return multiple result sets.
We can't easily use type inference to express the difference between "in
this use of query, I want a single result" (the common case) and "in this
other use of query, I expect three results, each with different shapes" (far
less common), so we need something like a multiQuery function (and perhaps a
MultiResult class) instead.
Another unrelated thing : the documentation states that the Query type is designed to make it difficult to create queries by concatenating
strings. You can do it, but you have to use the Monoid class's functions, e.g.:
"select " `mappend` "2 + 2"
For cases like your "show columns from" example, though, I prefer Chris's
suggestion of creating a custom newtype with its own special Param instance.
participants (1)
-
Bryan O'Sullivan