diff options
author | drh <drh@noemail.net> | 2009-07-06 19:03:12 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2009-07-06 19:03:12 +0000 |
commit | f25cd7186e5d888f52ca76417632131915c9f077 (patch) | |
tree | d6447e3d3ad922bf6a00fb84f212ba82214e267d /src/backup.c | |
parent | 3509a658278c20739548c7028a69e32478c35813 (diff) | |
download | sqlite-f25cd7186e5d888f52ca76417632131915c9f077.tar.gz sqlite-f25cd7186e5d888f52ca76417632131915c9f077.zip |
Fix the backup logic so that it detects a failure to sqlite3BtreeUpdateMeta()
and reports that failure back up to the top level. (CVS 6851)
FossilOrigin-Name: 471b92f2514aedecb5773825a7ae472190375727
Diffstat (limited to 'src/backup.c')
-rw-r--r-- | src/backup.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/backup.c b/src/backup.c index a0daa6321..1e5f10854 100644 --- a/src/backup.c +++ b/src/backup.c @@ -12,7 +12,7 @@ ** This file contains the implementation of the sqlite3_backup_XXX() ** API functions and the related features. ** -** $Id: backup.c,v 1.18 2009/07/02 07:47:33 danielk1977 Exp $ +** $Id: backup.c,v 1.19 2009/07/06 19:03:13 drh Exp $ */ #include "sqliteInt.h" #include "btreeInt.h" @@ -358,17 +358,18 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){ } } - if( rc==SQLITE_DONE ){ + /* Update the schema version field in the destination database. This + ** is to make sure that the schema-version really does change in + ** the case where the source and destination databases have the + ** same schema version. + */ + if( rc==SQLITE_DONE + && (rc = sqlite3BtreeUpdateMeta(p->pDest,1,p->iDestSchema+1))==SQLITE_OK + ){ const int nSrcPagesize = sqlite3BtreeGetPageSize(p->pSrc); const int nDestPagesize = sqlite3BtreeGetPageSize(p->pDest); int nDestTruncate; - /* Update the schema version field in the destination database. This - ** is to make sure that the schema-version really does change in - ** the case where the source and destination databases have the - ** same schema version. - */ - sqlite3BtreeUpdateMeta(p->pDest, 1, p->iDestSchema+1); if( p->pDestDb ){ sqlite3ResetInternalSchema(p->pDestDb, 0); } |