/ Check-in [b7d080b8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge accidentally created fork.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b7d080b8e850bd262f53f29ba4687a62cf76d4ef
User & Date: dan 2011-01-11 17:40:31
Context
2011-01-12
17:56
Do not raise an SQLITE_CORRUPT error in Recoverymode if the database size in the header is larger than the physical file size. This facilitates recovery of a database in which the database size field has been corrupted. check-in: 114640d9 user: drh tags: trunk
2011-01-11
17:40
Merge accidentally created fork. check-in: b7d080b8 user: dan tags: trunk
17:39
Add the SQLITE_FCNTL_SYNC file-control. check-in: b3f2f465 user: dan tags: trunk
17:38
Change the page size of the destination database in a backup, if it is changeable, prior to starting the backup. check-in: a5e4e0ca user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/backup.c.

   112    112     if( i<0 ){
   113    113       sqlite3Error(pErrorDb, SQLITE_ERROR, "unknown database %s", zDb);
   114    114       return 0;
   115    115     }
   116    116   
   117    117     return pDb->aDb[i].pBt;
   118    118   }
          119  +
          120  +/*
          121  +** Attempt to set the page size of the destination to match the page size
          122  +** of the source.
          123  +*/
          124  +static int setDestPgsz(sqlite3_backup *p){
          125  +  int rc;
          126  +  rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0);
          127  +  return rc;
          128  +}
   119    129   
   120    130   /*
   121    131   ** Create an sqlite3_backup process to copy the contents of zSrcDb from
   122    132   ** connection handle pSrcDb to zDestDb in pDestDb. If successful, return
   123    133   ** a pointer to the new sqlite3_backup object.
   124    134   **
   125    135   ** If an error occurs, NULL is returned and an error code and error message
................................................................................
   166    176       p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb);
   167    177       p->pDest = findBtree(pDestDb, pDestDb, zDestDb);
   168    178       p->pDestDb = pDestDb;
   169    179       p->pSrcDb = pSrcDb;
   170    180       p->iNext = 1;
   171    181       p->isAttached = 0;
   172    182   
   173         -    if( 0==p->pSrc || 0==p->pDest ){
   174         -      /* One (or both) of the named databases did not exist. An error has
   175         -      ** already been written into the pDestDb handle. All that is left
   176         -      ** to do here is free the sqlite3_backup structure.
          183  +    if( 0==p->pSrc || 0==p->pDest || setDestPgsz(p)==SQLITE_NOMEM ){
          184  +      /* One (or both) of the named databases did not exist or an OOM
          185  +      ** error was hit.  The error has already been written into the
          186  +      ** pDestDb handle.  All that is left to do here is free the
          187  +      ** sqlite3_backup structure.
   177    188         */
   178    189         sqlite3_free(p);
   179    190         p = 0;
   180    191       }
   181    192     }
   182    193     if( p ){
   183    194       p->pSrc->nBackup++;