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;
f.name = 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 https://github.com/mysql-d/mysql-native/blob/master/source/mysql/result.d it should be possible to write the rowdata into the struct:

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

I haven't checked this.

Reply via email to