std.database

Erik Smith via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 4 12:33:01 PST 2016


On Friday, 4 March 2016 at 19:27:47 UTC, Bubbasaur wrote:
> On Friday, 4 March 2016 at 18:42:45 UTC, Erik Smith wrote:
>>     auto db = createDatabase("file:///testdb");
>>     auto rowSet = db.connection().statement("select name,score 
>> from score").execute;
>>     foreach (r; rowSet) 
>> writeln(r[0].as!string,",",r[1].as!int);
>>
>> I'll track query as an alternative name for execute() and 
>> std.sql as alternative for std.database.
>
> Why not only:
>
> auto rowSet = db.connection().query("select name,scorefrom 
> score");
>
> Or instead of query maybe "returnRows" or just "rows", I think 
> the other way is too verbose.
>
> Bubba.

Agree connection execute is simpler and it is supported, although 
I need to add the bind version to connection as well.   The 
statement should only get involved when you need more specific 
control over the input binding.  I add returnRows/rows to the 
execute/query alternative name list.

erik



More information about the Digitalmars-d mailing list