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:
Qt Code:
  1. print 'is_active', self.query.isActive()
  2. print 'is_select', self.query.isSelect()
  3. print 'is_valid', self.query.isValid()
  4.  
  5. print ''
  6. print 'seek:', self.query.seek(0)
  7. print 'is_valid', self.query.isValid()
  8.  
  9. print ''
  10. print 'seek:', self.query.seek(0)
  11. print 'is_valid', self.query.isValid()
  12.  
  13. print ''
  14. print 'next', self.query.next()
  15. print 'is_valid', self.query.isValid()
  16.  
  17. print ''
  18. print 'seek:', self.query.seek(0)
  19. print 'is_valid', self.query.isValid()
To copy to clipboard, switch view to plain text mode 

Result:
Qt Code:
  1. is_active True
  2. is_select True
  3. is_valid False
  4.  
  5. seek: False
  6. is_valid False
  7.  
  8. seek: True
  9. is_valid True
  10.  
  11. next False
  12. is_valid False
  13.  
  14. seek: True
  15. is_valid True
To copy to clipboard, switch view to plain text mode 

Thanks for any help with this,

amicitas