Brandmeyer, Jo Ellen wrote:
>
> <Query_object> << "select sum(field_value) where <where_clause>";
> try{
> <Result_object> = <Query_object>.store();
> } catch (BadQuery er) {
> // code here
> }
All this "names removed to protect the innocent" stuff makes it hard to
understand the problem you're trying to present. Instead of neutering
your existing program, distilling the essence of the problem down to a
separate, small program would have been better.
Also, you should catch that exception by reference, to prevent an
unnecessary object copy.
> My problem is that sometimes the sum() returns NULL (not 0.0).
Do you mean C++ language "NULL", or SQL "NULL"? They're not the same thing.
> directly assign the value to float_value, the program crashes with a
> Microsoft Visual C++ Runtime Library abnormal program termination.
This is one reason why it would be nice to have a program to compile.
It's easier to debug something you can run.
> Does the is_null() function work properly?
Your guess is as good as mine. The original creators of MySQL++ have
moved on, leaving no one who knows the internals deeply. Some of us are
building that knowledge back up again, but it'll take time. Meanwhile,
if you find code that seemingly has no purpose, bring it up here and
we'll see what should be done about it.
> I looked in the MySQL++ source code and did not see where
> the value of _null in coldata.h is being set.
A simple grep turns up at least three places.
> Please let me know how to successfully test for NULL in a column of a
> Row object. Thank you.
Look at lib/null.h.