> 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.
Thx,
One final question...
I am creating one query object for each query in the transaction so:
Query q = con.query();
q << ...
Query q2 = con.query();
...
Would that make a difference? (P.S. It isn't as simple as what I wrote,
but that is basically the effect.)
Also, within a transaction I have some SELECT statements, so I use
query.store(); for those, could that make a difference?
Cheers,
-Tim
>
> > -----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
> >
> >
>