[PyKDE] QSqlCursor problems
Nico van der Walt
nico at aknt.co.za
Tue Dec 18 11:32:37 GMT 2001
I am using PyQT3 to access a PostgreSQL database. The data that the SQL
cursor returns is blank for character fields and 0 for integer fields. The
correct number of rows are returned.
Here is a small program I wrote and it's output:
-----------------------------------------------------------------------------------------------
import sys
from qt import *
from qtsql import *
a = QApplication(sys.argv)
db = QSqlDatabase.addDatabase('QPSQL7')
db.setDatabaseName('test')
db.setHostName('ns2')
if not db.open():
raise SystemExit
c = QSqlCursor('gl')
c.select()
while c.next():
print c.toString(c.editBuffer(),'',':',' | ')
print c.value('acc_number').toString()
---------------------------------------------------------------------------------------------
Output:
acc_number : 0 | name : '' | type : ''
0
acc_number : 0 | name : '' | type : ''
0
acc_number : 0 | name : '' | type : ''
0
----------------------------------------------------------------------------------------------
More information about the PyQt
mailing list