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

Bryan O'Sullivan bos at serpentine.com
Tue Jun 21 18:49:27 CEST 2011

On Tue, Jun 21, 2011 at 7:47 AM, David Virebayre <dav.vire+haskell at gmail.com
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110621/96bb18e0/attachment.htm>

More information about the web-devel mailing list