mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 19:58:30 +00:00
Upgrade SQLite to 3.40 (#699)
This commit is contained in:
parent
bcae817215
commit
0dc0758574
151 changed files with 27917 additions and 22169 deletions
20
third_party/sqlite3/vacuum.c
vendored
20
third_party/sqlite3/vacuum.c
vendored
|
@ -14,9 +14,8 @@
|
|||
** Most of the code in this file may be omitted by defining the
|
||||
** SQLITE_OMIT_VACUUM macro.
|
||||
*/
|
||||
#include "third_party/sqlite3/sqliteInt.inc"
|
||||
#include "third_party/sqlite3/sqliteInt.h"
|
||||
#include "third_party/sqlite3/vdbeInt.inc"
|
||||
/* clang-format off */
|
||||
|
||||
#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
|
||||
|
||||
|
@ -152,8 +151,8 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
|
|||
Btree *pTemp; /* The temporary database we vacuum into */
|
||||
u32 saved_mDbFlags; /* Saved value of db->mDbFlags */
|
||||
u64 saved_flags; /* Saved value of db->flags */
|
||||
int saved_nChange; /* Saved value of db->nChange */
|
||||
int saved_nTotalChange; /* Saved value of db->nTotalChange */
|
||||
i64 saved_nChange; /* Saved value of db->nChange */
|
||||
i64 saved_nTotalChange; /* Saved value of db->nTotalChange */
|
||||
u32 saved_openFlags; /* Saved value of db->openFlags */
|
||||
u8 saved_mTrace; /* Saved trace settings */
|
||||
Db *pDb = 0; /* Database to detach at end of vacuum */
|
||||
|
@ -162,6 +161,7 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
|
|||
int nDb; /* Number of attached databases */
|
||||
const char *zDbMain; /* Schema name of database to vacuum */
|
||||
const char *zOut; /* Name of output file */
|
||||
u32 pgflags = PAGER_SYNCHRONOUS_OFF; /* sync flags for output db */
|
||||
|
||||
if( !db->autoCommit ){
|
||||
sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction");
|
||||
|
@ -233,12 +233,17 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
|
|||
goto end_of_vacuum;
|
||||
}
|
||||
db->mDbFlags |= DBFLAG_VacuumInto;
|
||||
|
||||
/* For a VACUUM INTO, the pager-flags are set to the same values as
|
||||
** they are for the database being vacuumed, except that PAGER_CACHESPILL
|
||||
** is always set. */
|
||||
pgflags = db->aDb[iDb].safety_level | (db->flags & PAGER_FLAGS_MASK);
|
||||
}
|
||||
nRes = sqlite3BtreeGetRequestedReserve(pMain);
|
||||
|
||||
sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size);
|
||||
sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0));
|
||||
sqlite3BtreeSetPagerFlags(pTemp, PAGER_SYNCHRONOUS_OFF|PAGER_CACHESPILL);
|
||||
sqlite3BtreeSetPagerFlags(pTemp, pgflags|PAGER_CACHESPILL);
|
||||
|
||||
/* Begin a transaction and take an exclusive lock on the main database
|
||||
** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below,
|
||||
|
@ -251,7 +256,9 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
|
|||
|
||||
/* Do not attempt to change the page size for a WAL database */
|
||||
if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain))
|
||||
==PAGER_JOURNALMODE_WAL ){
|
||||
==PAGER_JOURNALMODE_WAL
|
||||
&& pOut==0
|
||||
){
|
||||
db->nextPagesize = 0;
|
||||
}
|
||||
|
||||
|
@ -367,6 +374,7 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
|
|||
|
||||
assert( rc==SQLITE_OK );
|
||||
if( pOut==0 ){
|
||||
nRes = sqlite3BtreeGetRequestedReserve(pTemp);
|
||||
rc = sqlite3BtreeSetPageSize(pMain, sqlite3BtreeGetPageSize(pTemp), nRes,1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue