Mysql-native need some help please
bauss
jacobbauss at gmail.com
Sat Jan 17 17:18:41 UTC 2026
On Saturday, 17 January 2026 at 16:15:50 UTC, Lars Johansson
wrote:
> I'm exploring ways of accessing mysql and are now trying
> mysql-native I have the following code:
> range = conn.query("Show processlist");
> foreach (rad; range){
> writeln(rad[6]);
> }
> }
>
> now I want to test if rad[6] begins with "start", like 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.
More information about the Digitalmars-d-learn
mailing list