List:MySQL++« Previous MessageNext Message »
From:Dustin Moore Date:April 4 2008 3:17am
Subject:Re: conversion from
‘mysqlpp::Query’ to
‘bool’ is ambiguous
View as plain text  
On Thu, 2008-04-03 at 17:11 -0600, Warren Young wrote:
> Well, this bug slipped through because what you're trying to do isn't 
> idiomatic MySQL++.  The standard way to test for query success is to 
> test the execute() (or store(), or use(), or...) statement in bool 
> context.  Or, use exceptions.  See the examples.
> 
Yeah, I guess I should trust my try/catch block to deal with problems.

> > As a side note, I tried to use query.affected_rows() to determine a
> > successful update, but the function returned a very large
> > number(garbage) instead of -1 or 0, which would make more sense in
> > context.
> 
> Works here.

I guess I should have said "to determine a unsuccessful update", and by
that I mean the update statement is well formed but doesn't update
anything.  The issue I have only happens when I use the SSQLS
constructor created for comparison.  The update statement that is
created is odd and malformed:

UPDATE H���
            $�п8�п� SET Unit_id = 133,ShortName = 'those',LongName =
'each' WHERE Unit_id = 133

and affected_rows() returns 18446744073709551615

I don't know what I have in my code that is causing the issue, but the
example I modified works fine.  I attached the example, but I don't need
this issue resolved because the issue is with my code.


Thanks for the help again,

Dustin

Attachment: [text/x-c++src] ssqls3_affected_rows.cpp
Attachment: [text/x-c++src] ssqls3_affected_rows.cpp
Thread
conversion from ‘mysqlpp::Query’to ‘bool’ is ambiguousDustin Moore3 Apr
  • Re: conversion from ‘mysqlpp::Query’ to ‘bool’ is ambiguousWarren Young4 Apr
    • Re: conversion from‘mysqlpp::Query’ to‘bool’ is ambiguousDustin Moore4 Apr
      • Re: conversion from ‘mysqlpp::Query’ to ‘bool’ is ambiguousWarren Young8 Apr
        • Re: conversion from‘mysqlpp::Query’ to‘bool’ is ambiguousDustin Moore11 Apr