[PyKDE] QSqlCursor problems

Jon jjshome at ntlworld.com
Thu Feb 7 23:42:06 GMT 2002


On Tuesday 05 February 2002 9:02 am, Phil Thompson wrote:
> Jon wrote:
> > Hello
> >
> > I am getting the same problem as reported by Nico van der Walt on Tue, 18
> > Dec 2001.
> >
> > QSqlCursor returns blank for text fields and zero for numeric fields. I
> > am using the MySql driver.
> >
> > Does anyone know if this problem has been resolved yet ?
> >
> > Jon
>
> I've not tested it recently (since I downgraded my g++), but I assume
> the problem is still there. I got as far as finding that the problem was
> from a QVariant ctor being used to copy the column value - but there I
> got stuck. What compiler are you using?
>
> Phil

I had a go at debugging this and think I've found the problem.

cur = QSqlCursor( "places_table" )
cur.select( "name='burridge'" )
while cur.next():
	print cur.value("id").toString()

The call to cur.next() calls afterSeek() but it calls the base class 
QSqlQuery::afterSeek() which is empty instead of QSqlCursor::afterSeek() 
which calls sync() to get the data for the cursor. No call to sync() = all 
zeros in the cursor.

I checked this by running the same code in C++ and sync() is called correctly.

I looked at the sip file for QSqlCursor and afterSeek() is commented out ? I 
tried uncommenting but the problem remains.

I'm stuck now because I don't know what to do to the sip files to get things 
working. 

Can Phil tell me what to do next please.

Jon.




More information about the PyQt mailing list