[PyQt] Syntax to access a blob column on sqlite
IloChab
ilochab at gmail.com
Sun Mar 28 15:04:10 BST 2010
I'm using a sqlite db from PyQt4 APIs, but I do not know how to
INSERT/UPDATE a blob column with it.
I mean:
- if I use python to directly access sqlite I just write:
from sqlite3 import dbapi2 as sqlite
con = sqlite.connect('myDB')
cur = con.cursor()
blobFiled = sqlite.Binary(bytearray([1,2,3]))
cur.execute("""INSERT INTO blobTable (blobColumn) VALUES(?)""",(blobFiled,))
con.commit()
cur.close()
con.close()
... and every thing goes fine.
- if I use PyQt4 I don't know how to write a similar command; if I write:
query = QtSql.QSqlQuery()
query.exec_("""INSERT INTO blobTable (blobColumn) VALUES(?)""",(blobFiled,))
I get a traceback like:
TypeError: arguments did not match any overloaded call:
QSqlQuery.exec_(QString): too many arguments
QSqlQuery.exec_(): too many arguments
Which is the correct syntax???
Thank you all in advance
Licia
More information about the PyQt
mailing list