List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:March 20 2009 5:09am
Subject:Re: checking NULL
View as plain text  
On Mar 19, 2009, at 10:50 PM, Jithin Emmanuel wrote:

>                                name = row["name"].get_string();

First, you really should consider upgrading to MySQL++ v3.  You're  
clearly still on 2.3 or earlier.  There have been probably half a  
dozen changes to the way we handle SQL nulls in v3.0.0 and later, some  
of them highly useful.

Second, my previous reply didn't say to convert the return value of  
Row::operator[]() to a std::string and then make the test.  I said to  
test the return value of Row::operator[]() directly.  Why?  Because  
there's nothing like SQL null in C or C++.  When you convert SQL data  
to a non-SQL data type, you lose the SQL null flag.  You must test for  
the flag before you make the conversion.
Thread
checking NULLJithin Emmanuel19 Mar
  • Re: checking NULLWarren Young19 Mar
    • Re: checking NULLJithin Emmanuel19 Mar
      • Re: checking NULLWarren Young19 Mar
        • Re: checking NULLJithin Emmanuel20 Mar
          • Re: checking NULLWarren Young20 Mar
            • Re: checking NULLJithin Emmanuel20 Mar
              • Re: checking NULLJithin Emmanuel20 Mar
              • Re: checking NULLWarren Young20 Mar