Hi everyone,
I am using qt 4.7.I am trying to store binary data.My binary data is present in QByteArray.
Can any one tell me how to insert ? What is the create and insert statement ?
thanks
Hi everyone,
I am using qt 4.7.I am trying to store binary data.My binary data is present in QByteArray.
Can any one tell me how to insert ? What is the create and insert statement ?
thanks
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
I think you can use BLOB datatype for the data field, so create could look like:
and insert QByteArray as any other value, for example:Qt Code:
CREATE TABLE test( data BLOB NOT NULL );To copy to clipboard, switch view to plain text mode
Qt Code:
QByteArray bytes; ... query.prepare("INSERT INTO test(data) VALUES(:data);"); query.bindValue(":data",bytes); query.exec();To copy to clipboard, switch view to plain text mode
Last edited by stampede; 24th March 2011 at 13:14. Reason: too slow again :)
Bookmarks