Avoid parsing an entire record header when it is not required. (CVS 2940)
FossilOrigin-Name: 0de729d9144afba144811799f65e32140c14ef8a
This commit is contained in:
+6
-6
@@ -43,7 +43,7 @@
|
||||
** in this file for details. If in doubt, do not deviate from existing
|
||||
** commenting and indentation practices when changing or adding code.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.527 2006/01/13 06:33:24 danielk1977 Exp $
|
||||
** $Id: vdbe.c,v 1.528 2006/01/13 15:58:43 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -1962,7 +1962,7 @@ case OP_Column: {
|
||||
|
||||
/* If payloadSize is 0, then just push a NULL onto the stack. */
|
||||
if( payloadSize==0 ){
|
||||
pTos->flags = MEM_Null;
|
||||
assert( pTos->flags==MEM_Null );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2051,11 +2051,11 @@ case OP_Column: {
|
||||
aOffset[i++] = 0;
|
||||
}
|
||||
|
||||
/* The header should end at the start of data and the data should
|
||||
** end at last byte of the record. If this is not the case then
|
||||
** we are dealing with a malformed record.
|
||||
/* If we have read more header data than was contained in the header,
|
||||
** or if the end of the last field appears to be past the end of the
|
||||
** record, then we must be dealing with a corrupt database.
|
||||
*/
|
||||
if( idx!=szHdr || offset!=payloadSize ){
|
||||
if( idx>szHdr || offset>payloadSize ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto op_column_out;
|
||||
}
|
||||
|
||||
+8
-1
@@ -16,7 +16,7 @@
|
||||
** so is applicable. Because this module is responsible for selecting
|
||||
** indices, you might also think of this module as the "query optimizer".
|
||||
**
|
||||
** $Id: where.c,v 1.196 2006/01/13 13:01:19 danielk1977 Exp $
|
||||
** $Id: where.c,v 1.197 2006/01/13 15:58:43 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -1592,6 +1592,13 @@ WhereInfo *sqlite3WhereBegin(
|
||||
if( pTab->isTransient || pTab->pSelect ) continue;
|
||||
if( (pLevel->flags & WHERE_IDX_ONLY)==0 ){
|
||||
sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, OP_OpenRead);
|
||||
if( pTab->nCol<(sizeof(Bitmask)*8) ){
|
||||
Bitmask b = pTabItem->colUsed;
|
||||
int n = 0;
|
||||
for(; b; b=b>>1, n++);
|
||||
sqlite3VdbeChangeP2(v, sqlite3VdbeCurrentAddr(v)-1, n);
|
||||
assert( n<=pTab->nCol );
|
||||
}
|
||||
}else{
|
||||
sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user