std.database

Sebastiaan Koppe via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 4 14:44:24 PST 2016


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);

You'll want to have some types in there. As in

struct S
{
   string name;
   int age;
}

auto rowSet = db.connection().statement("select name,score from 
score").executeAs!S;
foreach (r; rowSet) writeln(r.name,",",r.age);


More information about the Digitalmars-d mailing list