All query.reset() does is clear the underlying stringstream object. So
long as you reset after execution it "should" work, unless you're trying
to get something out of a select statement as you go.
I claim no particular expertise on mysql++, I was just trying to pass
along something I discovered in the process of developing our
application. So far we've had good luck with this method.
> -----Original Message-----
> From: Tim Murison [mailto:tmurison@stripped]
> Sent: Monday, April 11, 2005 2:20 PM
> To: Steve Roberts
> Subject: RE: Transactions with MySQLPP
>
> On Tue, 2005-05-04 at 07:52 -0700, Steve Roberts wrote:
> > However, the underlying SQL itself will support transactions:
> >
> > query << "START TRANSACTION";
> > query.execute();
> > query.reset();
> > query << // your update here
> > query.execute();
> > query.reset();
> > query << "COMMIT"
> > query.execute();
>
> Thanks... I went with this method...
>
> At first it seemed to work but when running my program
> through a full test suite, I noticed that I got failed transactions.
> One in particular has me stumped, it fails on a foreign key
> constraint... the perculiar thing is that if I manually enter
> the same queries through the command line, it works!
>
> The only thing I notice that your example does that I don't is
> query.reset() instead of creating a new query each time...
> could this be significant?
>
> Cheers,
>
> -Tim
>
>