List:MySQL++« Previous MessageNext Message »
From:Brad Hubbard Date:December 3 2008 12:23pm
Subject:Problem with Null string type
View as plain text  
mysql++-3.0.6
mysql-5.0.45-6.fc7
g++ 4.1.2

I have an SSQLS definition like so;

sql_create_11( individual,
    1, 11,
    mysqlpp::sql_bigint, individualID,
    mysqlpp::sql_char, firstName,
    mysqlpp::sql_char, surname,
    mysqlpp::sql_char, addressLine1,
    mysqlpp::Null<mysqlpp::sql_char>, addressLine2,
    mysqlpp::sql_char, phoneNumber,
    mysqlpp::Null<mysqlpp::sql_char>, mobileNumber,
    mysqlpp::Null<mysqlpp::sql_char>, emailAddress,
    mysqlpp::sql_tinyint, serviceUser,
    mysqlpp::sql_tinyint, staff,
    mysqlpp::sql_tinyint, isActive )

When I try to do this;

            mysqlpp::Query query = conn.query( "SELECT individualID, 
firstName, surname, phoneNumber, mobileNumber, emailAddress from 
individual order by\
                                               individualID" );
            std::vector<individual> res;
           
            query.storein( res );

            std::vector<individual>::iterator it;
            for( it = res.begin(); it != res.end(); ++it )
            {
                mysqlpp::String &mob = it->mobileNumber;
                new WText( boost::lexical_cast<std::string>( 
it->individualID ), table->elementAt( rowcount, 0 ) );
                new WText( it->firstName.c_str(), table->elementAt( 
rowcount, 1 ) );
                new WText( it->surname.c_str(), table->elementAt( 
rowcount, 2 ) );
                new WText( it->phoneNumber.c_str(), table->elementAt( 
rowcount, 3 ) );
                new WText( mob.c_str(), table->elementAt( rowcount, 4 ) );
                //new WText( it->emailAddress.data.c_str(), 
table->elementAt( rowcount, 5 ) );
                ++rowcount;
            }

I get the following errors;

/home/brad/working/list.cpp:74: instantiated from here
/usr/local/include/mysql++/null.h:229: error: ambiguous overload for 
'operator=' in '((mysqlpp::Null<std::basic_string<char, 
std::char_traits<char>, std::allocator<char> >, 
mysqlpp::NullIsNull>*)this)->mysqlpp::Null<std::basic_string<char, 
std::char_traits<char>, std::allocator<char> >, 
mysqlpp::NullIsNull>::data = mysqlpp::NullIsNull::null_is()'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:485:

note: candidates are: std::basic_string<_CharT, _Traits, _Alloc>& 
std::basic_string<_CharT, _Traits, _Alloc>::operator=(const 
std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, 
_Traits = std::char_traits<char>, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:493:

note: 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/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:504:

note: std::basic_string<_CharT, _Traits, _Alloc>& 
std::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with 
_CharT = char, _Traits = std::char_traits<char>, _Alloc =

Can anyone tell me what I'm doing wrong?

Kind regards,
Brad Hubbard
Thread
Problem with Null string typeBrad Hubbard3 Dec
  • Re: Problem with Null string typeWarren Young3 Dec
    • Re: Problem with Null string typeBrad Hubbard3 Dec
      • Re: Problem with Null string typeWarren Young3 Dec
        • Re: Problem with Null string typeBrad Hubbard4 Dec
          • Re: Problem with Null string typeBrad Hubbard4 Dec
          • Re: Problem with Null string typeWarren Young4 Dec
            • Re: Problem with Null string typeBrad Hubbard5 Dec
              • Re: Problem with Null string typeWarren Young5 Dec
                • Re: Problem with Null string typeBrad Hubbard6 Dec
Re: Problem with Null string typeWarren Young6 Dec
  • Re: Problem with Null string typeBrad Hubbard6 Dec
    • execute failedbsingh8 Dec
      • Re: execute failedWarren Young8 Dec