[PyQt] [SOLVED]Syntax to access a blob column on sqlite

Nick Gaens nickgaens at gmail.com
Mon Mar 29 14:52:37 BST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Why do you copy construct blobField on the line where you bindValue()
it? I assume it's verbose and can be omitted..

On 29/03/2010 15:36, IloChab wrote:
> 2010/3/28 IloChab <ilochab at gmail.com>:
>> I tried in this way:
>>
>> blobField = QtCore.QVariant ( QtCore.QByteArray ([1,2,3,]) )
>> query = QtSql.QSqlQuery()
>> query.prepare("""INSERT INTO blobTable (blobColumn) VALUES(?)""")
>> query.bindValue(0,(blobField,));
>> query.exec_();
>>
>>
>> ... and I got no error, but in the DB I find an empty field: (u'')
>>
>>
>> Which is the correct syntax to store a blob field???
>>
> 
> 
> 
> The right way to do it was:
> 
> 
> blobField = QtCore.QByteArray ([1,2,3,])
> query = QtSql.QSqlQuery()
> query.prepare("""INSERT INTO blobTable (blobColumn) VALUES(?)""")
> query.bindValue(0,  QtCore.QByteArray(blobField,))
> query.exec_()
> 
> 
> I hope this can be usefull to someone else!!
> 
> Thank to the list anyway!
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJLsLCkAAoJEHryXS9yfz/RJ8wH/2b9Kcilct9L1ZMocNajEBw6
AoKi4rEEfxUFjdlpg+z73GenWjWoLjbaZGENuzTbtNsqt9LS1TJM8XkhfXGERmf9
6Jo3J22YeEwy08FeGW8a47FcQ0R0Rf0ufAnN2RVNrvMXHDkAUHE+Ymth1OIJHc3y
2Jlq5sO049U7mtavCUj0Xp+NXezDYlLtUQ0ybhDnEtQr857rGbjrmIPED/xn7/Ha
On1YP8zxRAclOx+lKxCclpdlenoSg3qT0bxERbKYsq68GMEWXk9pq/38tWO8p+QQ
6t/S99uNLRd4Jk/tVq3y+fs7DhXMM6V29L890glHg15nRn9F4Uk+DGub7cHRLwY=
=b0De
-----END PGP SIGNATURE-----


More information about the PyQt mailing list