List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:March 18 2008 7:18am
Subject:Re: Problem Handling Null Values
View as plain text  
Dustin Moore wrote:
> 	if (["Unit_id"] != mysqlpp::null) {

Sorry, I got caught up in all the 2.3isms in critiquing your code.  The 
real issue is that data type of the left hand side of that test is 
mysqlpp::String, which doesn't know how to compare itself to 
mysqlpp::null.  Your choices are:

1. if (!["Unit_id"].is_null()) ...
2. if (Null<SomeType>(["Unit_id"]) != mysqlpp::null) ...
3. wait for the next version, which will let you do this comparison

> I used the [] operator instead of the at() function and received:
> 	error: no match for ‘operator[]’ in ‘result[0]’

It may be a side effect of the fact that the previously suggested code 
doesn't compile.  If you still can't use this feature after taking one 
of the alternatives above, it would seem you have some compiler 
limitation.  I've tested this here on my CentOS 5.1 system (g++ 4.1.2), 
and it *does* work.  I've made it part of the examples, so it will get 
further tested on other compilers before the next release.
Problem Handling Null ValuesDustin Moore17 Mar
  • Re: Problem Handling Null ValuesWarren Young17 Mar
  • Re: Problem Handling Null ValuesWarren Young17 Mar
    • Re: Problem Handling Null ValuesDustin Moore18 Mar
      • Re: Problem Handling Null ValuesWarren Young18 Mar
        • Re: Problem Handling Null ValuesDustin Moore19 Mar
          • Re: Problem Handling Null ValuesWarren Young19 Mar