|
From: 韩彦军(Hammer) <ya...@do...> - 2011-02-11 06:27:02
|
Hi all, in the example ssqls1.cpp I want to convert the sql_decimal type to the ordinary c++ double via the following statements: double d; d = it->price; but I got errors when compiling as follows: lib/null.h: In member function ‘mysqlpp::Null<Type, Behavior>::operator Type() const [with Type = double, Behavior = mysqlpp::NullIsNull]’: examples/ssqls1.cpp:72:13: instantiated from here lib/null.h:55:2: error: ‘mysqlpp::null_type::operator CannotConvertNullToAnyOtherDataType() const [with CannotConvertNullToAnyOtherDataType = double]’ is protected lib/null.h:232:29: error: within this context make: *** [ssqls1_ssqls1.o] Error 1 Besides, when I convert sql_mediatext type to the c++ string via: string s; s = it->description; I got a similar error: lib/null.h: In member function ‘mysqlpp::Null<Type, Behavior>::operator Type() const [with Type = std::basic_string<char>, Behavior = mysqlpp::NullIsNull]’: examples/ssqls1.cpp:72:13: instantiated from here lib/null.h:55:2: error: ‘mysqlpp::null_type::operator CannotConvertNullToAnyOtherDataType() const [with CannotConvertNullToAnyOtherDataType = std::basic_string<char>]’ is protected lib/null.h:232:29: error: within this context make: *** [ssqls1_ssqls1.o] Error 1 I searched the archive and didn't find any solution. Any suggestion? Thank you very much! Regards, Han |