Mysql-native need some help please

Lars Johansson lasse at 11dim.se
Sun Jan 18 08:26:11 UTC 2026


On Saturday, 17 January 2026 at 17:18:41 UTC, bauss wrote:
> On Saturday, 17 January 2026 at 16:15:50 UTC, Lars Johansson 
> wrote:

>> this:
>>     range = conn.query("Show processlist");
>>     	foreach (rad; range){
>>     	//	string stat = cast (string) rad[6];
>>     		if (rad[6].startsWith("start")){
>>     			writeln("match");
>>     		}
>>     	}
>>
>> whatever I try casting or comparing I'm stuck on errors 
>> pointing out I cannot cast/convert `VariantN!32LU` to string.
>>
>> I assumed an element range[] should be of type 'string', but 
>> it seems to be of type `VariantN!32LU` whatever that is.
>> I really need help. I'm stuck.
>
> You need to use .get!T on the variant, instead of casting.

Thank you it works like a charm.
I also found out that .toString works.
I should have been able to find toString immediately, but .get!T 
I probably never have found myself. Can you tell which one is 
best?
And the type `VariantN!32LU` why? It looks very odd to me.

I have tried to learn D a couple of times before, but always 
given up on odd things like `VariantN!32LU`. This time I try a 
bit harder. I do not learn well by books, courses or videos. I 
learn by solving a small problem I have and then expand. My 
intention is to build a compiler or an OS just for fun, or a 
world class SAP connector. Right now I am too busy with life and 
$work, the latter will end this year giving me more time for 
programming. I hope D will work for me. Again thanks for good and 
fast help.


More information about the Digitalmars-d-learn mailing list