List:MySQL++« Previous MessageNext Message »
From:Steve Orton Date:April 7 2006 5:21pm
Subject:NULL field comparison
View as plain text  
  Hello,
  I'm fairly new to mysql and I have a question about finding out if a particular field is
NULL for type int and varchar.  Using the quick example in the "User's Guide", I tried
comparing the contents returned by row.at to the Null object and to mysqpp::null and get
a "using == produces an ambiguous comparison" or something to that effect for both.

I tried this:

  mysqlpp::Null<int, mysqlpp:NulIsZero> myfield
  myfield = mysqlpp::null;
  if (_row.at(0) == myfield)
    retVal = 0;
  else
    retVal = -999;

Which produces the following compile error:
  
  "ambiguous overload for 
    'const mysqlpp:ColData == mysqlpp::Null<int, mysqlpp::NullIsZero>&'
operator"

I then tried this:
  
  if (_row.at(0) == mysqlpp::null)
    retVal = 0;
  else
    retVal = -999;

which produces:

  "no match for 'const mysqlpp::ColData == const mysqlpp::null_type&' operator"

  Section 3.8 of the "User's Guide" doesn't go into any more detail and I could not find
any examples on this type of NULL usage.  It's probably simple, but I can't see it.

  Any insight on this would be greatly appreciated...steve---

  
Steven J Orton
Software Engineer
Northrop Grumman Mission Systems
[Email] steve.orton@stripped


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