Skip to content
Cheng Liang edited this page May 19, 2016 · 9 revisions

0.4

  1. Change QT5_SRC_PATH (or QT4_SRC_PATH) in sqlitecipher/qt_p.pri in order to find qsqlcachedresult_p.h. If you forget, qmake will raise an error.
  2. Try to compile the plugin with sqlitecipher.pro in sqlitecipher.
  3. Copy compiled dll (sqlitecipher(d).dll and sqlitecipher(d).lib for Qt4 and sqlitecipher(d).dll for Qt5) to Qt's plugin directory plugins/sqldrivers.

0.2 ~ 0.3

  1. Open sqlitecipher/qt_p.pri and change Qt code tree. The core idea is to find qsqlcachedresult_p.h (usually it is in %QT%/src/sql/kernel for Qt4 and %QT%/Src/qtbase/src/sql/kernel for Qt5).
  2. Try to compile the plugin with sqlitecipher.pro in sqlitecipher.
  3. Copy compiled dll (sqlitecipher.dll and sqlitecipher.lib for Qt4 and sqlitecipher.dll for Qt5) to Qt's plugin directory plugins/sqldrivers.

That's all. The you could test if the plugin is loaded successfully. You could see code in test for how to use it. Just set your password with QSqlDatabase::setPassword() function, that is all you need, e.g.:

QSqlDatabase dbconn = QSqlDatabase::addDatabase("SQLITECIPHER"); dbconn.setPassword("YourPasswort");

0.1

  1. cd SQLite_cipher, try to compile code in this directory. You could use makefile in this directory. After compiling, you will get libsqlite.a or sqlite.lib.
  2. Copy libsqlite.a or sqlite.lib to sqlitecipher/lib.
  3. cd sqlitecipher, here you could find qsql_sqlite.cpp. Find the line sqlite3_key(d->access, "Trucc", 5); in function bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, const QString &, int, const QString &conOpts). Here, string "Trucc" is the password for SQLite and the following 5 should be the length for the password string. You should modify this to your own password.
  4. Compile Qt plugin with sqlitecipher.pro(If you want to use the lastet Qt source code, download Qt code and cd src/plugins/sqldrivers, try to modifed code according to this plugin).
  5. Finish! You should get sqlitecipher.dll or sqlitecipherd.dll if no any error.
Clone this wiki locally