List:MySQL++« Previous MessageNext Message »
From:Jithin Emmanuel Date:March 19 2009 12:47pm
Subject:Re: checking NULL
View as plain text  
How do I use this to check if a retrieved value is NULL or not.
I tried like this

                               row = (*i);
                                name = row["name"];
                                mysqlpp::Null<unsigned char>
nullField(mysqlpp::null);
                                if(nullField == row["name"]) {
                                                cout << " NULL VALUE" <<
endl;
                                }
 Certainly what I am doing is wrong for I am getting errors like this

est.cpp:56: error: ambiguous overload for 'operator=' in 'name =
mysqlpp::Row::operator[](const char*) const(((const char*)"name"))'
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/basic_string.h:437:
note: candidates are: std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with
_CharT = char, _Traits = std::char_traits<char>, _Alloc =
std::allocator<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/basic_string.h:451:
note:                 std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT =
char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]
test.cpp:58: error: ambiguous overload for 'operator==' in 'nullField ==
mysqlpp::Row::operator[](const char*) const(((const char*)"name"))'

Can you tell me how do I use it correctly.

2009/3/19 Warren Young <mysqlpp@stripped>

> On Mar 19, 2009, at 4:40 AM, Jithin Emmanuel wrote:
>
>  Is there a better way to check if a field is NULL or not
>>
>
> http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html#sql-null
>
>
> --
> 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."

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