I am trying to use the QSqlQuery.seek() function. I am running into a problem in which the first time that I call seek after a query it doesn't seem to do anything. If I call it a second time it does what I would expect. If I call next() before seek() it also behaves as expected. What is going on here?
I am using the SQLite database for this and programing in PyQt4.
Example Code:
print 'is_active', self.query.isActive()
print 'is_select', self.query.isSelect()
print 'is_valid', self.query.isValid()
print ''
print 'seek:', self.query.seek(0)
print 'is_valid', self.query.isValid()
print ''
print 'seek:', self.query.seek(0)
print 'is_valid', self.query.isValid()
print ''
print 'next', self.query.next()
print 'is_valid', self.query.isValid()
print ''
print 'seek:', self.query.seek(0)
print 'is_valid', self.query.isValid()
print 'is_active', self.query.isActive()
print 'is_select', self.query.isSelect()
print 'is_valid', self.query.isValid()
print ''
print 'seek:', self.query.seek(0)
print 'is_valid', self.query.isValid()
print ''
print 'seek:', self.query.seek(0)
print 'is_valid', self.query.isValid()
print ''
print 'next', self.query.next()
print 'is_valid', self.query.isValid()
print ''
print 'seek:', self.query.seek(0)
print 'is_valid', self.query.isValid()
To copy to clipboard, switch view to plain text mode
Result:
is_active True
is_select True
is_valid False
seek: False
is_valid False
seek: True
is_valid True
next False
is_valid False
seek: True
is_valid True
is_active True
is_select True
is_valid False
seek: False
is_valid False
seek: True
is_valid True
next False
is_valid False
seek: True
is_valid True
To copy to clipboard, switch view to plain text mode
Thanks for any help with this,
amicitas
Bookmarks