Mysql query result access by field name

kdevel kdevel at
Mon May 21 13:39:27 UTC 2018

On Sunday, 20 May 2018 at 16:08:03 UTC, ipkwena wrote:
> How does one access the columns fields in a Mysql query results 
> by the column name.


> Data f;
> = to!string(allrows[0][0]);
> f.surname = to!string(allrows[0][1]);
> f.title  = to!string(allrows[0][2]);
> I am using the mysql-native package or DB connectivity.

According to the source code it should be possible to write the rowdata into the struct:

    Data f;
    allrows[0].toStruct (f);

I haven't checked this.

More information about the Digitalmars-d-learn mailing list