3 messages in com.mysql.lists.plusplusRe: Problems handling column element ...| From | Sent On | Attachments |
|---|---|---|
| Brandmeyer, Jo Ellen | 29 Mar 2005 15:50 | |
| Warren Young | 31 Mar 2005 06:06 | |
| Chris Frey | 31 Mar 2005 12:59 |
| Subject: | Re: Problems handling column element of Row object returned as NULL![]() |
|---|---|
| From: | Warren Young (mysq...@etr-usa.com) |
| Date: | 03/31/2005 06:06:13 AM |
| List: | com.mysql.lists.plusplus |
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.




