std.database
Sebastiaan Koppe via Digitalmars-d
digitalmars-d at puremagic.com
Sat Mar 5 00:59:30 PST 2016
On Friday, 4 March 2016 at 23:55:55 UTC, Erik Smith wrote:
> I think some basic object serialization capabilities would be
> great although I'm not sure how the bare names can be accessed
> like that through the rowSet How would that work?
I did a project a while back using mysql-native (see
code.dlang.org) and it has a `toStruct` function on its Row type.
Maybe have a look there.
To access the bare named RowSet would have to be templated on the
struct.
Follows code from said project:
template executeAs(Type)
{
struct TypedSQLSequence
{
ResultSequence rs;
alias rs this;
@property Type front()
{
Row r = rs.front;
Type temp;
r.toStruct!Type(temp);
return temp;
}
}
auto executeAs(ref mysql.connection.ResultSequence rs)
{
return TypedSQLSequence(rs);
}
}
More information about the Digitalmars-d
mailing list