[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt]  Syntax to access a blob column on sqlite
From:       IloChab <ilochab () gmail ! com>
Date:       2010-03-28 14:04:10
Message-ID: 166b1c631003280704h2d4bb015od5abc1a2d651ac52 () mail ! gmail ! com
[Download RAW message or body]

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
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic