[Qt-interest] QSqlQuery::numRowsAffected

Rick Vernam rickv at hobi.com
Fri Jun 26 22:01:19 CEST 2009


On Friday 26 June 2009 2:01:49 pm Scott Aron Bloom wrote:
> Have you checked the driver has the feature QSqlDriver::QuerySize?
Yes, it does.  I use it all over the place...

>
> I have found in the past, that even when it says it does, it only does
> in some cases.  I don't know postgres's C/C++ interface well enough, but
> that is the case with the MS SQL interface...
>
>
> This could be  abug in the QT Driver code (build and run the debug
> version and take a look at the source and see) or it could be in the
> PostGres sql C++ code

While I've developed against libpq on many occasions, I've never before 
encountered this scenario ...  so as you suggest, it could very well be in the 
underlying libpq...

I haven't dug into Qt or postgres code regarding the matter.  I was hoping to 
leverage community knowledge :-)

It seems obvious to me that for this type of query (both update/insert/delete 
& returns records), that QSqlQuery::numRowsAffected & QSqlQuery::size would 
return valid & correct results.
Maybe I'll take up that cause when I get enough time to at least come up for 
air :-)

Thanks,
-Rick

>
> Scott
>
> > -----Original Message-----
> > From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> > bounces at trolltech.com] On Behalf Of Rick Vernam
> > Sent: Friday, June 26, 2009 11:55 AM
> > To: qt-interest at trolltech.com
> > Subject: Re: [Qt-interest] QSqlQuery::numRowsAffected
> >
> > On Monday 22 June 2009 3:20:04 pm Rick Vernam wrote:
> > > I have very simple update query, which also returns data.
> > > In Postgres' psql, I run:
> > > update sometable set somefield = somevalue where
>
> somecriteria=whatever
>
> > > returning someothervalue;
> > >
> > > When I run this query via the QPSQL driver, sometable.somefield is
>
> indeed
>
> > > updated to somevalue, however QSqlQuery::numRowsAffected returns
>
> zero.
>
> > > If I run the query without the returning clause, then I get a valid
>
> result
>
> > > from QSqlQuery::numRowsAffected.
> > >
> > > So is this the expected behavior?
> > >
> > > Thanks,
> > > -Rick
> >
> > Nobody knows?
> >
> > > _______________________________________________
> > > Qt-interest mailing list
> > > Qt-interest at trolltech.com
> > > http://lists.trolltech.com/mailman/listinfo/qt-interest
> >
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list