Warren Young wrote:
> See the new simple2 example for the proper way to process
> a "use" query.
That example demonstrates good style for the "no exceptions" case, but
the situation wasn't so good for the "with exceptions" case. In the
earlier v2.0 code, you'd get a BadQuery exception when you hit the end
of the result set. Since the query is not in fact bad, I've created a
new EndOfResults exception to signal "fetch_row() walked off the end of
the result set". I've also added a new example, usequery.cpp, which
demonstrates it.
I considered returning v2.0 to v1.7-like behavior here, and simply
returning an empty row at the end of the result set. I rejected it
because the promise always has been that objects pass their exception
state on to their children. It didn't happen in v1.7, but this is a
bug, not a feature worth keeping. If you want the v1.7 behavior, use
the new NoExceptions facility on the ResUse object before you start
walking through the result set, but after you assign the return value of
Query::use() to it.
Along these lines, I'm going to create more new exceptions. BadQuery is
severely overloaded; it's pretty much a generic exception at this point.
I'm going to make it for bad queries only in v2.0. To avoid problems
when migrating between v1.7 and v2.0, all of your MySQL++ exception
catch blocks should include one for std::exception, which will act as a
"catch all" for those not caught by a more specific catch block. Most
of the examples have a block like this in v1.7, so if you've emulated
them, you won't need to change anything.