queryValue returns a Nullable!Variant. Let's say it returns a long (In my case, I was querying a COUNT(*) to get the total rows)
My code I put was:
auto total = conn.queryValue("select count(*) from ...").get!long
But this doesn't work, because Nullable intercepts the get call! So instead I have to do:
auto total = conn.queryValue("select count(*) from ...").get.get!long
Which IMO is ugly and annoying. Really this is an issue with Nullable and Variant reusing the same member name, but I doubt that will change.
Is it possible to instead specify the type to queryValue itself, and have it return a Nullable!T? something like:
// no need for get here, I know I'm going to get a value
long total = conn.queryValue!long("select count(*) from ...");
queryValuereturns aNullable!Variant. Let's say it returns along(In my case, I was querying aCOUNT(*)to get the total rows)My code I put was:
But this doesn't work, because
Nullableintercepts thegetcall! So instead I have to do:Which IMO is ugly and annoying. Really this is an issue with
NullableandVariantreusing the same member name, but I doubt that will change.Is it possible to instead specify the type to
queryValueitself, and have it return aNullable!T? something like: