aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2006-01-07 13:21:04 +0000
committerdanielk1977 <danielk1977@noemail.net>2006-01-07 13:21:04 +0000
commitc00da105654fb2bd0712acccac3e36b539805d08 (patch)
treebe8fb606d3568c09ec40310e35179152dcd56a03 /src/select.c
parent8c0ca7d27c60c5a43dbfeab3c869a45e0e3603b1 (diff)
downloadsqlite-c00da105654fb2bd0712acccac3e36b539805d08.tar.gz
sqlite-c00da105654fb2bd0712acccac3e36b539805d08.zip
In shared-cache mode, lock all required tables before beginning to execute the body of the statement program. (CVS 2881)
FossilOrigin-Name: 23b587b05b89727248805e6d9e5141e018cf2152
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c
index af19681c5..c1eaec9bf 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.285 2006/01/05 14:22:34 danielk1977 Exp $
+** $Id: select.c,v 1.286 2006/01/07 13:21:04 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -2229,6 +2229,7 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
iCol = pExpr->iColumn;
pTab = pSrc->a[0].pTab;
+
/* If we get to here, it means the query is of the correct form.
** Check to make sure we have an index and make pIdx point to the
** appropriate index. If the min() or max() is on an INTEGER PRIMARY
@@ -2266,11 +2267,12 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
*/
iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
sqlite3CodeVerifySchema(pParse, iDb);
+ sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
base = pSrc->a[0].iCursor;
brk = sqlite3VdbeMakeLabel(v);
computeLimitRegisters(pParse, p, brk);
if( pSrc->a[0].pSelect==0 ){
- sqlite3OpenTableForReading(v, base, iDb, pTab);
+ sqlite3OpenTable(pParse, base, iDb, pTab, OP_OpenRead);
}
if( pIdx==0 ){
sqlite3VdbeAddOp(v, seekOp, base, 0);