[Haskell-cafe] Fwd: hdbc parametrized select

Wilfried van Asten sniperrifle2004 at gmail.com
Thu Oct 18 12:32:12 CEST 2012


This was not sent to the cafe since I used the wrong from address.

---------- Forwarded message ----------
From: Asten, W.G.G. van (Wilfried, Student M-CSC)
<w.g.g.vanasten at student.utwente.nl>
Date: Thu, Oct 18, 2012 at 12:27 PM
Subject: Re: [Haskell-cafe] hdbc parametrized select
To: s9gf4ult at gmail.com
Cc: haskell-cafe at haskell.org


To my knowledge you can combine execute and the fetch functions like this:

find conn id =
  do
    stmt <- prepare conn "SELECT * FROM table WHERE id = ? LIMIT 1"
    excute stmt [id]
    row <- fetchRow stmt

On Thu, Oct 18, 2012 at 10:51 AM,  <s9gf4ult at gmail.com> wrote:
> does hdbc have parametrized selects ?
> There is execute
> execute :: Statement -> [SqlValue] -> IO Integer
> and some other functions which get list of parameters but return IO Integer or
> IO ()
> and there is other couple of functions
> fetchRow :: Statement -> IO (Maybe [SqlValue])
> which return values of select but do not get parameters
>
> How can i execute parametrized select with hdbc ?
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list