-C Add\sthe\sEP_OptOnly\sflag\son\sexpressions\sfor\sWHERE\sclause\nterms\sthat\sare\sadded\sby\sthe\soptimizer\sbut\sshould\snot\sbe\scoded.\s(CVS\s2540)
-D 2005-07-08T14:14:23
+C Change\sthe\sname\sof\sthe\sOpenTemp\sopcode\sto\sOpenVirtual\swhich\sis\smore\ndescriptive\sof\swhat\sit\sdoes.\s(CVS\s2541)
+D 2005-07-08T17:13:47
F Makefile.in 3c10cd7bc3ecbd60fe4d5a5c0f59bfa7fb217a66
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/date.c 7444b0900a28da77e57e3337a636873cff0ae940
F src/delete.c 250d436a68fe371b4ab403d1c0f6fdc9a6860c39
F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
-F src/expr.c fdc8b82babbb266eeded4a314fd2f1d315133797
+F src/expr.c daf3515d33467090741d98227577356c108ea33f
F src/func.c e6637354fe3a66dfac063a49109f277cde9ce87d
F src/hash.c 2b1b13f7400e179631c83a1be0c664608c8f021f
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
-F src/insert.c d61752504f8a67e28a3bd45288051a587ba899cd
+F src/insert.c c4533240451b73ead88098b5d819cb70fa0880bd
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
F src/main.c 7d0293d9520688d47092ff48c1ed5254cd3c4474
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
F src/prepare.c d53602d2f8e097225ae7c76ec764ae68f759ba47
F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357
F src/random.c 90adff4e73a3b249eb4f1fc2a6ff9cf78c7233a4
-F src/select.c 28b752e58955c7920711fbdbfdcd369a2bd09448
+F src/select.c c611471052773b94af771693686bd5bcdbbb0dba
F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26
F src/sqlite.h.in e06d5774e9cfa5962376ae988300a9f114a3e3d7
-F src/sqliteInt.h b7b2f7fc2c24bcfcedd2c0981a685860f16eb90b
+F src/sqliteInt.h f1804025f8ff45825ae2a2efa01c0be8a95738e8
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
F src/tclsqlite.c cccaf6b78c290d824cf8ea089b8b27377e545830
F src/test1.c 83ead44dead55033adff61ce69a1e2fc3e72935e
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
F src/util.c 1acbe299cbe51f45176ac1e48ded9bea206c3c23
F src/vacuum.c 829d9e1a6d7c094b80e0899686670932eafd768c
-F src/vdbe.c 87dda3fc214e4828641dd53527777f1b7d37b85f
+F src/vdbe.c 971e08e91848e0afcdf5c7312c7f10b5fc6e7cd4
F src/vdbe.h 75e466d84d362b0c4498978a9d6b1e6bd32ecf3b
F src/vdbeInt.h 9be9a6c43d38124bd03cc5cf05715605b1789fd9
F src/vdbeapi.c 7f392f0792d1258c958083d7de9eae7c3530c9a6
F src/vdbeaux.c 3732a86566a6be4da4c606e9334baf3fd98667af
F src/vdbefifo.c b8805850afe13b43f1de78d58088cb5d66f88e1e
F src/vdbemem.c da8e8d6f29dd1323f782f000d7cd120027c9ff03
-F src/where.c e9c0c19052742d74783bdc8dba07ab42609debb7
+F src/where.c 6326f643534a2585a3bbbfe490a39dc4fa1115a5
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/all.test 7f0988442ab811dfa41793b5b550f5828ce316f3
F test/alter.test 9d6837a3d946b73df692b7cef2a7644d2e2f6bc6
F test/index.test 51e01a0928b4b61228917ddd8c6c0e2466547f6f
F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f
F test/index3.test 72bd07b508022db688ec536c460345d24a3912e3
-F test/insert.test f48889e7ffb9fca18734751b47dfc53503fa8298
+F test/insert.test b0a89e1568fe9890758f8f2b43b68e840e8f1a1a
F test/insert2.test 792ad079f59c7e14cf9397712725224e2112c838
F test/insert3.test c67f0240b1c17e71fa2ed8bb6de064928f549f95
F test/interrupt.test 170f87c2819f0e56c76e0a754949ea103d05009c
F test/select3.test 44dccad96a1b9940bb8c6f982d4d218dcd262760
F test/select4.test c239f516aa31f42f2ef7c6d7cd01105f08f934ca
F test/select5.test 2d414f712bff8e590091e08f9b7287600731be00
-F test/select6.test 6e5a1a70a788cdbe515d1252dd0917d7e9d1d71e
+F test/select6.test 6559d16ad16edb7d6864f7e74a3d204d0af72486
F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
F test/sort.test 312eade533cb3c7667110ccfa6e818db1078fd6c
F test/subquery.test 0e37f0f032799c28aa8fcc0dc04ee28a78e5ce8b
F test/vacuum.test 5d4857ae2afc9c20d0edb8acc58bdc8d630126a9
F test/vacuum2.test 5d77e98c458bcdbeecc6327de5107179ba1aa095
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
-F test/view.test e24553116e482a94e9cd22a4eea4909b1c6ed1c6
+F test/view.test 3c79232a2ee45918c62a0cf90411525899404a76
F test/where.test 9de2426d0b8296b3aa7801cef5f81daf51f8e516
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/lemon.c c88936c67f6411608db8fa4254d254f509fa40f6
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
-P b72bff81f9937378417a0af0610d8558279b67a7
-R c4fc77478fdb3a3d8e789b5f5aefe0b7
+P f4a66ed04dfd8714746b766b4859682ea18e328f
+R 7dbd5cf11e082700c07694668805a635
U drh
-Z bbe2b8533b9721f74ae254c674c04a75
+Z 2074933014582e5567aec0bab96430cb
-f4a66ed04dfd8714746b766b4859682ea18e328f
\ No newline at end of file
+3bb9ce5f20d0a6bc19df31df9b8e82044c3e6004
\ No newline at end of file
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.209 2005/06/30 17:04:21 drh Exp $
+** $Id: expr.c,v 1.210 2005/07/08 17:13:47 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
pNew->pOffset = sqlite3ExprDup(p->pOffset);
pNew->iLimit = -1;
pNew->iOffset = -1;
- pNew->ppOpenTemp = 0;
+ pNew->ppOpenVirtual = 0;
pNew->isResolved = p->isResolved;
pNew->isAgg = p->isAgg;
return pNew;
case TK_IN: {
char affinity;
KeyInfo keyInfo;
- int addr; /* Address of OP_OpenTemp instruction */
+ int addr; /* Address of OP_OpenVirtual instruction */
affinity = sqlite3ExprAffinity(pExpr->pLeft);
** is used.
*/
pExpr->iTable = pParse->nTab++;
- addr = sqlite3VdbeAddOp(v, OP_OpenTemp, pExpr->iTable, 0);
+ addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, pExpr->iTable, 0);
memset(&keyInfo, 0, sizeof(keyInfo));
keyInfo.nField = 1;
sqlite3VdbeAddOp(v, OP_SetNumColumns, pExpr->iTable, 1);
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.140 2005/06/24 03:53:06 drh Exp $
+** $Id: insert.c,v 1.141 2005/07/08 17:13:47 drh Exp $
*/
#include "sqliteInt.h"
** back up and execute the SELECT code above.
*/
sqlite3VdbeChangeP2(v, iInitCode, sqlite3VdbeCurrentAddr(v));
- sqlite3VdbeAddOp(v, OP_OpenTemp, srcTab, 0);
+ sqlite3VdbeAddOp(v, OP_OpenVirtual, srcTab, 0);
sqlite3VdbeAddOp(v, OP_SetNumColumns, srcTab, nColumn);
sqlite3VdbeAddOp(v, OP_Goto, 0, iSelectLoop);
sqlite3VdbeResolveLabel(v, iCleanup);
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.252 2005/06/12 21:35:52 drh Exp $
+** $Id: select.c,v 1.253 2005/07/08 17:13:47 drh Exp $
*/
#include "sqliteInt.h"
** DISTINCT, UNION, INTERSECT and EXCEPT select statements (but not
** UNION ALL).
**
-** The value returned is the address of the OP_OpenTemp instruction.
+** The value returned is the address of the OP_OpenVirtual instruction.
*/
-static int openTempIndex(Parse *pParse, Select *p, int iTab){
+static int openVirtualIndex(Parse *pParse, Select *p, int iTab){
KeyInfo *pKeyInfo;
int nColumn;
sqlite3 *db = pParse->db;
pKeyInfo->aColl[i] = db->pDfltColl;
}
}
- addr = sqlite3VdbeOp3(v, OP_OpenTemp, iTab, 0,
+ addr = sqlite3VdbeOp3(v, OP_OpenVirtual, iTab, 0,
(char*)pKeyInfo, P3_KEYINFO_HANDOFF);
return addr;
}
#ifndef SQLITE_OMIT_COMPOUND_SELECT
/*
-** Add the address "addr" to the set of all OpenTemp opcode addresses
-** that are being accumulated in p->ppOpenTemp.
+** Add the address "addr" to the set of all OpenVirtual opcode addresses
+** that are being accumulated in p->ppOpenVirtual.
*/
-static int multiSelectOpenTempAddr(Select *p, int addr){
- IdList *pList = *p->ppOpenTemp = sqlite3IdListAppend(*p->ppOpenTemp, 0);
+static int multiSelectOpenVirtualAddr(Select *p, int addr){
+ IdList *pList = *p->ppOpenVirtual = sqlite3IdListAppend(*p->ppOpenVirtual, 0);
if( pList==0 ){
return SQLITE_NOMEM;
}
int rc = SQLITE_OK; /* Success code from a subroutine */
Select *pPrior; /* Another SELECT immediately to our left */
Vdbe *v; /* Generate code to this VDBE */
- IdList *pOpenTemp = 0;/* OP_OpenTemp opcodes that need a KeyInfo */
+ IdList *pOpenVirtual = 0;/* OP_OpenVirtual opcodes that need a KeyInfo */
int aAddr[5]; /* Addresses of SetNumColumns operators */
int nAddr = 0; /* Number used */
int nCol; /* Number of columns in the result set */
}
/* If *p this is the right-most select statement, then initialize
- ** p->ppOpenTemp to point to pOpenTemp. If *p is not the right most
- ** statement then p->ppOpenTemp will have already been initialized
- ** by a prior call to this same procedure. Pass along the pOpenTemp
+ ** p->ppOpenVirtual to point to pOpenVirtual. If *p is not the right most
+ ** statement then p->ppOpenVirtual will have already been initialized
+ ** by a prior call to this same procedure. Pass along the pOpenVirtual
** pointer to pPrior, the next statement to our left.
*/
- if( p->ppOpenTemp==0 ){
- p->ppOpenTemp = &pOpenTemp;
+ if( p->ppOpenVirtual==0 ){
+ p->ppOpenVirtual = &pOpenVirtual;
}
- pPrior->ppOpenTemp = p->ppOpenTemp;
+ pPrior->ppOpenVirtual = p->ppOpenVirtual;
/* Create the destination temporary table if necessary
*/
if( eDest==SRT_TempTable ){
assert( p->pEList );
- sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0);
+ sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 0);
assert( nAddr==0 );
aAddr[nAddr++] = sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, 0);
eDest = SRT_Table;
rc = 1;
goto multi_select_end;
}
- addr = sqlite3VdbeAddOp(v, OP_OpenTemp, unionTab, 0);
+ addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, unionTab, 0);
if( p->op!=TK_ALL ){
- rc = multiSelectOpenTempAddr(p, addr);
+ rc = multiSelectOpenVirtualAddr(p, addr);
if( rc!=SQLITE_OK ){
goto multi_select_end;
}
goto multi_select_end;
}
- addr = sqlite3VdbeAddOp(v, OP_OpenTemp, tab1, 0);
- rc = multiSelectOpenTempAddr(p, addr);
+ addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, tab1, 0);
+ rc = multiSelectOpenVirtualAddr(p, addr);
if( rc!=SQLITE_OK ){
goto multi_select_end;
}
/* Code the current SELECT into temporary table "tab2"
*/
- addr = sqlite3VdbeAddOp(v, OP_OpenTemp, tab2, 0);
- rc = multiSelectOpenTempAddr(p, addr);
+ addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, tab2, 0);
+ rc = multiSelectOpenVirtualAddr(p, addr);
if( rc!=SQLITE_OK ){
goto multi_select_end;
}
** SELECT might also skip this part if it has no ORDER BY clause and
** no temp tables are required.
*/
- if( p->pOrderBy || (pOpenTemp && pOpenTemp->nId>0) ){
+ if( p->pOrderBy || (pOpenVirtual && pOpenVirtual->nId>0) ){
int i; /* Loop counter */
KeyInfo *pKeyInfo; /* Collating sequence for the result set */
- assert( p->ppOpenTemp == &pOpenTemp );
+ assert( p->ppOpenVirtual == &pOpenVirtual );
pKeyInfo = sqliteMalloc(sizeof(*pKeyInfo)+nCol*sizeof(CollSeq*));
if( !pKeyInfo ){
rc = SQLITE_NOMEM;
}
}
- for(i=0; pOpenTemp && i<pOpenTemp->nId; i++){
+ for(i=0; pOpenVirtual && i<pOpenVirtual->nId; i++){
int p3type = (i==0?P3_KEYINFO_HANDOFF:P3_KEYINFO);
- int addr = pOpenTemp->a[i].idx;
+ int addr = pOpenVirtual->a[i].idx;
sqlite3VdbeChangeP3(v, addr, (char *)pKeyInfo, p3type);
}
generateSortTail(pParse, p, v, p->pEList->nExpr, eDest, iParm);
}
- if( !pOpenTemp ){
+ if( !pOpenVirtual ){
/* This happens for UNION ALL ... ORDER BY */
sqliteFree(pKeyInfo);
}
}
multi_select_end:
- if( pOpenTemp ){
- sqlite3IdListDelete(pOpenTemp);
+ if( pOpenVirtual ){
+ sqlite3IdListDelete(pOpenVirtual);
}
- p->ppOpenTemp = 0;
+ p->ppOpenVirtual = 0;
return rc;
}
#endif /* SQLITE_OMIT_COMPOUND_SELECT */
/* If the output is destined for a temporary table, open that table.
*/
if( eDest==SRT_TempTable ){
- sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0);
+ sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 0);
sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, 1);
}
/* If the output is destined for a temporary table, open that table.
*/
if( eDest==SRT_TempTable ){
- sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0);
+ sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 0);
sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, pEList->nExpr);
}
*/
if( isDistinct ){
distinct = pParse->nTab++;
- openTempIndex(pParse, p, distinct);
+ openVirtualIndex(pParse, p, distinct);
}else{
distinct = -1;
}
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.391 2005/07/08 14:14:23 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.392 2005/07/08 17:13:47 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
Expr *pLimit; /* LIMIT expression. NULL means not used. */
Expr *pOffset; /* OFFSET expression. NULL means not used. */
int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
- IdList **ppOpenTemp; /* OP_OpenTemp addresses used by multi-selects */
+ IdList **ppOpenVirtual;/* OP_OpenVirtual addresses used by multi-selects */
u8 isResolved; /* True once sqlite3SelectResolve() has run. */
u8 isAgg; /* True if this is an aggregate query */
};
** 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.473 2005/07/08 13:08:00 drh Exp $
+** $Id: vdbe.c,v 1.474 2005/07/08 17:13:47 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
break;
}
-/* Opcode: OpenTemp P1 * P3
+/* Opcode: OpenVirtual P1 * P3
**
-** Open a new cursor to a transient table.
-** The transient cursor is always opened read/write even if
-** the main database is read-only. The transient table is deleted
-** automatically when the cursor is closed.
+** Open a new cursor to a transient or virtual table.
+** The cursor is always opened read/write even if
+** the main database is read-only. The transient or virtual
+** table is deleted automatically when the cursor is closed.
**
** The cursor points to a BTree table if P3==0 and to a BTree index
** if P3 is not 0. If P3 is not NULL, it points to a KeyInfo structure
** that defines the format of keys in the index.
-**
-** This opcode is used for tables that exist for the duration of a single
-** SQL statement only. Tables created using CREATE TEMPORARY TABLE
-** are opened using OP_OpenRead or OP_OpenWrite. "Temporary" in the
-** context of this opcode means for the duration of a single SQL statement
-** whereas "Temporary" in the context of CREATE TABLE means for the duration
-** of the connection to the database. Same word; different meanings.
*/
-case OP_OpenTemp: { /* no-push */
+case OP_OpenVirtual: { /* no-push */
int i = pOp->p1;
Cursor *pCx;
assert( i>=0 );
** 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.141 2005/07/08 14:14:23 drh Exp $
+** $Id: where.c,v 1.142 2005/07/08 17:13:47 drh Exp $
*/
#include "sqliteInt.h"
}
/*
-** The number of bits in a Bitmask
+** The number of bits in a Bitmask. "BMS" means "BitMask Size".
*/
#define BMS (sizeof(Bitmask)*8-1)
# This file implements regression tests for SQLite library. The
# focus of this file is testing the INSERT statement.
#
-# $Id: insert.test,v 1.26 2005/05/29 14:23:13 danielk1977 Exp $
+# $Id: insert.test,v 1.27 2005/07/08 17:13:47 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set x [execsql {
EXPLAIN INSERT INTO t4 SELECT x+2 FROM t4;
}]
- expr {[lsearch $x OpenTemp]>0}
+ expr {[lsearch $x OpenVirtual]>0}
} {1}
}
# focus of this file is testing SELECT statements that contain
# subqueries in their FROM clause.
#
-# $Id: select6.test,v 1.17 2005/01/29 08:32:46 danielk1977 Exp $
+# $Id: select6.test,v 1.18 2005/07/08 17:13:47 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# sqliteFlattenSubquery() routine in select.c is doing its job.
#
proc is_flat {sql} {
- return [expr 0>[lsearch [execsql "EXPLAIN $sql"] OpenTemp]]
+ return [expr 0>[lsearch [execsql "EXPLAIN $sql"] OpenVirtual]]
}
# Check that the flattener works correctly for deeply nested subqueries
# This file implements regression tests for SQLite library. The
# focus of this file is testing VIEW statements.
#
-# $Id: view.test,v 1.25 2005/06/06 15:32:08 drh Exp $
+# $Id: view.test,v 1.26 2005/07/08 17:13:47 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_test view-5.3 {
lsearch [execsql {
EXPLAIN SELECT * FROM v5;
- }] OpenTemp
+ }] OpenVirtual
} {-1}
do_test view-5.4 {
execsql {
do_test view-5.5 {
lsearch [execsql {
EXPLAIN SELECT * FROM v5 AS a, t2 AS b WHERE a.w=b.y;
- }] OpenTemp
+ }] OpenVirtual
} {-1}
do_test view-5.6 {
execsql {
do_test view-5.7 {
lsearch [execsql {
EXPLAIN SELECT * FROM t2 AS b, v5 AS a WHERE a.w=b.y;
- }] OpenTemp
+ }] OpenVirtual
} {-1}
do_test view-5.8 {
execsql {
do_test view-5.9 {
lsearch [execsql {
EXPLAIN SELECT * FROM t1 AS a, v5 AS b, t2 AS c WHERE a.x=b.v AND b.w=c.y;
- }] OpenTemp
+ }] OpenVirtual
} {-1}
} ;# endif explain