Note: After backup, the target database exactly the same as the source database.
* = NULL pDBSource the sqlite3;
the sqlite3 pDBDest * = NULL;
sqlite3_backup BAK *;
int nRet;
nRet to sqlite3_open = (strSourceDBAddr.data (), & pDBSource); // Source database
nRet = sqlite3_open (strDestDBAddr.data (), & pDBDest); / / target database
if (nRet != SQLITE_OK)
{
return bFlag;
}
bak = sqlite3_backup_init (pDBDest, "main ", pDBSource, "main"); // special attention, the source and destination database name is fixed character string database name "main"
IF (BAK)
{
sqlite3_backup_step (BAK, -1);
sqlite3_backup_finish (bak);
bFlag = true;
}
szError char * const;
szError = sqlite3_errmsg (pDBDest); // error See
BSLog :: writeMessage (szError);
sqlite3_close(pDBSource);
sqlite3_close(pDBDest);