List:MySQL++« Previous MessageNext Message »
From:Jithin Emmanuel Date:March 20 2009 6:21am
Subject:Re: checking NULL
View as plain text  
At last I found what I was looking for. Its
 row["name"].is_null()



On Fri, Mar 20, 2009 at 11:21 AM, Jithin Emmanuel <jithin1987@stripped>wrote:

> I am using version 2 23 and is not in a position to upgrade.
> I am not comparing against the string. I am doing
>
>   if(row["name"] == mysqlpp::null) {
>                                                 cout << " NULL VALUE" <<
> endl;
>                                 }
> This is what giving me there error.
> est.cpp:58: error: no match for 'operator==' in
> 'mysqlpp::Row::operator[](const char*) const(((const char*)"name")) ==
> mysqlpp::null'
>
> Is it possible to instantiate mysqlpp::NULL with row["name"] and use
> is_null parameter? But I cannot make that work also.
>
>
> On Fri, Mar 20, 2009 at 10:39 AM, Warren Young <mysqlpp@stripped>wrote:
>
>> 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.
>>
>>
>> --
>> MySQL++ Mailing List
>> For list archives: http://lists.mysql.com/plusplus
>> To unsubscribe:
>> http://lists.mysql.com/plusplus?unsub=1
>>
>>
>
>
> --
> Regards
> Jithin Emmanuel
> http://spotm.in
> Samuel Beckett  - "Birth was the death of him."
>



-- 
Regards
Jithin Emmanuel
http://spotm.in
Rita Rudner  - "Before I met my husband, I'd never fallen in love. I'd
stepped in it a few times."

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