aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/select.c4
-rw-r--r--src/vdbe.c14
2 files changed, 11 insertions, 7 deletions
diff --git a/src/select.c b/src/select.c
index 92efa61e9..013db3339 100644
--- a/src/select.c
+++ b/src/select.c
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.130 2003/03/31 13:36:09 drh Exp $
+** $Id: select.c,v 1.131 2003/04/17 12:44:24 drh Exp $
*/
#include "sqliteInt.h"
@@ -1820,6 +1820,7 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);
sqliteVdbeAddOp(v, OP_OpenRead, base, pTab->tnum);
sqliteVdbeChangeP3(v, -1, pTab->zName, P3_STATIC);
+ cont = sqliteVdbeMakeLabel(v);
if( pIdx==0 ){
sqliteVdbeAddOp(v, seekOp, base, 0);
}else{
@@ -1835,7 +1836,6 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
memset(&eListItem, 0, sizeof(eListItem));
eList.a = &eListItem;
eList.a[0].pExpr = pExpr;
- cont = sqliteVdbeMakeLabel(v);
selectInnerLoop(pParse, p, &eList, 0, 0, 0, -1, eDest, iParm, cont, cont);
sqliteVdbeResolveLabel(v, cont);
sqliteVdbeAddOp(v, OP_Close, base, 0);
diff --git a/src/vdbe.c b/src/vdbe.c
index 5b4fa2d6c..127a6fae2 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -36,7 +36,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.217 2003/04/16 21:03:14 drh Exp $
+** $Id: vdbe.c,v 1.218 2003/04/17 12:44:25 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -4505,10 +4505,14 @@ case OP_IdxRecno: {
int v;
int sz;
sqliteBtreeKeySize(pCrsr, &sz);
- sqliteBtreeKey(pCrsr, sz - sizeof(u32), sizeof(u32), (char*)&v);
- v = keyToInt(v);
- aStack[tos].i = v;
- aStack[tos].flags = STK_Int;
+ if( sz<sizeof(u32) ){
+ aStack[tos].flags = STK_Null;
+ }else{
+ sqliteBtreeKey(pCrsr, sz - sizeof(u32), sizeof(u32), (char*)&v);
+ v = keyToInt(v);
+ aStack[tos].i = v;
+ aStack[tos].flags = STK_Int;
+ }
}
break;
}