[Haskell-cafe] hdbc parametrized select

9 views
Skip to first unread message

s9gf...@gmail.com

unread,
Oct 18, 2012, 4:51:01 AM10/18/12
to haskel...@haskell.org
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
Haskel...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Wilfried van Asten

unread,
Oct 18, 2012, 6:32:12 AM10/18/12
to haskell-cafe
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.v...@student.utwente.nl>
Date: Thu, Oct 18, 2012 at 12:27 PM
Subject: Re: [Haskell-cafe] hdbc parametrized select
To: s9gf...@gmail.com
Cc: haskel...@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
Reply all
Reply to author
Forward
0 new messages