List:MySQL++« Previous MessageNext Message »
From:Dustin Moore Date:March 17 2008 4:45am
Subject:Problem Handling Null Values
View as plain text  
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

	mysqlpp::Null<int, mysqlpp::NullisNull> nullIntField = mysqlpp::null;
	if (["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 "["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?

Dustin Moore

Problem Handling Null ValuesDustin Moore17 Mar
  • Re: Problem Handling Null ValuesWarren Young17 Mar
  • Re: Problem Handling Null ValuesWarren Young17 Mar
    • Re: Problem Handling Null ValuesDustin Moore18 Mar
      • Re: Problem Handling Null ValuesWarren Young18 Mar
        • Re: Problem Handling Null ValuesDustin Moore19 Mar
          • Re: Problem Handling Null ValuesWarren Young19 Mar