[Qt-interest] ByteArray database problem

RZ rz at univie.ac.at
Wed Aug 5 09:09:29 CEST 2009


Hello all,

I got the following code for some of my QTableViews:

in c'tor:
QSettings settings("Zweieck", "PEPer");
horizontalHeader()->restoreState(settings.value("test").toByteArray());

and on closing:
QSettings settings("Zweieck", "PEPer");
settings.setValue("test", horizontalHeader()->saveState());

which does what it should. Now I'm trying to save the data not via 
QSettings but to a database (Oracle in that case).

Doing
insertQuery.bindValue(":val", horizontalHeader()->saveState());

gives me a string in the database (something like 
00000FF000000000000000100000001000000000100000000....) - the field in 
the database is defined as varchar (if that should matter).

When reading that again
horizontalHeader()->restoreState(query.value(0).toByteArray());
it stays without effect.


Any ideas? How to correctly store a QByteArray in a database? (I fear 
that converting to and from string corrupts something).

Any help appreciated,

RZ



More information about the Qt-interest-old mailing list