On Friday, 4 March 2016 at 14:44:48 UTC, Erik Smith wrote:
Actually I like this and I think it can work. I'm trying to
keep a single execute function name for both row/no-row
queries. I can still return the range proxy for no-row queries
that is either empty or throws on access.
Yes, that's the idea.
I'm just waiting for the code to settle a bit in a basic
working state before I refactor into a two layer design.
Another idea from previous attempts: rename `execute` to `query`.
foreach(row; db.query("select * from t"))
{ ... }
And name for package: std.sql
The result set is even iterator/stream, i.e. conceptually has
even less container properties than ranges themselves. Why
would you think of it as a container? I think it's ok as input
range. Anyway, this `execute` method is a frontend, i.e. it's
replaceable without touching the driver.
The range itself is an InputRange. The statement is acting as
a container only in that it is the source of the range and
holds the data. I agree that it is confusing to use the term
container although it seems to fit the definition of one.
`execute` should not return a statement, but a result set reader,
that would be a range. Yeah, the result set is indeed a range
conceptually: it has a definite number of ordered rows, a
beginning and an end.