Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queryValue: result of 1 row & field NULL check inconsistency / error #133

Closed
Marenz opened this issue Sep 27, 2017 · 2 comments
Closed

queryValue: result of 1 row & field NULL check inconsistency / error #133

Marenz opened this issue Sep 27, 2017 · 2 comments
Labels
Milestone

Comments

@Marenz
Copy link

Marenz commented Sep 27, 2017

The documentation for queryValue() says:

If the query DID produce a result, but the value actually received is NULL, then result.isNull will be FALSE, and result.get will produce a Variant which CONTAINS null. Check for this with result.get.type == typeid(typeof(null)).

This turns out to be either false or at least incosistent. My Field type is bigint(20) unsigned NULL. I receive one row with one column and the value is null.

I do

auto value = prep.queryValue();

assert(!value.isNull); // works
assert(value.get.type == typeid(typeof(null))); // fails

After some investigation it turns out the actual type is void.
The reason for that is this line

It turns out, binary is true for my query thus the loop is skipped, thus the setting to null is never done

@Marenz Marenz changed the title queryValue: result of one row & field NULLcheck inconsistency / error queryValue: result of 1 row & field NULL check inconsistency / error Sep 27, 2017
@Abscissa Abscissa added this to the v1.2.0 milestone Dec 12, 2017
@Abscissa Abscissa added the bug label Dec 13, 2017
@Abscissa
Copy link

Abscissa commented Dec 13, 2017

This is indeed a bug. It appears prepared statements aren't necessary to trigger it, the BIGINT(20) alone appears to be sufficient to trigger. (Actually, even TINYINT does it for me.)

@Abscissa
Copy link

Scratch that, my test was in error (was inserting a 1 instead of NULL). Prepared statement does appear to be needed to trigger the issue (at least in this particular case). TINYINT still triggers it too, though.

Fix on the way...in 3...2...1...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants