I am new to the list and relatively new to mysqlpp, so please be kind.
I am trying to handle null values I get from the database using the the
mysqlpp tutorial on the subject (3.9. Handling SQL Nulls). Below is my
code:
mysqlpp::Null<int, mysqlpp::NullisNull> nullIntField = mysqlpp::null;
if (result.at(0)["Unit_id"] != nullIntField) {
// do something with int value
}
On compile I receive:
error: ambiguous overload for ‘operator!=’ in
‘mysqlpp::Row::operator[](const char*) const(((const char*)"Unit_id")) !
= nullIntField’
note: candidates are: operator!=(int, int) <built-in>
note: operator!=(unsigned int, int) <built-in>
note: operator!=(long int, int) <built-in>
note: operator!=(long unsigned int, int) <built-in>
note: operator!=(mysqlpp::longlong, int) <built-in>
note: operator!=(mysqlpp::ulonglong, int) <built-in>
note: operator!=(float, int) <built-in>
note: operator!=(double, int) <built-in>
If I type cast "result.at(0)["Unit_id"]" to int then I get run time
errors about convert Null to int. How do I clear the ambiguity?
Also, if there is no fixing my code, what is a good simple example of
handling nulls?
Thanks,
Dustin Moore
me@stripped