List:MySQL++« Previous MessageNext Message »
From:Edward Diener Date:February 27 2009 2:21am
Subject:Re: SSQLS structure problem with sql_tinyint_unsigned and mysqlpp::Null
View as plain text  
Warren Young wrote:
 > Warren Young wrote:
 >> On Jan 29, 2009, at 7:29 AM, Edward Diener wrote:
 >>
 >>> I think that mysqlpp::tiny_int needs an == operator.
 >>
 >> Try it.
 >
 > Have you tried it yet?  If it worked, I'd like to add it to 3.0.9,
 > assuming it doesn't break anything.
 >

I added to tiny_int.h:

    bool operator ==(const this_type& i) const
    {
      return value_ == i.value_;
    }
    
    bool operator !=(const this_type& i) const
    {
      return value_ != i.value_;
    }
    
    bool operator <(const this_type& i) const
    {
      return value_ < i.value_;
    }
    
    bool operator >(const this_type& i) const
    {
      return value_ > i.value_;
    }
    
    bool operator <=(const this_type& i) const
    {
      return value_ <= i.value_;
    }
    
    bool operator >=(const this_type& i) const
    {
      return value_ >= i.value_;
    }

It has compiled with no problems and my code works correctly when using 
my OP example.

I realize that !=, >, <=, and >= can all be coded in terms of == and < 
but I do not think it is wrong to assume that this_type supports each of 
them individually, as all native integer types do.
Thread
Re: SSQLS structure problem with sql_tinyint_unsigned and mysqlpp::NullEdward Diener27 Feb
  • Re: SSQLS structure problem with sql_tinyint_unsigned and mysqlpp::NullWarren Young27 Feb