/ Check-in [a5e4e0ca]
Login

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

Overview
Comment:Change the page size of the destination database in a backup, if it is changeable, prior to starting the backup.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a5e4e0caad788318bc973e2550488a3b83128b8b
User & Date: drh 2011-01-11 17:38:03
Context
2011-01-11
17:40
Merge accidentally created fork. check-in: b7d080b8 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
16:09
If a rollback is attempted in journal_mode=off mode, force SQLite to discard the contents of the pager cache before processing any subsequent queries. check-in: ece7efce user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

install-sh became executable.


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++;

test/progress.test became a regular file.


tool/mkopts.tcl became a regular file.