How do I extract and convert datatypes from ResultRange

Anders S anders at xore.se
Mon Aug 26 13:49:21 UTC 2019


Hi guys,

I'm trying to read a post of different datatypes from MariaDB 
table into another message and pass it on into a FIFO pipe to an 
other application.

My code :
    string sql = "SELECT * FROM guirequest WHERE read_request = 
-1;";
     ResultRange range = conn.query(sql);
     Row row = range.front;
     int i, count = (to!int(range.rowCount));
     writeln("rowCount ", range.rowCount, "\n"); // sofar so good

The problem occurs when I wish to extract row data into string, 
int or short datatypes.
It complains on  int i = row[2]; with
Error: cannot implicitly convert expression row.opIndex(2u) of 
type VariantN!24u to int

Same for other datatypes.

Any ideas?
/a


More information about the Digitalmars-d-learn mailing list