Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the -vacuum switch to the "rbu" demonstration program. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | rbu-vacuum |
Files: | files | file ages | folders |
SHA1: |
9a0078a538c7e73a009960347b8953c5 |
User & Date: | dan 2016-04-18 09:17:05.073 |
Context
2016-04-18
| ||
18:18 | Fix some zipvfs related problems in RBU vacuum. (check-in: d76f4aaa4c user: dan tags: rbu-vacuum) | |
09:17 | Add the -vacuum switch to the "rbu" demonstration program. (check-in: 9a0078a538 user: dan tags: rbu-vacuum) | |
2016-04-16
| ||
19:02 | Changes so that rbu vacuum works with zipvfs databases. (check-in: bae7f875f4 user: dan tags: rbu-vacuum) | |
Changes
Changes to ext/rbu/rbu.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | #include <string.h> /* ** Print a usage message and exit. */ void usage(const char *zArgv0){ fprintf(stderr, | | > > > > > > | > > > > | | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #include <string.h> /* ** Print a usage message and exit. */ void usage(const char *zArgv0){ fprintf(stderr, "Usage: %s ?OPTIONS? TARGET-DB RBU-DB\n" "\n" "Where options are:\n" "\n" " -step NSTEP\n" " -vacuum\n" "\n" " If the -vacuum switch is not present, argument RBU-DB must be an RBU\n" " database containing an update suitable for target database TARGET-DB.\n" " Or, if -vacuum is specified, then TARGET-DB is a database to vacuum using\n" " RBU, and RBU-DB is used as the state database for the vacuum (refer to\n" " API documentation for details).\n" "\n" " If NSTEP is set to less than or equal to zero (the default value), this \n" " program attempts to perform the entire update or vacuum operation before\n" " exiting\n" "\n" " If NSTEP is greater than zero, then a maximum of NSTEP calls are made\n" " to sqlite3rbu_step(). If the RBU update has not been completely applied\n" " after the NSTEP'th call is made, the state is saved in the database RBU-DB\n" " and the program exits. Subsequent invocations of this (or any other RBU)\n" " application will use this state to resume applying the RBU update to the\n" " target db.\n" |
︙ | ︙ | |||
65 66 67 68 69 70 71 72 73 74 | int i; const char *zTarget; /* Target database to apply RBU to */ const char *zRbu; /* Database containing RBU */ char zBuf[200]; /* Buffer for printf() */ char *zErrmsg; /* Error message, if any */ sqlite3rbu *pRbu; /* RBU handle */ int nStep = 0; /* Maximum number of step() calls */ int rc; sqlite3_int64 nProgress = 0; | > > < < | > > | | > > > | | | | > > > > > > > > > > > | < < | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | int i; const char *zTarget; /* Target database to apply RBU to */ const char *zRbu; /* Database containing RBU */ char zBuf[200]; /* Buffer for printf() */ char *zErrmsg; /* Error message, if any */ sqlite3rbu *pRbu; /* RBU handle */ int nStep = 0; /* Maximum number of step() calls */ int bVacuum = 0; int rc; sqlite3_int64 nProgress = 0; int nArg = argc-2; if( argc<3 ) usage(argv[0]); for(i=1; i<nArg; i++){ const char *zArg = argv[i]; int nArg = strlen(zArg); if( nArg>1 && nArg<=8 && 0==memcmp(zArg, "-vacuum", nArg) ){ bVacuum = 1; }else if( nArg>1 && nArg<=5 && 0==memcmp(zArg, "-step", nArg) && i<nArg-1 ){ i++; nStep = atoi(argv[i]); }else{ usage(argv[0]); } } zTarget = argv[argc-2]; zRbu = argv[argc-1]; report_default_vfs(); /* Open an RBU handle. A vacuum handle if -vacuum was specified, or a ** regular RBU update handle otherwise. */ if( bVacuum ){ pRbu = sqlite3rbu_vacuum(zTarget, zRbu); }else{ pRbu = sqlite3rbu_open(zTarget, zRbu, 0); } report_rbu_vfs(pRbu); /* If nStep is less than or equal to zero, call ** sqlite3rbu_step() until either the RBU has been completely applied ** or an error occurs. Or, if nStep is greater than zero, call ** sqlite3rbu_step() a maximum of nStep times. */ for(i=0; (nStep<=0 || i<nStep) && sqlite3rbu_step(pRbu)==SQLITE_OK; i++); nProgress = sqlite3rbu_progress(pRbu); rc = sqlite3rbu_close(pRbu, &zErrmsg); /* Let the user know what happened. */ switch( rc ){ case SQLITE_OK: |
︙ | ︙ |