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 =3D _row.at(col_num) // col_num is passed in as 'long int'
}
catch (BadConversion& bc) {=20
mysqlpp::Null<int, mysqlpp:NulIsZero> myfield
myfield =3D mysqlpp::null;
if (_row.at(0) =3D=3D myfield)
retVal =3D 0;
else
retVal =3D -999;
}
catch (Exception& er) {
// output
}
return retVal;
Hope this amplification helps...steve---
-----Original Message-----
From: Orton, Steve [mailto:steve.orton (AT) ngc (DOT) com]
Sent: Mon 4/10/2006 10:19 AM
To: plusplus (AT) lists (DOT) mysql.com
Subject: RE: NULL field comparison
=20
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 out.
Here's the full output from the compile.
"ambiguous overload for
'const mysqlpp:ColData =3D=3D mysqlpp::Null<int, =
mysqlpp::NullIsZero>&' operator"
candidates are: operator=3D=3D(int, int) <built-in>
operator=3D=3D(double, int) <built-in>
operator=3D=3D(float, int) <built-in>
operator=3D=3D(ulonglong, int)<built-in>
operator=3D=3D(longlong, int)<built-in>
operator=3D=3D(long unsigned int, int)<built-in>
operator=3D=3D(long int, int)<built-in>
operator=3D=3D(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?
HTH...steve---
-----Original Message-----
From: Warren Young [mailto:mysqlpp (AT) etr-usa (DOT) com]
Sent: Fri 4/7/2006 5:39 PM
To: MySQL++ Mailing List
Subject: Re: NULL field comparison
=20
Orton, Steve wrote:
Quote:
Which produces the following compile error:
=20
"ambiguous overload for=20
'const mysqlpp:ColData =3D=3D mysqlpp::Null<int, =
mysqlpp::NullIsZero>&' operator"
|
Did the compiler not tell you what the alternatives were that it was=20
forced to choose from? That would help me to understand where the=20
ambiguity is. As far as I can see, there's only one conversion path:=20
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=3D=3D for the Null=20
template. Maybe the compiler wants to see one?
--=20
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: =
http://lists.mysql.com/plusplus?unsu... ngc (DOT) com
--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw