[Qt-interest] Compressing sqlite file with QtIOCompressor results in corrupted db
Jan
janusius at gmx.net
Mon Sep 6 13:26:09 CEST 2010
Hi all,
I am compressing/uncompressing a sqlite db file with QtIOCompressor.
The file size seems to be ok after uncompressing and I am able to open
the database but any query will fail with: "File is encrypted or not a
database".
Do I need to set any other options?
This is the code:
//compressing
QFile fileIn("in");
fileIn.open(QIODevice::ReadOnly);
QByteArray ba = fileIn.readAll();
QFile outFile("out");
QtIOCompressor compressor(&outFile);
compressor.open(QIODevice::WriteOnly);
compressor.write(ba);
compressor.close();
//uncompressing
QFile compsqlite("out");
QFile sqlite("sqlite");
QtIOCompressor compressor(compsqlite);
compressor.open(QIODevice::ReadOnly);
const QByteArray ba = compressor.readAll();
sqlite.open(QIODevice::WriteOnly);
QDataStream out(&sqlite);
compressor.close();
out << ba;
Jan
More information about the Qt-interest-old
mailing list