Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
Нерешенный вопрос
Осталось непонятным, как поменять пароль для уже созданной и зашифрованной по этому паролю БД.
/*
** Change the key on an open database. If the current database is not
** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the
** database is decrypted.
**
** The code to implement this API is not available in the public release
** of SQLite.
*/
SQLITE_API int sqlite3_rekey(
sqlite3 *db, /* Database to be rekeyed */
const void *pKey, int nKey /* The new key */
);
SQLITE_API int sqlite3_rekey_v2(
sqlite3 *db, /* Database to be rekeyed */
const char *zDbName, /* Name of the database */
const void *pKey, int nKey /* The new key */
);
QSqlDriver *driver = m_db.driver();
QVariant handle = driver->handle();
Q_ASSERT_X(handle.isValid(), Q_FUNC_INFO, "Invalid handle of QSqlDriver");
if (handle.isValid() && qstrcmp(handle.typeName(), "sqlite3*") != 0)
return;
sqlite3* db = *static_cast<sqlite3* const*>(handle.data());
if (db == nullptr)
return;
sqlite3_rekey(db, pKey, nKey);
Error: file is encrypted or is not a database

Шифрование SQLite базы данных в Qt