List:MySQL++« Previous MessageNext Message »
From:Steve Orton Date:April 10 2006 2:36pm
Subject:RE: NULL field comparison
View as plain text  
 Sorry, I just noticed the code snippet I gave earlier is no longer in the thread.  I'll
add more to it to give it a better context.

try {
  int retVal =  // col_num is passed in as 'long int'
catch (BadConversion& bc) { 
  mysqlpp::Null<int, mysqlpp:NulIsZero> myfield
  myfield = mysqlpp::null;
  if ( == myfield)
    retVal = 0;
    retVal = -999;
catch (Exception& er) {
  // output
return retVal;

 Hope this amplification helps...steve---

-----Original Message-----
From: Orton, Steve [mailto:steve.orton@stripped]
Sent: Mon 4/10/2006 10:19 AM
To: plusplus@stripped
Subject: RE: NULL field comparison

 Sorry for the delay...the weekend got my attention:)

 I wanted to keep the first post simple, so I purposely left the rest of the compile error
Here's the full output from the compile.

"ambiguous overload for
    'const mysqlpp:ColData == mysqlpp::Null<int, mysqlpp::NullIsZero>&'
candidates are: operator==(int, int) <built-in>
    operator==(double, int) <built-in>
    operator==(float, int) <built-in>
    operator==(ulonglong, int)<built-in>
    operator==(longlong, int)<built-in>
    operator==(long unsigned int, int)<built-in>
    operator==(long int, int)<built-in>
    operator==(unsigned int, int)<built-in>
Error code 1

 I should add the reason why I want to have this sort of code is that I want to
distinguish between a stored NULL entry in the DB and a bad conversion when assigning a
value obtained from the DB.  So the code snippet I gave is in my "BadConversion" catch
block.  Is there a better way of doing this?


-----Original Message-----
From: Warren Young [mailto:mysqlpp@stripped]
Sent: Fri 4/7/2006 5:39 PM
To: MySQL++ Mailing List
Subject: Re: NULL field comparison
Orton, Steve wrote:
> Which produces the following compile error:
>   "ambiguous overload for 
>     'const mysqlpp:ColData == mysqlpp::Null<int, mysqlpp::NullIsZero>&'
> operator"

Did the compiler not tell you what the alternatives were that it was 
forced to choose from?  That would help me to understand where the 
ambiguity is.  As far as I can see, there's only one conversion path: 
there's a template operator Null<T, B> in coldata.h which should be able 
to convert ColData objects to Null-wrapped ColData objects.

One sticky point I see is that there is no operator== for the Null 
template.  Maybe the compiler wants to see one?

MySQL++ Mailing List
For list archives:
To unsubscribe:

NULL field comparisonSteve Orton7 Apr
  • Re: NULL field comparisonWarren Young7 Apr
RE: NULL field comparisonSteve Orton10 Apr
RE: NULL field comparisonSteve Orton10 Apr