Wesley W. Terpstra wrote:
val Iterator1a = SQL.execute Query1 ("parameter1" & 2)
val Iterator1b = SQL.execute Query1 ("foobar" & 3)
val Iterator2 = SQL.execute Query2 4
case Iterator1a () of
NONE => print "End of this table"
| SOME (x & y) => print ("Got a row: " ^ x ^ ", " ^ Int.toString y ^
"\n")
case Iterator1b () of
NONE => print "End of the table"
| SOME (x & y) => print ("Got a row: " ^ x ^ ", " ^ Int.toString y ^
"\n")
case Iterator1a () of
NONE => print "End of this table"
| SOME (x & y) => print ("Got a row: " ^ x ^ ", " ^ Int.toString y ^
"\n")
The point is that here I use the same prepared query twice, with two
different associated states and bindings. It seems this sort of
interface is impossible at the moment without reparsing the SQL
statement again. Even if I choose not to expose the 'step' method as
an iterator, during the processing of a query's results there's
nothing I can do to prevent a user from executing the query again.
Wesley,
You will have to explain how SML works.
In your example, what exactly does this statement Do?
val Iterator1a = SQL.execute Query1 ("parameter1" & 2)
Does it execute the query to completion, does it only bind the
parameters, or does it also take the first step? If the first, then you
are simply iterating through the results and your queries are in fact
not executing at the same time. If the second or third are true it seem
to me you have a mismatch between your execute semantics and sqlite's
prepare, bind, and step semantics.
I am assuming that the Iterator1a() type "calls" are stepping the query
and returning the next result row using the sqlite_column_* API functions.
Dennis Cote
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------