Skip to content

Commit 2ef0996

Browse files
committed
Add SQLite version 3.28.0
1 parent 8b01111 commit 2ef0996

File tree

5 files changed

+5017
-3720
lines changed

5 files changed

+5017
-3720
lines changed

rekeyvacuum.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
** Change 2: Remove local variable 'int nRes'
99
** Change 3: Remove initialization 'nRes = sqlite3BtreeGetOptimalReserve(pMain)'
1010
**
11-
** Code generated by script/rekeyvacuum.sh from SQLite v3.27.2 amalgamation.
11+
** Code generated by script/rekeyvacuum.sh from SQLite v3.28.0 amalgamation.
1212
*/
13-
SQLITE_PRIVATE int sqlite3RekeyVacuum(
13+
SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RekeyVacuum(
1414
char **pzErrMsg, /* Write error message here */
1515
sqlite3 *db, /* Database connection */
1616
int iDb, /* Which attached DB to vacuum */
17-
sqlite3_value *pOut /* Write results here, if not NULL */
17+
sqlite3_value *pOut /* Write results here, if not NULL. VACUUM INTO */
1818
, int nRes){
1919
int rc = SQLITE_OK; /* Return code from service routines */
2020
Btree *pMain; /* The database being vacuumed */
@@ -23,6 +23,7 @@ SQLITE_PRIVATE int sqlite3RekeyVacuum(
2323
u64 saved_flags; /* Saved value of db->flags */
2424
int saved_nChange; /* Saved value of db->nChange */
2525
int saved_nTotalChange; /* Saved value of db->nTotalChange */
26+
u32 saved_openFlags; /* Saved value of db->openFlags */
2627
u8 saved_mTrace; /* Saved trace settings */
2728
Db *pDb = 0; /* Database to detach at end of vacuum */
2829
int isMemDb; /* True if vacuuming a :memory: database */
@@ -32,18 +33,21 @@ SQLITE_PRIVATE int sqlite3RekeyVacuum(
3233

3334
if( !db->autoCommit ){
3435
sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction");
35-
return SQLITE_ERROR;
36+
return SQLITE_ERROR; /* IMP: R-12218-18073 */
3637
}
3738
if( db->nVdbeActive>1 ){
3839
sqlite3SetString(pzErrMsg, db,"cannot VACUUM - SQL statements in progress");
39-
return SQLITE_ERROR;
40+
return SQLITE_ERROR; /* IMP: R-15610-35227 */
4041
}
42+
saved_openFlags = db->openFlags;
4143
if( pOut ){
4244
if( sqlite3_value_type(pOut)!=SQLITE_TEXT ){
4345
sqlite3SetString(pzErrMsg, db, "non-text filename");
4446
return SQLITE_ERROR;
4547
}
4648
zOut = (const char*)sqlite3_value_text(pOut);
49+
db->openFlags &= ~SQLITE_OPEN_READONLY;
50+
db->openFlags |= SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE;
4751
}else{
4852
zOut = "";
4953
}
@@ -82,6 +86,7 @@ SQLITE_PRIVATE int sqlite3RekeyVacuum(
8286
*/
8387
nDb = db->nDb;
8488
rc = execSqlF(db, pzErrMsg, "ATTACH %Q AS vacuum_db", zOut);
89+
db->openFlags = saved_openFlags;
8590
if( rc!=SQLITE_OK ) goto end_of_vacuum;
8691
assert( (db->nDb-1)==nDb );
8792
pDb = &db->aDb[nDb];
@@ -95,6 +100,7 @@ SQLITE_PRIVATE int sqlite3RekeyVacuum(
95100
sqlite3SetString(pzErrMsg, db, "output file already exists");
96101
goto end_of_vacuum;
97102
}
103+
db->mDbFlags |= DBFLAG_VacuumInto;
98104
}
99105

100106
/* A VACUUM cannot change the pagesize of an encrypted database. */

script/rekeyvacuum.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ cat <<EOF
3131
** Code generated by script/rekeyvacuum.sh from SQLite v$VERSION amalgamation.
3232
*/
3333
EOF
34-
sed -n '/^SQLITE_PRIVATE int sqlite3RunVacuum([^;]*$/,/^}$/p' "$INPUT" \
34+
sed -n '/^SQLITE_PRIVATE .*int sqlite3RunVacuum([^;]*$/,/^}$/p' "$INPUT" \
3535
| sed 's/sqlite3RunVacuum/sqlite3RekeyVacuum/' \
3636
| sed 's/^\([^ )][^)]*\)\?){$/\1, int nRes){/' \
3737
| grep -v "int nRes;\|nRes = " \

0 commit comments

Comments
 (0)