<div dir="ltr">If I understand correctly you just want to re-execute the same query multiple times. There is method `reset` in HDBI already. Just call `reset` and statement return to it's initial state just after `prepare`, then execute `fetchAll` to get the result. Or just create new statement with `prepare` using the same query string or getting it from old statement with `originalQuery`.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/16 Gauthier Segay <span dir="ltr"><<a href="mailto:gauthier.segay@gmail.com" target="_blank">gauthier.segay@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> use `runFetchAll` it will return constructed Seq with results. But I would use conduits and conduit `selectAll` <a href="http://hackage.haskell.org/package/hdbi-conduit-1.3.0/docs/Data-Conduit-HDBI.html" target="_blank">http://hackage.haskell.org/package/hdbi-conduit-1.3.0/docs/Data-Conduit-HDBI.html</a>. Conduits are realy simple and effective.<br>

<br>
</div>I'm unsure I expressed the question properly, multiple results (rows)<br>
is definitely supported but multiple resultset does not seem to be.<br>
<br>
There are occurrences where you issue multiple select statements in a<br>
single roundtrip to the database, each select with potentially<br>
different row layout.<br>
<br>
After reading your answer, I actually tried (hdbc) calling the<br>
fetchRows function several times on Statement but it won't return<br>
anything past the first resultset.<br>
<br>
It seems the .net NextResults() approach is good because it let's you<br>
check whether or not there is a next resultset to fetch rows from, I<br>
think it would be necessary to have a similar approach if this is<br>
going to be supported.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Wed, Oct 16, 2013 at 6:03 AM, Alexey Uimanov <<a href="mailto:s9gf4ult@gmail.com">s9gf4ult@gmail.com</a>> wrote:<br>
>> ability to use named parameters<br>
><br>
> Yes. I dont know when It will be done, but it is on github issues already<br>
> <a href="https://github.com/s9gf4ult/hdbi/issues/3" target="_blank">https://github.com/s9gf4ult/hdbi/issues/3</a> .<br>
><br>
>> fetching multiple results returned from single statement<br>
><br>
> use `runFetchAll` it will return constructed Seq with results. But I would<br>
> use conduits and conduit `selectAll`<br>
> <a href="http://hackage.haskell.org/package/hdbi-conduit-1.3.0/docs/Data-Conduit-HDBI.html" target="_blank">http://hackage.haskell.org/package/hdbi-conduit-1.3.0/docs/Data-Conduit-HDBI.html</a>.<br>
> Conduits are realy simple and effective.<br>
><br>
> If you need something like nextresult just use method `fetch` of `Statement`<br>
> until it return Nothing. It is just the same. Or use ResumableSink from<br>
> conduits (I would).<br>
><br>
><br>
><br>
> 2013/10/16 Gauthier Segay <<a href="mailto:gauthier.segay@gmail.com">gauthier.segay@gmail.com</a>><br>
>><br>
>> Thanks for the announcement / library, I have started using hdbc (and<br>
>> it's odbc driver) recently and had two concerns with it so far:<br>
>><br>
>> * ability to use named parameters<br>
>><br>
>> (<a href="http://stackoverflow.com/questions/19137803/does-database-hdbc-support-named-parameters" target="_blank">http://stackoverflow.com/questions/19137803/does-database-hdbc-support-named-parameters</a>)<br>

>> * fetching multiple results returned from single statement<br>
>><br>
>> (<a href="http://stackoverflow.com/questions/19159287/hdbc-and-multiple-resultsets-in-a-single-statement-only-first-resultset-returne" target="_blank">http://stackoverflow.com/questions/19159287/hdbc-and-multiple-resultsets-in-a-single-statement-only-first-resultset-returne</a>)<br>

>> (in .net this is done via<br>
>><br>
>> <a href="http://msdn.microsoft.com/en-us/library/system.data.idatareader.nextresult.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/system.data.idatareader.nextresult.aspx</a>)<br>
>><br>
>> Is there any plan to get this supported in HDBI?<br>
>><br>
>> On Tue, Oct 15, 2013 at 7:55 PM, Alexey Uimanov <<a href="mailto:s9gf4ult@gmail.com">s9gf4ult@gmail.com</a>><br>
>> wrote:<br>
>> > Hello haskellers!<br>
>> ><br>
>> > HDBI is the fork of HDBC but reworked. It supports SQlite3 and<br>
>> > Postgresql<br>
>> > for now. It also supports streaming with coduits.<br>
>> > There is TH deriving mechanism to map database rows to Haskell<br>
>> > structures<br>
>> > and back. HDBI is trying to become simple<br>
>> > but still powerfull and flexible database interface. It must be suitable<br>
>> > to<br>
>> > become the common RDBMS interface  for higher level interfaces<br>
>> > like persistent or haskelldb.<br>
>> ><br>
>> > The documentation is not very good, while I have no enough time to make<br>
>> > some.<br>
>> ><br>
>> > In this version changed typeclass signatures of Connection and<br>
>> > Statement.<br>
>> > Now methods `run` and `execute` get any instance of `ToRow` and method<br>
>> > `fetch` return an instance of `FromRow`.<br>
>> > Note that [SqlValue] is also an instance of `FromRow` and `ToRow`<br>
>> > typeclasses so you do not loose the control.<br>
>> > Methods `fromRow` and `toRow` for [SqlValue] are just `id`. SQlite and<br>
>> > Postgresql drivers are fixed as well as hdbi-conduit.<br>
>> ><br>
>> > There is also new helper functions, like `onei :: Integer -> [SqlValue]`<br>
>> > which helps you to execute queries with one parameter<br>
>> > or execute many queries consistinf of one parameter.<br>
>> ><br>
>> > Prelude Database.HDBI Database.HDBI.SQlite> :set -XScopedTypeVariables<br>
>> > Prelude Database.HDBI Database.HDBI.SQlite> :set -XOverloadedStrings<br>
>> > Prelude Database.HDBI Database.HDBI.SQlite> c <- connectSqlite3<br>
>> > ":memory:"<br>
>> > Prelude Database.HDBI Database.HDBI.SQlite> runRaw c "create table<br>
>> > test(val<br>
>> > integer)"<br>
>> > Prelude Database.HDBI Database.HDBI.SQlite> withTransaction c $ runMany<br>
>> > c<br>
>> > "insert into test(val) values (?)" $ map one [1..1000]<br>
>> ><br>
>> > <interactive>:7:76: Warning:<br>
>> >     Defaulting the following constraint(s) to type `Integer'<br>
>> > .........<br>
>> ><br>
>> > Prelude Database.HDBI Database.HDBI.SQlite> r :: (Maybe Integer) <-<br>
>> > runFetchOne c "select sum(val) from test" ()<br>
>> > Prelude Database.HDBI Database.HDBI.SQlite> r<br>
>> > Just 500500<br>
>> ><br>
>> > Note here that the empty set is used as a parameter of query in<br>
>> > `runFetchOne`. Empty set is an instance of `FromRow` and `ToRow` and<br>
>> > return<br>
>> > an empty list of [SqlValue].<br>
>> > Use empty list as a parameters is bad idea, because we could instantiate<br>
>> > some another list of things, suppose the [Integer] as `FromRow` and<br>
>> > `ToRow` instance. So it would lead to ambigous type because [SqlValue]<br>
>> > is<br>
>> > also a list instantiating `FromRow` and `ToRow`.<br>
>> ><br>
>> > _______________________________________________<br>
>> > Haskell-Cafe mailing list<br>
>> > <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
>> > <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
>> ><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
><br>
</div></div></blockquote></div><br></div>