Revision 40cf6a8c
Von Sebastian Diel vor mehr als 5 Jahren hinzugefügt
- ID 40cf6a8c712767178893a61ab44f3db3d2c9c5ef
- Vorgänger 48379924
src/sqlitebackupprocessor.cpp | ||
---|---|---|
* You should have received a copy of the GNU Lesser General Public License
|
||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||
*/
|
||
//#include "../../../../../../QtCipherSqlitePlugin/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3ext.h"
|
||
//#include "../../../../../../QtCipherSqlitePlugin/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3.h"
|
||
//#include "../../../../../../QtCipherSqlitePlugin/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3userauth.h"
|
||
//#include "../../../../../../QtCipherSqlitePlugin/QtCipherSqlitePlugin/sqlitecipher/sqlite3/rijndael.h"
|
||
//#include "../../../../../../QtCipherSqlitePlugin/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sha2.h"
|
||
//#include "../../../../../../QtCipherSqlitePlugin/QtCipherSqlitePlugin/sqlitecipher/sqlitecipher_p.h"
|
||
//#include "../../../../../../QtCipherSqlitePlugin/QtCipherSqlitePlugin/sqlitecipher/sqlitecipher_global.h"
|
||
//#include "../../../../../../QtCipherSqlitePlugin/QtCipherSqlitePlugin/sqlitecipher/sqlitechipher_global.h"
|
||
//#include "../../../../../../QtCipherSqlitePlugin/QtCipherSqlitePlugin/sqlitecipher/sqlcachedresult_p.h"
|
||
|
||
#include "sqlitebackupprocessor.h"
|
||
#include <sqlite3.h>
|
||
#include <QFileInfoList>
|
||
... | ... | |
*/
|
||
bool SqliteBackupProcessor::sqliteDBMemFile(bool save, QString fileName) {
|
||
bool state = false;
|
||
// qDebug()<<"111";
|
||
QVariant v = this->database->getDatabase().driver()->handle();
|
||
if ( v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0 ) {
|
||
// qDebug()<<"222";
|
||
// v.data() returns a pointer to the handle
|
||
sqlite3 *handle = *static_cast<sqlite3 **>(v.data());
|
||
if ( handle != 0 ) { // check that it is not NULL
|
||
// qDebug()<<"333";
|
||
sqlite3 *pInMemory = handle;
|
||
QByteArray array = QString(this->destination + "/" + fileName).toLocal8Bit();
|
||
const char *zFilename = array.data();
|
||
// const char *zFilename = array.data();
|
||
const char *zFilename = array;
|
||
int rc; /* Function return code */
|
||
sqlite3 *pFile; /* Database connection opened on zFilename */
|
||
/* Open the database file identified by zFilename. Exit early if this fails
|
||
** for any reason. */
|
||
rc = sqlite3_open( zFilename, &pFile );
|
||
// pFile->setPassword("test");
|
||
// sqlite3_key(pFile, "test", strlen("test"));
|
||
// qDebug()<<"keyrc: "<<keyrc;
|
||
|
||
if ( rc == SQLITE_OK ) {
|
||
// qDebug()<<"444";
|
||
sqlite3_backup *pBackup; /* Backup object used to copy data */
|
||
sqlite3 *pTo; /* Database to copy to (pFile or pInMemory) */
|
||
sqlite3 *pFrom; /* Database to copy from (pFile or pInMemory) */
|
||
... | ... | |
** and return the result of this function. */
|
||
(void)sqlite3_close(pFile);
|
||
if ( rc == SQLITE_OK ) {
|
||
// qDebug()<<"666";
|
||
state = true;
|
||
}
|
||
}
|
Auch abrufbar als: Unified diff
debugging heritage