1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Get the SQLITE_SECURE_DELETE compile-time option working again.

Ticket #3050. (CVS 4999)

FossilOrigin-Name: 40ba51fd4c621e29e7ff85495b1212c92f06ab31
This commit is contained in:
drh
2008-04-14 01:00:57 +00:00
parent ede2627695
commit c5d0bd907b
6 changed files with 36 additions and 33 deletions

View File

@@ -32,7 +32,7 @@
** start of a transaction, and is thus usually less than a few thousand,
** but can be as large as 2 billion for a really big database.
**
** @(#) $Id: bitvec.c,v 1.3 2008/03/21 16:45:47 drh Exp $
** @(#) $Id: bitvec.c,v 1.4 2008/04/14 01:00:58 drh Exp $
*/
#include "sqliteInt.h"
@@ -130,6 +130,7 @@ int sqlite3BitvecSet(Bitvec *p, u32 i){
u32 h;
assert( p!=0 );
assert( i>0 );
assert( i<=p->iSize );
if( p->iSize<=BITVEC_NBIT ){
i--;
p->u.aBitmap[i/8] |= 1 << (i&7);

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.423 2008/04/03 10:13:01 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.424 2008/04/14 01:00:58 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -4434,19 +4434,6 @@ void sqlite3PagerDontWrite(DbPage *pDbPage){
** the PgHdr.needRead flag is set) then this routine acts as a promise
** that we will never need to read the page content in the future.
** so the needRead flag can be cleared at this point.
**
** This routine is only called from a single place in the sqlite btree
** code (when a leaf is removed from the free-list). This allows the
** following assumptions to be made about pPg:
**
** 1. PagerDontWrite() has been called on the page, OR
** PagerWrite() has not yet been called on the page.
**
** 2. The page existed when the transaction was started.
**
** Details: DontRollback() (this routine) is only called when a leaf is
** removed from the free list. DontWrite() is called whenever a page
** becomes a free-list leaf.
*/
void sqlite3PagerDontRollback(DbPage *pPg){
Pager *pPager = pPg->pPager;
@@ -4464,8 +4451,17 @@ void sqlite3PagerDontRollback(DbPage *pPg){
}
assert( !MEMDB ); /* For a memdb, pPager->journalOpen is always 0 */
/* Check that PagerWrite() has not yet been called on this page, and
** that the page existed when the transaction started.
#ifdef SQLITE_SECURE_DELETE
if( pPg->inJournal || (int)pPg->pgno > pPager->origDbSize ){
return;
}
#endif
/* If SECURE_DELETE is disabled, then there is no way that this
** routine can be called on a page for which sqlite3PagerDontWrite()
** has not been previously called during the same transaction.
** And if DontWrite() has previously been called, the following
** conditions must be met.
*/
assert( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize );
@@ -4474,7 +4470,7 @@ void sqlite3PagerDontRollback(DbPage *pPg){
pPg->inJournal = 1;
pPg->needRead = 0;
if( pPager->stmtInUse ){
assert( pPager->stmtSize <= pPager->origDbSize );
assert( pPager->stmtSize >= pPager->origDbSize );
sqlite3BitvecSet(pPager->pInStmt, pPg->pgno);
}
PAGERTRACE3("DONT_ROLLBACK page %d of %d\n", pPg->pgno, PAGERID(pPager));

View File

@@ -16,7 +16,7 @@
** The focus of this file is providing the TCL testing layer
** access to compile-time constants.
**
** $Id: test_config.c,v 1.24 2008/03/22 01:07:18 drh Exp $
** $Id: test_config.c,v 1.25 2008/04/14 01:00:58 drh Exp $
*/
#include "sqliteLimit.h"
@@ -419,6 +419,12 @@ Tcl_SetVar2(interp, "sqlite_options", "long_double",
Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_SECURE_DELETE
Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY);
#endif
#define LINKVAR(x) { \
static const int cv_ ## x = SQLITE_ ## x; \
Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \