aboutsummaryrefslogtreecommitdiff
path: root/src/resolve.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2009-02-23 17:33:49 +0000
committerdanielk1977 <danielk1977@noemail.net>2009-02-23 17:33:49 +0000
commite2d7b24d0845001051956223cccd3eae73fcbd3e (patch)
tree0b05f743663f9caa3683e639b9d6c2bd06d0807e /src/resolve.c
parent699b3d4f89f2d97ce5699eaf1931243a3d8dc488 (diff)
downloadsqlite-e2d7b24d0845001051956223cccd3eae73fcbd3e.tar.gz
sqlite-e2d7b24d0845001051956223cccd3eae73fcbd3e.zip
Scan an index instead of a table for "SELECT count(*) FROM <tbl>" queries. Because an index is usually smaller than a table on disk, this saves some IO. (CVS 6315)
FossilOrigin-Name: 294ba6f743c9132dce0e73da480bd3c2071e7239
Diffstat (limited to 'src/resolve.c')
-rw-r--r--src/resolve.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/resolve.c b/src/resolve.c
index af44730ef..29f1f2b92 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -14,7 +14,7 @@
** resolve all identifiers by associating them with a particular
** table and column.
**
-** $Id: resolve.c,v 1.16 2009/02/19 14:39:25 danielk1977 Exp $
+** $Id: resolve.c,v 1.17 2009/02/23 17:33:50 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <stdlib.h>
@@ -347,14 +347,18 @@ static int lookupName(
** column number is greater than the number of bits in the bitmask
** then set the high-order bit of the bitmask.
*/
- if( pExpr->iColumn>=0 && pMatch!=0 ){
- int n = pExpr->iColumn;
- testcase( n==BMS-1 );
- if( n>=BMS ){
- n = BMS-1;
+ if( pMatch ){
+ if( pExpr->iColumn>=0 ){
+ int n = pExpr->iColumn;
+ testcase( n==BMS-1 );
+ if( n>=BMS ){
+ n = BMS-1;
+ }
+ assert( pMatch->iCursor==pExpr->iTable );
+ pMatch->colUsed |= ((Bitmask)1)<<n;
+ }else{
+ pMatch->usesRowid = 1;
}
- assert( pMatch->iCursor==pExpr->iTable );
- pMatch->colUsed |= ((Bitmask)1)<<n;
}
lookupname_end: