mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Progress toward getting the virtual-table code generator to work. (CVS 3220)
FossilOrigin-Name: 3532f1340f939b0231c1d82a7b2d186cb096fb29
This commit is contained in:
22
manifest
22
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Added\scode\sto\siterate\sthrough\svirtual\stables.\s\sAll\sregression\stests\spass\nbut\sthe\snew\scode\sis\scompletely\suntested.\s(CVS\s3219)
|
C Progress\stoward\sgetting\sthe\svirtual-table\scode\sgenerator\sto\swork.\s(CVS\s3220)
|
||||||
D 2006-06-12T21:59:14
|
D 2006-06-13T01:04:52
|
||||||
F Makefile.in 56fd6261e83f60724e6dcd764e06ab68cbd53909
|
F Makefile.in 56fd6261e83f60724e6dcd764e06ab68cbd53909
|
||||||
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
|
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
|
||||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||||
@@ -42,7 +42,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
|
|||||||
F src/date.c cd2bd5d1ebc6fa12d6312f69789ae5b0a2766f2e
|
F src/date.c cd2bd5d1ebc6fa12d6312f69789ae5b0a2766f2e
|
||||||
F src/delete.c f9a8c7837adb4bb4810a698a041a88d5ec7bfa9a
|
F src/delete.c f9a8c7837adb4bb4810a698a041a88d5ec7bfa9a
|
||||||
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
||||||
F src/expr.c 3ea9b26c6cdb7bcf0715c1b6aa0f7f5e813f61eb
|
F src/expr.c 896f642936e9248b50c1449fd4b3924bcb149632
|
||||||
F src/func.c acbbf533b55221f26760798d99b37de3ac5678fe
|
F src/func.c acbbf533b55221f26760798d99b37de3ac5678fe
|
||||||
F src/hash.c 449f3d6620193aa557f5d86cbc5cc6b87702b185
|
F src/hash.c 449f3d6620193aa557f5d86cbc5cc6b87702b185
|
||||||
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
|
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
|
||||||
@@ -72,7 +72,7 @@ F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
|
|||||||
F src/select.c 38eda11d950ed5e631ea9054f84a4a8b9e9b39d8
|
F src/select.c 38eda11d950ed5e631ea9054f84a4a8b9e9b39d8
|
||||||
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
||||||
F src/shell.c 55bf6335dae7146f7a300039f5d6bb35010f1996
|
F src/shell.c 55bf6335dae7146f7a300039f5d6bb35010f1996
|
||||||
F src/sqlite.h.in 251b584d707939b38663f5ad9a1a1815d6cce9fb
|
F src/sqlite.h.in 6fb7062da7e9c446623fa26b042bcf4b4050d702
|
||||||
F src/sqlite3ext.h 127bd394c8eea481f2ac9b754bf399dbfc818b75
|
F src/sqlite3ext.h 127bd394c8eea481f2ac9b754bf399dbfc818b75
|
||||||
F src/sqliteInt.h 9562411b336b77123d1f569d4144fe3ba1ecb3bf
|
F src/sqliteInt.h 9562411b336b77123d1f569d4144fe3ba1ecb3bf
|
||||||
F src/table.c f64ec4fbfe333f8df925bc6ba494f55e05b0e75e
|
F src/table.c f64ec4fbfe333f8df925bc6ba494f55e05b0e75e
|
||||||
@@ -84,7 +84,7 @@ F src/test4.c 8b784cd82de158a2317cb4ac4bc86f91ad315e25
|
|||||||
F src/test5.c 7162f8526affb771c4ed256826eee7bb9eca265f
|
F src/test5.c 7162f8526affb771c4ed256826eee7bb9eca265f
|
||||||
F src/test6.c 60a02961ceb7b3edc25f5dc5c1ac2556622a76de
|
F src/test6.c 60a02961ceb7b3edc25f5dc5c1ac2556622a76de
|
||||||
F src/test7.c 03fa8d787f6aebc6d1f72504d52f33013ad2c8e3
|
F src/test7.c 03fa8d787f6aebc6d1f72504d52f33013ad2c8e3
|
||||||
F src/test8.c 9bfd5b76f7694d4bc8318bf73d7bc1b607b49886
|
F src/test8.c 2a8676c42f20a34371244259a0bfad7a1dbfc419
|
||||||
F src/test_async.c e3deaedd4d86a56391b81808fde9e44fbd92f1d3
|
F src/test_async.c e3deaedd4d86a56391b81808fde9e44fbd92f1d3
|
||||||
F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
|
F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
|
||||||
F src/test_server.c a6460daed0b92ecbc2531b6dc73717470e7a648c
|
F src/test_server.c a6460daed0b92ecbc2531b6dc73717470e7a648c
|
||||||
@@ -95,14 +95,14 @@ F src/utf.c ab81ac59084ff1c07d421eb1a0a84ec809603b44
|
|||||||
F src/util.c ca6ee72772c0f5dc04d2e0ab1973fd3b6a9bf79d
|
F src/util.c ca6ee72772c0f5dc04d2e0ab1973fd3b6a9bf79d
|
||||||
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
|
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
|
||||||
F src/vdbe.c 59cb0d8cd19f090061f41715c44b3ed2af6bf264
|
F src/vdbe.c 59cb0d8cd19f090061f41715c44b3ed2af6bf264
|
||||||
F src/vdbe.h 190d85a37658c2397be75a4c70bbc02ebc4ec0ba
|
F src/vdbe.h f72e5c00af759b7ed6fd606d508036d732098cc3
|
||||||
F src/vdbeInt.h 6ccb7eaae76ebd761470f6a035501ff33aa92c20
|
F src/vdbeInt.h 6ccb7eaae76ebd761470f6a035501ff33aa92c20
|
||||||
F src/vdbeapi.c 7dc662e7c905ce666bb506dced932e0307115cbf
|
F src/vdbeapi.c 7dc662e7c905ce666bb506dced932e0307115cbf
|
||||||
F src/vdbeaux.c 60f84a2da6032a6fffa47ed623279b7dee25223b
|
F src/vdbeaux.c bcad5264196266118eb4ed0b2db3829fe335a67d
|
||||||
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
||||||
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
|
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
|
||||||
F src/vtab.c 4ec6ac7e5e4fccb38401285d0e329d018622859f
|
F src/vtab.c 4ec6ac7e5e4fccb38401285d0e329d018622859f
|
||||||
F src/where.c d312cf79d42e82cec5bddfa23f42bea6e65b4052
|
F src/where.c c0f3cd3831cd9defb7c7788038d439a5922e7bd6
|
||||||
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
|
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
F test/all.test 5df90d015ca63fcef2a4b62c24f7316b66c4bfd4
|
F test/all.test 5df90d015ca63fcef2a4b62c24f7316b66c4bfd4
|
||||||
@@ -363,7 +363,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||||
P f0c7c8d12c04376e48c6d53a29cfae3fa13b52cf
|
P 010965433140fbe508a907d861dbad79343bf7c2
|
||||||
R 24b1712dc081e34b63297df85eac34f4
|
R 764c40e62a8b536cdb57327045ebbc4d
|
||||||
U drh
|
U drh
|
||||||
Z 61dbf9364ee86b719872c787076d19e0
|
Z b3815508f49a0543b1d64dd34c187512
|
||||||
|
@@ -1 +1 @@
|
|||||||
010965433140fbe508a907d861dbad79343bf7c2
|
3532f1340f939b0231c1d82a7b2d186cb096fb29
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains routines used for analyzing expressions and
|
** This file contains routines used for analyzing expressions and
|
||||||
** for generating VDBE code that evaluates expressions in SQLite.
|
** for generating VDBE code that evaluates expressions in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: expr.c,v 1.259 2006/06/11 23:41:55 drh Exp $
|
** $Id: expr.c,v 1.260 2006/06/13 01:04:52 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -1489,7 +1489,8 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
|
|||||||
}else if( pExpr->iColumn>=0 ){
|
}else if( pExpr->iColumn>=0 ){
|
||||||
Table *pTab = pExpr->pTab;
|
Table *pTab = pExpr->pTab;
|
||||||
int iCol = pExpr->iColumn;
|
int iCol = pExpr->iColumn;
|
||||||
sqlite3VdbeAddOp(v, OP_Column, pExpr->iTable, iCol);
|
sqlite3VdbeAddOp(v, pTab->isVirtual ? OP_VColumn : OP_Column,
|
||||||
|
pExpr->iTable, iCol);
|
||||||
sqlite3ColumnDefault(v, pTab, iCol);
|
sqlite3ColumnDefault(v, pTab, iCol);
|
||||||
#ifndef SQLITE_OMIT_FLOATING_POINT
|
#ifndef SQLITE_OMIT_FLOATING_POINT
|
||||||
if( pTab && pTab->aCol[iCol].affinity==SQLITE_AFF_REAL ){
|
if( pTab && pTab->aCol[iCol].affinity==SQLITE_AFF_REAL ){
|
||||||
@@ -1497,7 +1498,8 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}else{
|
}else{
|
||||||
sqlite3VdbeAddOp(v, OP_Rowid, pExpr->iTable, 0);
|
sqlite3VdbeAddOp(v, pExpr->pTab->isVirtual ? OP_VRowid : OP_Rowid,
|
||||||
|
pExpr->iTable, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This header file defines the interface that the SQLite library
|
** This header file defines the interface that the SQLite library
|
||||||
** presents to client programs.
|
** presents to client programs.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqlite.h.in,v 1.170 2006/06/12 21:59:14 drh Exp $
|
** @(#) $Id: sqlite.h.in,v 1.171 2006/06/13 01:04:53 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITE3_H_
|
#ifndef _SQLITE3_H_
|
||||||
#define _SQLITE3_H_
|
#define _SQLITE3_H_
|
||||||
@@ -1657,7 +1657,7 @@ int sqlite3_create_module(
|
|||||||
** to all module implementations.
|
** to all module implementations.
|
||||||
*/
|
*/
|
||||||
struct sqlite3_vtab {
|
struct sqlite3_vtab {
|
||||||
sqlite3_module *pModule; /* The module for this virtual table */
|
const sqlite3_module *pModule; /* The module for this virtual table */
|
||||||
/* Virtual table implementations will typically add additional fields */
|
/* Virtual table implementations will typically add additional fields */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
52
src/test8.c
52
src/test8.c
@@ -13,7 +13,7 @@
|
|||||||
** is not included in the SQLite library. It is used for automated
|
** is not included in the SQLite library. It is used for automated
|
||||||
** testing of the SQLite library.
|
** testing of the SQLite library.
|
||||||
**
|
**
|
||||||
** $Id: test8.c,v 1.5 2006/06/12 12:50:23 drh Exp $
|
** $Id: test8.c,v 1.6 2006/06/13 01:04:53 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "tcl.h"
|
#include "tcl.h"
|
||||||
@@ -25,14 +25,14 @@
|
|||||||
** Global Tcl variable $echo_module is a list. This routine appends
|
** Global Tcl variable $echo_module is a list. This routine appends
|
||||||
** the string element zArg to that list in interpreter interp.
|
** the string element zArg to that list in interpreter interp.
|
||||||
*/
|
*/
|
||||||
static void appendToEchoModule(const sqlite3_module *pModule, const char *zArg){
|
static void appendToEchoModule(Tcl_Interp *interp, const char *zArg){
|
||||||
int flags = (TCL_APPEND_VALUE | TCL_LIST_ELEMENT | TCL_GLOBAL_ONLY);
|
int flags = (TCL_APPEND_VALUE | TCL_LIST_ELEMENT | TCL_GLOBAL_ONLY);
|
||||||
Tcl_SetVar((Tcl_Interp *)(pModule->pAux), "echo_module", zArg, flags);
|
Tcl_SetVar(interp, "echo_module", zArg, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void appendToEchoTable(const sqlite3_vtab *pTab, const char *zArg){
|
static void appendToEchoTable(Tcl_Interp *interp, const char *zArg){
|
||||||
int flags = (TCL_APPEND_VALUE | TCL_LIST_ELEMENT | TCL_GLOBAL_ONLY);
|
int flags = (TCL_APPEND_VALUE | TCL_LIST_ELEMENT | TCL_GLOBAL_ONLY);
|
||||||
Tcl_SetVar((Tcl_Interp *)(pTab), "echo_module", zArg, flags);
|
Tcl_SetVar(interp, "echo_module", zArg, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -75,6 +75,13 @@ static int echoDeclareVtab(sqlite3 *db, int argc, char **argv){
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* An echo vtab object */
|
||||||
|
typedef struct echo_vtab echo_vtab;
|
||||||
|
struct echo_vtab {
|
||||||
|
sqlite3_vtab base;
|
||||||
|
Tcl_Interp *interp;
|
||||||
|
};
|
||||||
|
|
||||||
/* Methods for the echo module */
|
/* Methods for the echo module */
|
||||||
static int echoCreate(
|
static int echoCreate(
|
||||||
sqlite3 *db,
|
sqlite3 *db,
|
||||||
@@ -83,11 +90,15 @@ static int echoCreate(
|
|||||||
sqlite3_vtab **ppVtab
|
sqlite3_vtab **ppVtab
|
||||||
){
|
){
|
||||||
int i;
|
int i;
|
||||||
*ppVtab = pModule->pAux;
|
echo_vtab *pVtab;
|
||||||
|
|
||||||
appendToEchoModule(pModule, "xCreate");
|
pVtab = sqliteMalloc( sizeof(*pVtab) );
|
||||||
|
*ppVtab = &pVtab->base;
|
||||||
|
pVtab->base.pModule = pModule;
|
||||||
|
pVtab->interp = pModule->pAux;
|
||||||
|
appendToEchoModule(pVtab->interp, "xCreate");
|
||||||
for(i=0; i<argc; i++){
|
for(i=0; i<argc; i++){
|
||||||
appendToEchoModule(pModule, argv[i]);
|
appendToEchoModule(pVtab->interp, argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
echoDeclareVtab(db, argc, argv);
|
echoDeclareVtab(db, argc, argv);
|
||||||
@@ -101,8 +112,12 @@ static int echoConnect(
|
|||||||
){
|
){
|
||||||
int i;
|
int i;
|
||||||
Tcl_Interp *interp = pModule->pAux;
|
Tcl_Interp *interp = pModule->pAux;
|
||||||
*ppVtab = pModule->pAux;
|
echo_vtab *pVtab;
|
||||||
|
|
||||||
|
pVtab = sqliteMalloc( sizeof(*pVtab) );
|
||||||
|
*ppVtab = &pVtab->base;
|
||||||
|
pVtab->base.pModule = pModule;
|
||||||
|
pVtab->interp = pModule->pAux;
|
||||||
Tcl_SetVar(interp, "echo_module", "xConnect", TCL_GLOBAL_ONLY);
|
Tcl_SetVar(interp, "echo_module", "xConnect", TCL_GLOBAL_ONLY);
|
||||||
for(i=0; i<argc; i++){
|
for(i=0; i<argc; i++){
|
||||||
Tcl_SetVar(interp, "echo_module", argv[i],
|
Tcl_SetVar(interp, "echo_module", argv[i],
|
||||||
@@ -113,16 +128,27 @@ static int echoConnect(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int echoDisconnect(sqlite3_vtab *pVtab){
|
static int echoDisconnect(sqlite3_vtab *pVtab){
|
||||||
appendToEchoTable(pVtab, "xDisconnect");
|
echo_vtab *p = (echo_vtab*)pVtab;
|
||||||
|
appendToEchoTable(p->interp, "xDisconnect");
|
||||||
|
sqliteFree(pVtab);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int echoDestroy(sqlite3_vtab *pVtab){
|
static int echoDestroy(sqlite3_vtab *pVtab){
|
||||||
Tcl_Interp *interp = (Tcl_Interp*)pVtab;
|
echo_vtab *p = (echo_vtab*)pVtab;
|
||||||
Tcl_SetVar(interp, "echo_module", "xDestroy",
|
Tcl_SetVar(p->interp, "echo_module", "xDestroy",
|
||||||
TCL_APPEND_VALUE | TCL_LIST_ELEMENT | TCL_GLOBAL_ONLY);
|
TCL_APPEND_VALUE | TCL_LIST_ELEMENT | TCL_GLOBAL_ONLY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** The xBestIndex method for the echo module always returns
|
||||||
|
** an index of 123.
|
||||||
|
*/
|
||||||
|
static int echoBestIndex(sqlite3_vtab *pVtab, sqlite3_index_info *pIdxInfo){
|
||||||
|
pIdxInfo->idxNum = 123;
|
||||||
|
return SQLITE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** A virtual table module that merely echos method calls into TCL
|
** A virtual table module that merely echos method calls into TCL
|
||||||
** variables.
|
** variables.
|
||||||
@@ -133,7 +159,7 @@ static sqlite3_module echoModule = {
|
|||||||
0, /* pAux */
|
0, /* pAux */
|
||||||
echoCreate,
|
echoCreate,
|
||||||
echoConnect,
|
echoConnect,
|
||||||
0, /* xBestIndex */
|
echoBestIndex,
|
||||||
echoDisconnect,
|
echoDisconnect,
|
||||||
echoDestroy,
|
echoDestroy,
|
||||||
};
|
};
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
** or VDBE. The VDBE implements an abstract machine that runs a
|
** or VDBE. The VDBE implements an abstract machine that runs a
|
||||||
** simple program to access and modify the underlying database.
|
** simple program to access and modify the underlying database.
|
||||||
**
|
**
|
||||||
** $Id: vdbe.h,v 1.103 2006/06/11 23:41:56 drh Exp $
|
** $Id: vdbe.h,v 1.104 2006/06/13 01:04:53 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITE_VDBE_H_
|
#ifndef _SQLITE_VDBE_H_
|
||||||
#define _SQLITE_VDBE_H_
|
#define _SQLITE_VDBE_H_
|
||||||
@@ -70,6 +70,7 @@ typedef struct VdbeOpList VdbeOpList;
|
|||||||
#define P3_VDBEFUNC (-7) /* P3 is a pointer to a VdbeFunc structure */
|
#define P3_VDBEFUNC (-7) /* P3 is a pointer to a VdbeFunc structure */
|
||||||
#define P3_MEM (-8) /* P3 is a pointer to a Mem* structure */
|
#define P3_MEM (-8) /* P3 is a pointer to a Mem* structure */
|
||||||
#define P3_TRANSIENT (-9) /* P3 is a pointer to a transient string */
|
#define P3_TRANSIENT (-9) /* P3 is a pointer to a transient string */
|
||||||
|
#define P3_VTAB (-10) /* P3 is a pointer to an sqlite3_vtab structure */
|
||||||
|
|
||||||
/* When adding a P3 argument using P3_KEYINFO, a copy of the KeyInfo structure
|
/* When adding a P3 argument using P3_KEYINFO, a copy of the KeyInfo structure
|
||||||
** is made. That copy is freed when the Vdbe is finalized. But if the
|
** is made. That copy is freed when the Vdbe is finalized. But if the
|
||||||
|
@@ -558,15 +558,18 @@ static char *displayP3(Op *pOp, char *zTemp, int nTemp){
|
|||||||
}
|
}
|
||||||
case P3_FUNCDEF: {
|
case P3_FUNCDEF: {
|
||||||
FuncDef *pDef = (FuncDef*)pOp->p3;
|
FuncDef *pDef = (FuncDef*)pOp->p3;
|
||||||
char zNum[30];
|
sqlite3_snprintf(nTemp, zTemp, "%s(%d)", pDef->zName, pDef->nArg);
|
||||||
sprintf(zTemp, "%.*s", nTemp, pDef->zName);
|
|
||||||
sprintf(zNum,"(%d)", pDef->nArg);
|
|
||||||
if( strlen(zTemp)+strlen(zNum)+1<=nTemp ){
|
|
||||||
strcat(zTemp, zNum);
|
|
||||||
}
|
|
||||||
zP3 = zTemp;
|
zP3 = zTemp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||||
|
case P3_VTAB: {
|
||||||
|
sqlite3_vtab *pVtab = (sqlite3_vtab*)pOp->p3;
|
||||||
|
sqlite3_snprintf(nTemp, zTemp, "%p:%s", pVtab, pVtab->pModule->zName);
|
||||||
|
zP3 = zTemp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
default: {
|
default: {
|
||||||
zP3 = pOp->p3;
|
zP3 = pOp->p3;
|
||||||
if( zP3==0 || pOp->opcode==OP_Noop ){
|
if( zP3==0 || pOp->opcode==OP_Noop ){
|
||||||
|
17
src/where.c
17
src/where.c
@@ -16,7 +16,7 @@
|
|||||||
** so is applicable. Because this module is responsible for selecting
|
** so is applicable. Because this module is responsible for selecting
|
||||||
** indices, you might also think of this module as the "query optimizer".
|
** indices, you might also think of this module as the "query optimizer".
|
||||||
**
|
**
|
||||||
** $Id: where.c,v 1.211 2006/06/12 21:59:14 drh Exp $
|
** $Id: where.c,v 1.212 2006/06/13 01:04:53 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -1010,10 +1010,10 @@ static double bestVirtualIndex(
|
|||||||
pIdxInfo->estimatedCost = SQLITE_BIG_DBL;
|
pIdxInfo->estimatedCost = SQLITE_BIG_DBL;
|
||||||
nOrderBy = pIdxInfo->nOrderBy;
|
nOrderBy = pIdxInfo->nOrderBy;
|
||||||
if( pIdxInfo->nOrderBy && !orderByUsable ){
|
if( pIdxInfo->nOrderBy && !orderByUsable ){
|
||||||
*(int*)pIdxInfo->nOrderBy = 0;
|
*(int*)&pIdxInfo->nOrderBy = 0;
|
||||||
}
|
}
|
||||||
pTab->pVtab->pModule->xBestIndex(pTab->pVtab, pIdxInfo);
|
pTab->pVtab->pModule->xBestIndex(pTab->pVtab, pIdxInfo);
|
||||||
*(int*)pIdxInfo->nOrderBy = nOrderBy;
|
*(int*)&pIdxInfo->nOrderBy = nOrderBy;
|
||||||
return pIdxInfo->estimatedCost;
|
return pIdxInfo->estimatedCost;
|
||||||
}
|
}
|
||||||
#endif /* SQLITE_OMIT_VIRTUALTABLE */
|
#endif /* SQLITE_OMIT_VIRTUALTABLE */
|
||||||
@@ -1770,7 +1770,7 @@ WhereInfo *sqlite3WhereBegin(
|
|||||||
if( pTab->isEphem || pTab->pSelect ) continue;
|
if( pTab->isEphem || pTab->pSelect ) continue;
|
||||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||||
if( pLevel->pIdxInfo ){
|
if( pLevel->pIdxInfo ){
|
||||||
sqlite3VdbeAddOp(v, OP_VOpen, 0, 0); /***** Fix Me *****/
|
sqlite3VdbeOp3(v, OP_VOpen, 0, 0, (const char*)pTab->pVtab, P3_VTAB);
|
||||||
}else
|
}else
|
||||||
#endif
|
#endif
|
||||||
if( (pLevel->flags & WHERE_IDX_ONLY)==0 ){
|
if( (pLevel->flags & WHERE_IDX_ONLY)==0 ){
|
||||||
@@ -1855,16 +1855,17 @@ WhereInfo *sqlite3WhereBegin(
|
|||||||
}
|
}
|
||||||
if( j==pIdxInfo->nConstraint ) break;
|
if( j==pIdxInfo->nConstraint ) break;
|
||||||
}
|
}
|
||||||
sqlite3VdbeAddOp(v, OP_VFilter, iCur, pIdxInfo->idxNum);
|
sqlite3VdbeAddOp(v, OP_Integer, i-1, 0);
|
||||||
if( i>1 ){
|
sqlite3VdbeAddOp(v, OP_Integer, pIdxInfo->idxNum, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_Pop, i-1, 0);
|
sqlite3VdbeAddOp(v, OP_VFilter, iCur, brk);
|
||||||
}
|
|
||||||
for(i=0; i<pIdxInfo->nConstraint; i++){
|
for(i=0; i<pIdxInfo->nConstraint; i++){
|
||||||
if( pIdxInfo->aConstraintUsage[i].omit ){
|
if( pIdxInfo->aConstraintUsage[i].omit ){
|
||||||
disableTerm(pLevel, &wc.a[i]);
|
disableTerm(pLevel, &wc.a[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pLevel->op = OP_VNext;
|
pLevel->op = OP_VNext;
|
||||||
|
pLevel->p1 = iCur;
|
||||||
|
pLevel->p2 = sqlite3VdbeCurrentAddr(v);
|
||||||
}else
|
}else
|
||||||
#endif /* SQLITE_OMIT_VIRTUALTABLE */
|
#endif /* SQLITE_OMIT_VIRTUALTABLE */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user