1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Add experimental pragma "quick_check", a reduced version of integrity_check that runs without most of the overhead of the full integrity_check. (CVS 4645)

FossilOrigin-Name: 2ddc8d72723e5a294e850491fcd9c1fb7474a9c3
This commit is contained in:
danielk1977
2007-12-29 13:39:19 +00:00
parent 71f971b2da
commit 41c58b78b9
4 changed files with 24 additions and 13 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.152 2007/12/13 21:54:11 drh Exp $
** $Id: pragma.c,v 1.153 2007/12/29 13:39:20 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -815,7 +815,13 @@ void sqlite3Pragma(
#endif
#ifndef SQLITE_OMIT_INTEGRITY_CHECK
if( sqlite3StrICmp(zLeft, "integrity_check")==0 ){
/* Pragma "quick_check" is an experimental reduced version of
** integrity_check designed to detect most database corruption
** without most of the overhead of a full integrity-check.
*/
if( sqlite3StrICmp(zLeft, "integrity_check")==0
|| sqlite3StrICmp(zLeft, "quick_check")==0
){
int i, j, addr, mxErr;
/* Code that appears at the end of the integrity check. If no error
@@ -830,6 +836,8 @@ void sqlite3Pragma(
{ OP_Callback, 1, 0, 0},
};
int isQuick = (zLeft[0]=='q');
/* Initialize the VDBE program */
if( sqlite3ReadSchema(pParse) ) goto pragma_out;
sqlite3VdbeSetNumCols(v, 1);
@@ -884,7 +892,7 @@ void sqlite3Pragma(
/* Make sure all the indices are constructed correctly.
*/
for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
for(x=sqliteHashFirst(pTbls); x && !isQuick; x=sqliteHashNext(x)){
Table *pTab = sqliteHashData(x);
Index *pIdx;
int loopTop;