mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Remove the SQLITE_ENABLE_TREE_EXPLAIN compile-time option. Add alternative
debugging display routines: sqlite3TreeViewExpr(), sqlite3TreeViewExprList(), and sqlite3TreeViewSelect(). FossilOrigin-Name: 4ff51325d6b41d0c59e303b573700ec80c51d216
This commit is contained in:
34
manifest
34
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sthe\sheader\scomment\sin\ssqlite3VdbeDeletePriorOpcode().\s\sNo\schanges\sto\ncode.
|
C Remove\sthe\sSQLITE_ENABLE_TREE_EXPLAIN\scompile-time\soption.\s\sAdd\salternative\ndebugging\sdisplay\sroutines:\ssqlite3TreeViewExpr(),\ssqlite3TreeViewExprList(),\nand\ssqlite3TreeViewSelect().
|
||||||
D 2014-09-29T15:42:01.115
|
D 2014-09-30T12:33:33.546
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
|
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -181,7 +181,7 @@ F src/complete.c 535183afb3c75628b78ce82612931ac7cdf26f14
|
|||||||
F src/ctime.c bb434068b5308a857b181c2d204a320ff0d6c638
|
F src/ctime.c bb434068b5308a857b181c2d204a320ff0d6c638
|
||||||
F src/date.c 57a7f9ba9f6b4d5268f5e411739066a611f99036
|
F src/date.c 57a7f9ba9f6b4d5268f5e411739066a611f99036
|
||||||
F src/delete.c fae81cc2eb14b75267d4f47d3cfc9ae02aae726f
|
F src/delete.c fae81cc2eb14b75267d4f47d3cfc9ae02aae726f
|
||||||
F src/expr.c f32119248996680aa73c5c37bfdd42820804dc17
|
F src/expr.c 46a8ca93361d09f2ec6d9b7d524751510569d737
|
||||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||||
F src/fkey.c da985ae673efef2c712caef825a5d2edb087ead7
|
F src/fkey.c da985ae673efef2c712caef825a5d2edb087ead7
|
||||||
F src/func.c ba47c1671ab3cfdafa6e9d6ee490939ea578adee
|
F src/func.c ba47c1671ab3cfdafa6e9d6ee490939ea578adee
|
||||||
@@ -194,7 +194,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
|
|||||||
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
|
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
|
||||||
F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
|
F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
|
||||||
F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994
|
F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994
|
||||||
F src/main.c d15621461fb0c52675eba2b650492ed1beef69ab
|
F src/main.c 4a507a467cc20979579e4320ca6466b8ed0be268
|
||||||
F src/malloc.c 5bb99ee1e08ad58e457063cf79ce521db0e24195
|
F src/malloc.c 5bb99ee1e08ad58e457063cf79ce521db0e24195
|
||||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||||
F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f
|
F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f
|
||||||
@@ -217,22 +217,22 @@ F src/os_win.c 0a4042ef35f322e86fa01f6c8884c5e645b911e7
|
|||||||
F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21
|
F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21
|
||||||
F src/pager.c caab007743821d96752597c9cfd7351654697b06
|
F src/pager.c caab007743821d96752597c9cfd7351654697b06
|
||||||
F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428
|
F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428
|
||||||
F src/parse.y b98772da2bb5415970085b707203f92569400aa8
|
F src/parse.y ce1494308578d2f10a68cd8debc9fc156dda1094
|
||||||
F src/pcache.c 4121a0571c18581ee9f82f086d5e2030051ebd6a
|
F src/pcache.c 4121a0571c18581ee9f82f086d5e2030051ebd6a
|
||||||
F src/pcache.h 9b559127b83f84ff76d735c8262f04853be0c59a
|
F src/pcache.h 9b559127b83f84ff76d735c8262f04853be0c59a
|
||||||
F src/pcache1.c dab8ab930d4a73b99768d881185994f34b80ecaa
|
F src/pcache1.c dab8ab930d4a73b99768d881185994f34b80ecaa
|
||||||
F src/pragma.c 3f3e959390a10c0131676f0e307acce372777e0f
|
F src/pragma.c 3f3e959390a10c0131676f0e307acce372777e0f
|
||||||
F src/prepare.c 6ef0cf2f9274982988ed6b7cab1be23147e94196
|
F src/prepare.c 6ef0cf2f9274982988ed6b7cab1be23147e94196
|
||||||
F src/printf.c 3a47f526b173813d9a7f4e7044007771ba68cde1
|
F src/printf.c 0db94d24f97b4e562e9da9d2ce85e8a69531daf6
|
||||||
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
|
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
|
||||||
F src/resolve.c a3466128b52a86c466e47ac1a19e2174f7b5cf89
|
F src/resolve.c a3466128b52a86c466e47ac1a19e2174f7b5cf89
|
||||||
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
||||||
F src/select.c a83ed8bc2a31c131e3addb6f0488b68334085e7b
|
F src/select.c 373da54c2bd7e38993bc926a284bc05a53b01b8b
|
||||||
F src/shell.c dad23987c34faddb061a339da3e92e05ccc6935e
|
F src/shell.c 38f627b0885191357f55902a3ac199de90d79715
|
||||||
F src/sqlite.h.in 8b018219ce988913e5977d5de9ab4beb33be23b6
|
F src/sqlite.h.in 159f2cb9eef74b6c99aeeb4c071e7745835f04f6
|
||||||
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
||||||
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
|
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
|
||||||
F src/sqliteInt.h 5e09fe04f999223680801ddf8fbae6b60751d613
|
F src/sqliteInt.h 8242d04760ec2a943a152eba2a006ea121a3eafd
|
||||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||||
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
|
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
|
||||||
F src/table.c 2e99ef7ef16187e17033d9398dc962ce22dab5cb
|
F src/table.c 2e99ef7ef16187e17033d9398dc962ce22dab5cb
|
||||||
@@ -291,18 +291,18 @@ F src/util.c 4006c01772bd8d8ac4306d523bbcee41d3e392d8
|
|||||||
F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a
|
F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a
|
||||||
F src/vdbe.c 93eeb6f9c3a3084133225a196f220454d71cca10
|
F src/vdbe.c 93eeb6f9c3a3084133225a196f220454d71cca10
|
||||||
F src/vdbe.h 09f5b4e3719fa454f252322b1cdab5cf1f361327
|
F src/vdbe.h 09f5b4e3719fa454f252322b1cdab5cf1f361327
|
||||||
F src/vdbeInt.h bb7f7ecfdead1a2ae0251b59f86f5724838d975c
|
F src/vdbeInt.h 0b97a3190f8fbf460655985a9183019f5a702754
|
||||||
F src/vdbeapi.c e9e33b59834e3edc8790209765e069874c269d9d
|
F src/vdbeapi.c e9e33b59834e3edc8790209765e069874c269d9d
|
||||||
F src/vdbeaux.c 8e016c6051c013a394f8e8679be1ca60723707bd
|
F src/vdbeaux.c 5b687d7b5beaaa5b97189edf25cf08c311834933
|
||||||
F src/vdbeblob.c 848238dc73e93e48432991bb5651bf87d865eca4
|
F src/vdbeblob.c 848238dc73e93e48432991bb5651bf87d865eca4
|
||||||
F src/vdbemem.c 1e105dacf5190fc85a8ec2107c0dcc1884e75099
|
F src/vdbemem.c 1e105dacf5190fc85a8ec2107c0dcc1884e75099
|
||||||
F src/vdbesort.c 5c1bacf90578d22b630fbf6ed98ccf60d83435ef
|
F src/vdbesort.c 5c1bacf90578d22b630fbf6ed98ccf60d83435ef
|
||||||
F src/vdbetrace.c 4f29b04edb0cec3d5fcd9b566d9f0e75c8984362
|
F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010
|
||||||
F src/vtab.c 019dbfd0406a7447c990e1f7bd1dfcdb8895697f
|
F src/vtab.c 019dbfd0406a7447c990e1f7bd1dfcdb8895697f
|
||||||
F src/wal.c 10e7de7ce90865a68153f001a61f1d985cd17983
|
F src/wal.c 10e7de7ce90865a68153f001a61f1d985cd17983
|
||||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||||
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
|
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
|
||||||
F src/where.c a14d3d8042adeb51f81731c1b47b3e481d1cc23a
|
F src/where.c 5a2c700f6f29da91ac633015d1378b91dcf237b6
|
||||||
F src/whereInt.h 124d970450955a6982e174b07c320ae6d62a595c
|
F src/whereInt.h 124d970450955a6982e174b07c320ae6d62a595c
|
||||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
@@ -1200,7 +1200,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P 414f0d6a647a4d040b5463c73c5e15e699d85b4c
|
P 7fb1626866c2f8dad84c7e6184824be3efd71ca2
|
||||||
R f6298f1a1c0cd9e9dc9c3dc07f24407e
|
R f57511c6ad57aee6db1d51feabde515b
|
||||||
U drh
|
U drh
|
||||||
Z 0f82639c06e932d5523a9215bf58cd9c
|
Z d2ed6dec33496c4977b9e22861714f01
|
||||||
|
@@ -1 +1 @@
|
|||||||
7fb1626866c2f8dad84c7e6184824be3efd71ca2
|
4ff51325d6b41d0c59e303b573700ec80c51d216
|
167
src/expr.c
167
src/expr.c
@@ -3236,90 +3236,86 @@ void sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){
|
|||||||
exprToRegister(pExpr, iMem);
|
exprToRegister(pExpr, iMem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
#ifdef SQLITE_DEBUG
|
||||||
/*
|
/*
|
||||||
** Generate a human-readable explanation of an expression tree.
|
** Generate a human-readable explanation of an expression tree.
|
||||||
*/
|
*/
|
||||||
void sqlite3ExplainExpr(Vdbe *pOut, Expr *pExpr){
|
void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
|
||||||
int op; /* The opcode being coded */
|
|
||||||
const char *zBinOp = 0; /* Binary operator */
|
const char *zBinOp = 0; /* Binary operator */
|
||||||
const char *zUniOp = 0; /* Unary operator */
|
const char *zUniOp = 0; /* Unary operator */
|
||||||
|
pView = sqlite3TreeViewPush(pView, moreToFollow);
|
||||||
if( pExpr==0 ){
|
if( pExpr==0 ){
|
||||||
op = TK_NULL;
|
sqlite3TreeViewLine(pView, "nil");
|
||||||
}else{
|
sqlite3TreeViewPop(pView);
|
||||||
op = pExpr->op;
|
return;
|
||||||
}
|
}
|
||||||
switch( op ){
|
switch( pExpr->op ){
|
||||||
case TK_AGG_COLUMN: {
|
case TK_AGG_COLUMN: {
|
||||||
sqlite3ExplainPrintf(pOut, "AGG{%d:%d}",
|
sqlite3TreeViewLine(pView, "AGG{%d:%d}",
|
||||||
pExpr->iTable, pExpr->iColumn);
|
pExpr->iTable, pExpr->iColumn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_COLUMN: {
|
case TK_COLUMN: {
|
||||||
if( pExpr->iTable<0 ){
|
if( pExpr->iTable<0 ){
|
||||||
/* This only happens when coding check constraints */
|
/* This only happens when coding check constraints */
|
||||||
sqlite3ExplainPrintf(pOut, "COLUMN(%d)", pExpr->iColumn);
|
sqlite3TreeViewLine(pView, "COLUMN(%d)", pExpr->iColumn);
|
||||||
}else{
|
}else{
|
||||||
sqlite3ExplainPrintf(pOut, "{%d:%d}",
|
sqlite3TreeViewLine(pView, "{%d:%d}",
|
||||||
pExpr->iTable, pExpr->iColumn);
|
pExpr->iTable, pExpr->iColumn);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_INTEGER: {
|
case TK_INTEGER: {
|
||||||
if( pExpr->flags & EP_IntValue ){
|
if( pExpr->flags & EP_IntValue ){
|
||||||
sqlite3ExplainPrintf(pOut, "%d", pExpr->u.iValue);
|
sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue);
|
||||||
}else{
|
}else{
|
||||||
sqlite3ExplainPrintf(pOut, "%s", pExpr->u.zToken);
|
sqlite3TreeViewLine(pView, "%s", pExpr->u.zToken);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef SQLITE_OMIT_FLOATING_POINT
|
#ifndef SQLITE_OMIT_FLOATING_POINT
|
||||||
case TK_FLOAT: {
|
case TK_FLOAT: {
|
||||||
sqlite3ExplainPrintf(pOut,"%s", pExpr->u.zToken);
|
sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case TK_STRING: {
|
case TK_STRING: {
|
||||||
sqlite3ExplainPrintf(pOut,"%Q", pExpr->u.zToken);
|
sqlite3TreeViewLine(pView,"%Q", pExpr->u.zToken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_NULL: {
|
case TK_NULL: {
|
||||||
sqlite3ExplainPrintf(pOut,"NULL");
|
sqlite3TreeViewLine(pView,"NULL");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef SQLITE_OMIT_BLOB_LITERAL
|
#ifndef SQLITE_OMIT_BLOB_LITERAL
|
||||||
case TK_BLOB: {
|
case TK_BLOB: {
|
||||||
sqlite3ExplainPrintf(pOut,"%s", pExpr->u.zToken);
|
sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case TK_VARIABLE: {
|
case TK_VARIABLE: {
|
||||||
sqlite3ExplainPrintf(pOut,"VARIABLE(%s,%d)",
|
sqlite3TreeViewLine(pView,"VARIABLE(%s,%d)",
|
||||||
pExpr->u.zToken, pExpr->iColumn);
|
pExpr->u.zToken, pExpr->iColumn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_REGISTER: {
|
case TK_REGISTER: {
|
||||||
sqlite3ExplainPrintf(pOut,"REGISTER(%d)", pExpr->iTable);
|
sqlite3TreeViewLine(pView,"REGISTER(%d)", pExpr->iTable);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_AS: {
|
case TK_AS: {
|
||||||
sqlite3ExplainExpr(pOut, pExpr->pLeft);
|
sqlite3TreeViewLine(pView,"AS %Q", pExpr->u.zToken);
|
||||||
|
sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TK_ID: {
|
||||||
|
sqlite3TreeViewLine(pView,"ID %Q", pExpr->u.zToken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef SQLITE_OMIT_CAST
|
#ifndef SQLITE_OMIT_CAST
|
||||||
case TK_CAST: {
|
case TK_CAST: {
|
||||||
/* Expressions of the form: CAST(pLeft AS token) */
|
/* Expressions of the form: CAST(pLeft AS token) */
|
||||||
const char *zAff = "unk";
|
sqlite3TreeViewLine(pView,"CAST %Q", pExpr->u.zToken);
|
||||||
switch( sqlite3AffinityType(pExpr->u.zToken, 0) ){
|
sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
|
||||||
case SQLITE_AFF_TEXT: zAff = "TEXT"; break;
|
|
||||||
case SQLITE_AFF_NONE: zAff = "NONE"; break;
|
|
||||||
case SQLITE_AFF_NUMERIC: zAff = "NUMERIC"; break;
|
|
||||||
case SQLITE_AFF_INTEGER: zAff = "INTEGER"; break;
|
|
||||||
case SQLITE_AFF_REAL: zAff = "REAL"; break;
|
|
||||||
}
|
|
||||||
sqlite3ExplainPrintf(pOut, "CAST-%s(", zAff);
|
|
||||||
sqlite3ExplainExpr(pOut, pExpr->pLeft);
|
|
||||||
sqlite3ExplainPrintf(pOut, ")");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* SQLITE_OMIT_CAST */
|
#endif /* SQLITE_OMIT_CAST */
|
||||||
@@ -3352,8 +3348,8 @@ void sqlite3ExplainExpr(Vdbe *pOut, Expr *pExpr){
|
|||||||
case TK_NOTNULL: zUniOp = "NOTNULL"; break;
|
case TK_NOTNULL: zUniOp = "NOTNULL"; break;
|
||||||
|
|
||||||
case TK_COLLATE: {
|
case TK_COLLATE: {
|
||||||
sqlite3ExplainExpr(pOut, pExpr->pLeft);
|
sqlite3TreeViewLine(pView, "COLLATE %Q", pExpr->u.zToken);
|
||||||
sqlite3ExplainPrintf(pOut,".COLLATE(%s)",pExpr->u.zToken);
|
sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3365,41 +3361,36 @@ void sqlite3ExplainExpr(Vdbe *pOut, Expr *pExpr){
|
|||||||
}else{
|
}else{
|
||||||
pFarg = pExpr->x.pList;
|
pFarg = pExpr->x.pList;
|
||||||
}
|
}
|
||||||
if( op==TK_AGG_FUNCTION ){
|
if( pExpr->op==TK_AGG_FUNCTION ){
|
||||||
sqlite3ExplainPrintf(pOut, "AGG_FUNCTION%d:%s(",
|
sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q",
|
||||||
pExpr->op2, pExpr->u.zToken);
|
pExpr->op2, pExpr->u.zToken);
|
||||||
}else{
|
}else{
|
||||||
sqlite3ExplainPrintf(pOut, "FUNCTION:%s(", pExpr->u.zToken);
|
sqlite3TreeViewLine(pView, "FUNCTION %Q", pExpr->u.zToken);
|
||||||
}
|
}
|
||||||
if( pFarg ){
|
if( pFarg ){
|
||||||
sqlite3ExplainExprList(pOut, pFarg);
|
sqlite3TreeViewExprList(pView, pFarg, 0, 0);
|
||||||
}
|
}
|
||||||
sqlite3ExplainPrintf(pOut, ")");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef SQLITE_OMIT_SUBQUERY
|
#ifndef SQLITE_OMIT_SUBQUERY
|
||||||
case TK_EXISTS: {
|
case TK_EXISTS: {
|
||||||
sqlite3ExplainPrintf(pOut, "EXISTS(");
|
sqlite3TreeViewLine(pView, "EXISTS-expr");
|
||||||
sqlite3ExplainSelect(pOut, pExpr->x.pSelect);
|
sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
|
||||||
sqlite3ExplainPrintf(pOut,")");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_SELECT: {
|
case TK_SELECT: {
|
||||||
sqlite3ExplainPrintf(pOut, "(");
|
sqlite3TreeViewLine(pView, "SELECT-expr");
|
||||||
sqlite3ExplainSelect(pOut, pExpr->x.pSelect);
|
sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
|
||||||
sqlite3ExplainPrintf(pOut, ")");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_IN: {
|
case TK_IN: {
|
||||||
sqlite3ExplainPrintf(pOut, "IN(");
|
sqlite3TreeViewLine(pView, "IN");
|
||||||
sqlite3ExplainExpr(pOut, pExpr->pLeft);
|
sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
|
||||||
sqlite3ExplainPrintf(pOut, ",");
|
|
||||||
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
|
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
|
||||||
sqlite3ExplainSelect(pOut, pExpr->x.pSelect);
|
sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
|
||||||
}else{
|
}else{
|
||||||
sqlite3ExplainExprList(pOut, pExpr->x.pList);
|
sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
|
||||||
}
|
}
|
||||||
sqlite3ExplainPrintf(pOut, ")");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* SQLITE_OMIT_SUBQUERY */
|
#endif /* SQLITE_OMIT_SUBQUERY */
|
||||||
@@ -3419,13 +3410,10 @@ void sqlite3ExplainExpr(Vdbe *pOut, Expr *pExpr){
|
|||||||
Expr *pX = pExpr->pLeft;
|
Expr *pX = pExpr->pLeft;
|
||||||
Expr *pY = pExpr->x.pList->a[0].pExpr;
|
Expr *pY = pExpr->x.pList->a[0].pExpr;
|
||||||
Expr *pZ = pExpr->x.pList->a[1].pExpr;
|
Expr *pZ = pExpr->x.pList->a[1].pExpr;
|
||||||
sqlite3ExplainPrintf(pOut, "BETWEEN(");
|
sqlite3TreeViewLine(pView, "BETWEEN");
|
||||||
sqlite3ExplainExpr(pOut, pX);
|
sqlite3TreeViewExpr(pView, pX, 1);
|
||||||
sqlite3ExplainPrintf(pOut, ",");
|
sqlite3TreeViewExpr(pView, pY, 1);
|
||||||
sqlite3ExplainExpr(pOut, pY);
|
sqlite3TreeViewExpr(pView, pZ, 0);
|
||||||
sqlite3ExplainPrintf(pOut, ",");
|
|
||||||
sqlite3ExplainExpr(pOut, pZ);
|
|
||||||
sqlite3ExplainPrintf(pOut, ")");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_TRIGGER: {
|
case TK_TRIGGER: {
|
||||||
@@ -3436,15 +3424,14 @@ void sqlite3ExplainExpr(Vdbe *pOut, Expr *pExpr){
|
|||||||
** is set to the column of the pseudo-table to read, or to -1 to
|
** is set to the column of the pseudo-table to read, or to -1 to
|
||||||
** read the rowid field.
|
** read the rowid field.
|
||||||
*/
|
*/
|
||||||
sqlite3ExplainPrintf(pOut, "%s(%d)",
|
sqlite3TreeViewLine(pView, "%s(%d)",
|
||||||
pExpr->iTable ? "NEW" : "OLD", pExpr->iColumn);
|
pExpr->iTable ? "NEW" : "OLD", pExpr->iColumn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_CASE: {
|
case TK_CASE: {
|
||||||
sqlite3ExplainPrintf(pOut, "CASE(");
|
sqlite3TreeViewLine(pView, "CASE");
|
||||||
sqlite3ExplainExpr(pOut, pExpr->pLeft);
|
sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
|
||||||
sqlite3ExplainPrintf(pOut, ",");
|
sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
|
||||||
sqlite3ExplainExprList(pOut, pExpr->x.pList);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef SQLITE_OMIT_TRIGGER
|
#ifndef SQLITE_OMIT_TRIGGER
|
||||||
@@ -3456,55 +3443,57 @@ void sqlite3ExplainExpr(Vdbe *pOut, Expr *pExpr){
|
|||||||
case OE_Fail: zType = "fail"; break;
|
case OE_Fail: zType = "fail"; break;
|
||||||
case OE_Ignore: zType = "ignore"; break;
|
case OE_Ignore: zType = "ignore"; break;
|
||||||
}
|
}
|
||||||
sqlite3ExplainPrintf(pOut, "RAISE-%s(%s)", zType, pExpr->u.zToken);
|
sqlite3TreeViewLine(pView, "RAISE %s(%Q)", zType, pExpr->u.zToken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
default: {
|
||||||
|
sqlite3TreeViewLine(pView, "op=%d", pExpr->op);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( zBinOp ){
|
if( zBinOp ){
|
||||||
sqlite3ExplainPrintf(pOut,"%s(", zBinOp);
|
sqlite3TreeViewLine(pView, "%s", zBinOp);
|
||||||
sqlite3ExplainExpr(pOut, pExpr->pLeft);
|
sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
|
||||||
sqlite3ExplainPrintf(pOut,",");
|
sqlite3TreeViewExpr(pView, pExpr->pRight, 0);
|
||||||
sqlite3ExplainExpr(pOut, pExpr->pRight);
|
|
||||||
sqlite3ExplainPrintf(pOut,")");
|
|
||||||
}else if( zUniOp ){
|
}else if( zUniOp ){
|
||||||
sqlite3ExplainPrintf(pOut,"%s(", zUniOp);
|
sqlite3TreeViewLine(pView, "%s", zUniOp);
|
||||||
sqlite3ExplainExpr(pOut, pExpr->pLeft);
|
sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
|
||||||
sqlite3ExplainPrintf(pOut,")");
|
|
||||||
}
|
}
|
||||||
|
sqlite3TreeViewPop(pView);
|
||||||
}
|
}
|
||||||
#endif /* defined(SQLITE_ENABLE_TREE_EXPLAIN) */
|
#endif /* SQLITE_DEBUG */
|
||||||
|
|
||||||
#if defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
#ifdef SQLITE_DEBUG
|
||||||
/*
|
/*
|
||||||
** Generate a human-readable explanation of an expression list.
|
** Generate a human-readable explanation of an expression list.
|
||||||
*/
|
*/
|
||||||
void sqlite3ExplainExprList(Vdbe *pOut, ExprList *pList){
|
void sqlite3TreeViewExprList(
|
||||||
|
TreeView *pView,
|
||||||
|
const ExprList *pList,
|
||||||
|
u8 moreToFollow,
|
||||||
|
const char *zLabel
|
||||||
|
){
|
||||||
int i;
|
int i;
|
||||||
if( pList==0 || pList->nExpr==0 ){
|
pView = sqlite3TreeViewPush(pView, moreToFollow);
|
||||||
sqlite3ExplainPrintf(pOut, "(empty-list)");
|
if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST";
|
||||||
return;
|
if( pList==0 ){
|
||||||
}else if( pList->nExpr==1 ){
|
sqlite3TreeViewLine(pView, "%s (empty)", zLabel);
|
||||||
sqlite3ExplainExpr(pOut, pList->a[0].pExpr);
|
|
||||||
}else{
|
}else{
|
||||||
sqlite3ExplainPush(pOut);
|
sqlite3TreeViewLine(pView, "%s", zLabel);
|
||||||
for(i=0; i<pList->nExpr; i++){
|
for(i=0; i<pList->nExpr; i++){
|
||||||
sqlite3ExplainPrintf(pOut, "item[%d] = ", i);
|
sqlite3TreeViewExpr(pView, pList->a[i].pExpr, i<pList->nExpr-1);
|
||||||
sqlite3ExplainPush(pOut);
|
#if 0
|
||||||
sqlite3ExplainExpr(pOut, pList->a[i].pExpr);
|
if( pList->a[i].zName ){
|
||||||
sqlite3ExplainPop(pOut);
|
|
||||||
if( pList->a[i].zName ){
|
|
||||||
sqlite3ExplainPrintf(pOut, " AS %s", pList->a[i].zName);
|
sqlite3ExplainPrintf(pOut, " AS %s", pList->a[i].zName);
|
||||||
}
|
}
|
||||||
if( pList->a[i].bSpanIsTab ){
|
if( pList->a[i].bSpanIsTab ){
|
||||||
sqlite3ExplainPrintf(pOut, " (%s)", pList->a[i].zSpan);
|
sqlite3ExplainPrintf(pOut, " (%s)", pList->a[i].zSpan);
|
||||||
}
|
}
|
||||||
if( i<pList->nExpr-1 ){
|
#endif
|
||||||
sqlite3ExplainNL(pOut);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sqlite3ExplainPop(pOut);
|
|
||||||
}
|
}
|
||||||
|
sqlite3TreeViewPop(pView);
|
||||||
}
|
}
|
||||||
#endif /* SQLITE_DEBUG */
|
#endif /* SQLITE_DEBUG */
|
||||||
|
|
||||||
|
16
src/main.c
16
src/main.c
@@ -3327,22 +3327,6 @@ int sqlite3_test_control(int op, ...){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
|
||||||
/* sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT,
|
|
||||||
** sqlite3_stmt*,const char**);
|
|
||||||
**
|
|
||||||
** If compiled with SQLITE_ENABLE_TREE_EXPLAIN, each sqlite3_stmt holds
|
|
||||||
** a string that describes the optimized parse tree. This test-control
|
|
||||||
** returns a pointer to that string.
|
|
||||||
*/
|
|
||||||
case SQLITE_TESTCTRL_EXPLAIN_STMT: {
|
|
||||||
sqlite3_stmt *pStmt = va_arg(ap, sqlite3_stmt*);
|
|
||||||
const char **pzRet = va_arg(ap, const char**);
|
|
||||||
*pzRet = sqlite3VdbeExplanation((Vdbe*)pStmt);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int);
|
/* sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int);
|
||||||
**
|
**
|
||||||
** Set or clear a flag that indicates that the database file is always well-
|
** Set or clear a flag that indicates that the database file is always well-
|
||||||
|
@@ -399,9 +399,6 @@ cmd ::= DROP VIEW ifexists(E) fullname(X). {
|
|||||||
cmd ::= select(X). {
|
cmd ::= select(X). {
|
||||||
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
|
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
|
||||||
sqlite3Select(pParse, X, &dest);
|
sqlite3Select(pParse, X, &dest);
|
||||||
sqlite3ExplainBegin(pParse->pVdbe);
|
|
||||||
sqlite3ExplainSelect(pParse->pVdbe, X);
|
|
||||||
sqlite3ExplainFinish(pParse->pVdbe);
|
|
||||||
sqlite3SelectDelete(pParse->db, X);
|
sqlite3SelectDelete(pParse->db, X);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
64
src/printf.c
64
src/printf.c
@@ -1056,6 +1056,70 @@ void sqlite3DebugPrintf(const char *zFormat, ...){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SQLITE_DEBUG
|
||||||
|
/*************************************************************************
|
||||||
|
** Routines for implementing the "TreeView" display of hierarchical
|
||||||
|
** data structures for debugging.
|
||||||
|
**
|
||||||
|
** The main entry points (coded elsewhere) are:
|
||||||
|
** sqlite3TreeViewExpr(0, pExpr, 0);
|
||||||
|
** sqlite3TreeViewExprList(0, pList, 0, 0);
|
||||||
|
** sqlite3TreeViewSelect(0, pSelect, 0);
|
||||||
|
** Insert calls to those routines while debugging in order to display
|
||||||
|
** a diagram of Expr, ExprList, and Select objects.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
/* Add a new subitem to the tree. The moreToFollow flag indicates that this
|
||||||
|
** is not the last item in the tree. */
|
||||||
|
TreeView *sqlite3TreeViewPush(TreeView *p, u8 moreToFollow){
|
||||||
|
if( p==0 ){
|
||||||
|
p = sqlite3_malloc( sizeof(*p) );
|
||||||
|
if( p==0 ) return 0;
|
||||||
|
memset(p, 0, sizeof(*p));
|
||||||
|
}else{
|
||||||
|
p->iLevel++;
|
||||||
|
}
|
||||||
|
assert( moreToFollow==0 || moreToFollow==1 );
|
||||||
|
p->mLine &= ~(1<<p->iLevel);
|
||||||
|
p->mLine |= moreToFollow << p->iLevel;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
/* Finished with one layer of the tree */
|
||||||
|
void sqlite3TreeViewPop(TreeView *p){
|
||||||
|
if( p==0 ) return;
|
||||||
|
p->iLevel--;
|
||||||
|
if( p->iLevel<0 ) sqlite3_free(p);
|
||||||
|
}
|
||||||
|
/* Generate a single line of output for the tree, with a prefix that contains
|
||||||
|
** all the appropriate tree lines */
|
||||||
|
void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){
|
||||||
|
va_list ap;
|
||||||
|
int i;
|
||||||
|
StrAccum acc;
|
||||||
|
char zBuf[500];
|
||||||
|
sqlite3StrAccumInit(&acc, zBuf, sizeof(zBuf), 0);
|
||||||
|
acc.useMalloc = 0;
|
||||||
|
if( p ){
|
||||||
|
for(i=0; i<p->iLevel; i++){
|
||||||
|
sqlite3StrAccumAppend(&acc, (p->mLine & (1<<i))!=0 ? "| " : " ", 4);
|
||||||
|
}
|
||||||
|
sqlite3StrAccumAppend(&acc, (p->mLine & (1<<i))!=0 ? "|-- " : "'-- ", 4);
|
||||||
|
}
|
||||||
|
va_start(ap, zFormat);
|
||||||
|
sqlite3VXPrintf(&acc, 0, zFormat, ap);
|
||||||
|
va_end(ap);
|
||||||
|
if( zBuf[acc.nChar-1]!='\n' ) sqlite3StrAccumAppend(&acc, "\n", 1);
|
||||||
|
sqlite3StrAccumFinish(&acc);
|
||||||
|
fprintf(stdout,"%s", zBuf);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
/* Shorthand for starting a new tree item that consists of a single label */
|
||||||
|
void sqlite3TreeViewItem(TreeView *p, const char *zLabel, u8 moreToFollow){
|
||||||
|
p = sqlite3TreeViewPush(p, moreToFollow);
|
||||||
|
sqlite3TreeViewLine(p, "%s", zLabel);
|
||||||
|
}
|
||||||
|
#endif /* SQLITE_DEBUG */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** variable-argument wrapper around sqlite3VXPrintf().
|
** variable-argument wrapper around sqlite3VXPrintf().
|
||||||
*/
|
*/
|
||||||
|
124
src/select.c
124
src/select.c
@@ -5417,97 +5417,89 @@ select_end:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
#ifdef SQLITE_DEBUG
|
||||||
/*
|
/*
|
||||||
** Generate a human-readable description of a the Select object.
|
** Generate a human-readable description of a the Select object.
|
||||||
*/
|
*/
|
||||||
static void explainOneSelect(Vdbe *pVdbe, Select *p){
|
void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
|
||||||
sqlite3ExplainPrintf(pVdbe, "SELECT ");
|
pView = sqlite3TreeViewPush(pView, moreToFollow);
|
||||||
if( p->selFlags & (SF_Distinct|SF_Aggregate) ){
|
sqlite3TreeViewLine(pView, "SELECT%s%s",
|
||||||
if( p->selFlags & SF_Distinct ){
|
((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
|
||||||
sqlite3ExplainPrintf(pVdbe, "DISTINCT ");
|
((p->selFlags & SF_Aggregate) ? " agg_flag" : "")
|
||||||
}
|
);
|
||||||
if( p->selFlags & SF_Aggregate ){
|
sqlite3TreeViewExprList(pView, p->pEList, 1, "result-set");
|
||||||
sqlite3ExplainPrintf(pVdbe, "agg_flag ");
|
|
||||||
}
|
|
||||||
sqlite3ExplainNL(pVdbe);
|
|
||||||
sqlite3ExplainPrintf(pVdbe, " ");
|
|
||||||
}
|
|
||||||
sqlite3ExplainExprList(pVdbe, p->pEList);
|
|
||||||
sqlite3ExplainNL(pVdbe);
|
|
||||||
if( p->pSrc && p->pSrc->nSrc ){
|
if( p->pSrc && p->pSrc->nSrc ){
|
||||||
int i;
|
int i;
|
||||||
sqlite3ExplainPrintf(pVdbe, "FROM ");
|
pView = sqlite3TreeViewPush(pView, 1);
|
||||||
sqlite3ExplainPush(pVdbe);
|
sqlite3TreeViewLine(pView, "FROM");
|
||||||
for(i=0; i<p->pSrc->nSrc; i++){
|
for(i=0; i<p->pSrc->nSrc; i++){
|
||||||
struct SrcList_item *pItem = &p->pSrc->a[i];
|
struct SrcList_item *pItem = &p->pSrc->a[i];
|
||||||
sqlite3ExplainPrintf(pVdbe, "{%d,*} = ", pItem->iCursor);
|
StrAccum x;
|
||||||
if( pItem->pSelect ){
|
char zLine[100];
|
||||||
sqlite3ExplainSelect(pVdbe, pItem->pSelect);
|
sqlite3StrAccumInit(&x, zLine, sizeof(zLine), 0);
|
||||||
if( pItem->pTab ){
|
sqlite3XPrintf(&x, 0, "{%d,*}", pItem->iCursor);
|
||||||
sqlite3ExplainPrintf(pVdbe, " (tabname=%s)", pItem->pTab->zName);
|
if( pItem->zDatabase ){
|
||||||
}
|
sqlite3XPrintf(&x, 0, " %s.%s", pItem->zDatabase, pItem->zName);
|
||||||
}else if( pItem->zName ){
|
}else if( pItem->zName ){
|
||||||
sqlite3ExplainPrintf(pVdbe, "%s", pItem->zName);
|
sqlite3XPrintf(&x, 0, " %s", pItem->zName);
|
||||||
|
}
|
||||||
|
if( pItem->pTab ){
|
||||||
|
sqlite3XPrintf(&x, 0, " tabname=%Q", pItem->pTab->zName);
|
||||||
}
|
}
|
||||||
if( pItem->zAlias ){
|
if( pItem->zAlias ){
|
||||||
sqlite3ExplainPrintf(pVdbe, " (AS %s)", pItem->zAlias);
|
sqlite3XPrintf(&x, 0, " (AS %s)", pItem->zAlias);
|
||||||
}
|
}
|
||||||
if( pItem->jointype & JT_LEFT ){
|
if( pItem->jointype & JT_LEFT ){
|
||||||
sqlite3ExplainPrintf(pVdbe, " LEFT-JOIN");
|
sqlite3XPrintf(&x, 0, " LEFT-JOIN");
|
||||||
}
|
}
|
||||||
sqlite3ExplainNL(pVdbe);
|
sqlite3StrAccumFinish(&x);
|
||||||
|
sqlite3TreeViewItem(pView, zLine, i<p->pSrc->nSrc-1);
|
||||||
|
if( pItem->pSelect ){
|
||||||
|
sqlite3TreeViewSelect(pView, pItem->pSelect, 0);
|
||||||
|
}
|
||||||
|
sqlite3TreeViewPop(pView);
|
||||||
}
|
}
|
||||||
sqlite3ExplainPop(pVdbe);
|
sqlite3TreeViewPop(pView);
|
||||||
}
|
}
|
||||||
if( p->pWhere ){
|
if( p->pWhere ){
|
||||||
sqlite3ExplainPrintf(pVdbe, "WHERE ");
|
sqlite3TreeViewItem(pView, "WHERE", 1);
|
||||||
sqlite3ExplainExpr(pVdbe, p->pWhere);
|
sqlite3TreeViewExpr(pView, p->pWhere, 0);
|
||||||
sqlite3ExplainNL(pVdbe);
|
sqlite3TreeViewPop(pView);
|
||||||
}
|
}
|
||||||
if( p->pGroupBy ){
|
if( p->pGroupBy ){
|
||||||
sqlite3ExplainPrintf(pVdbe, "GROUPBY ");
|
sqlite3TreeViewExprList(pView, p->pGroupBy, 1, "GROUPBY");
|
||||||
sqlite3ExplainExprList(pVdbe, p->pGroupBy);
|
|
||||||
sqlite3ExplainNL(pVdbe);
|
|
||||||
}
|
}
|
||||||
if( p->pHaving ){
|
if( p->pHaving ){
|
||||||
sqlite3ExplainPrintf(pVdbe, "HAVING ");
|
sqlite3TreeViewItem(pView, "HAVING", 1);
|
||||||
sqlite3ExplainExpr(pVdbe, p->pHaving);
|
sqlite3TreeViewExpr(pView, p->pHaving, 0);
|
||||||
sqlite3ExplainNL(pVdbe);
|
sqlite3TreeViewPop(pView);
|
||||||
}
|
}
|
||||||
if( p->pOrderBy ){
|
if( p->pOrderBy ){
|
||||||
sqlite3ExplainPrintf(pVdbe, "ORDERBY ");
|
sqlite3TreeViewExprList(pView, p->pOrderBy, 1, "ORDERBY");
|
||||||
sqlite3ExplainExprList(pVdbe, p->pOrderBy);
|
|
||||||
sqlite3ExplainNL(pVdbe);
|
|
||||||
}
|
}
|
||||||
if( p->pLimit ){
|
if( p->pLimit ){
|
||||||
sqlite3ExplainPrintf(pVdbe, "LIMIT ");
|
sqlite3TreeViewItem(pView, "LIMIT", 1);
|
||||||
sqlite3ExplainExpr(pVdbe, p->pLimit);
|
sqlite3TreeViewExpr(pView, p->pLimit, 0);
|
||||||
sqlite3ExplainNL(pVdbe);
|
sqlite3TreeViewPop(pView);
|
||||||
}
|
}
|
||||||
if( p->pOffset ){
|
if( p->pOffset ){
|
||||||
sqlite3ExplainPrintf(pVdbe, "OFFSET ");
|
sqlite3TreeViewItem(pView, "OFFSET", 1);
|
||||||
sqlite3ExplainExpr(pVdbe, p->pOffset);
|
sqlite3TreeViewExpr(pView, p->pOffset, 0);
|
||||||
sqlite3ExplainNL(pVdbe);
|
sqlite3TreeViewPop(pView);
|
||||||
}
|
}
|
||||||
|
if( p->pPrior ){
|
||||||
|
const char *zOp = "UNION";
|
||||||
|
switch( p->op ){
|
||||||
|
case TK_ALL: zOp = "UNION ALL"; break;
|
||||||
|
case TK_INTERSECT: zOp = "INTERSECT"; break;
|
||||||
|
case TK_EXCEPT: zOp = "EXCEPT"; break;
|
||||||
|
}
|
||||||
|
sqlite3TreeViewItem(pView, zOp, 1);
|
||||||
|
sqlite3TreeViewSelect(pView, p->pPrior, 1);
|
||||||
|
sqlite3TreeViewPop(pView);
|
||||||
|
}
|
||||||
|
sqlite3TreeViewItem(pView, "END-SELECT", 0);
|
||||||
|
sqlite3TreeViewPop(pView);
|
||||||
|
sqlite3TreeViewPop(pView);
|
||||||
}
|
}
|
||||||
void sqlite3ExplainSelect(Vdbe *pVdbe, Select *p){
|
#endif /* SQLITE_DEBUG */
|
||||||
if( p==0 ){
|
|
||||||
sqlite3ExplainPrintf(pVdbe, "(null-select)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sqlite3ExplainPush(pVdbe);
|
|
||||||
while( p ){
|
|
||||||
explainOneSelect(pVdbe, p);
|
|
||||||
p = p->pNext;
|
|
||||||
if( p==0 ) break;
|
|
||||||
sqlite3ExplainNL(pVdbe);
|
|
||||||
sqlite3ExplainPrintf(pVdbe, "%s\n", selectOpName(p->op));
|
|
||||||
}
|
|
||||||
sqlite3ExplainPrintf(pVdbe, "END");
|
|
||||||
sqlite3ExplainPop(pVdbe);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* End of the structure debug printing code
|
|
||||||
*****************************************************************************/
|
|
||||||
#endif /* defined(SQLITE_ENABLE_TREE_EXPLAIN) */
|
|
||||||
|
@@ -1353,15 +1353,6 @@ static int shell_exec(
|
|||||||
sqlite3_free(zEQP);
|
sqlite3_free(zEQP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output TESTCTRL_EXPLAIN text of requested */
|
|
||||||
if( pArg && pArg->mode==MODE_Explain ){
|
|
||||||
const char *zExplain = 0;
|
|
||||||
sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
|
|
||||||
if( zExplain && zExplain[0] ){
|
|
||||||
fprintf(pArg->out, "%s", zExplain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the shell is currently in ".explain" mode, gather the extra
|
/* If the shell is currently in ".explain" mode, gather the extra
|
||||||
** data required to add indents to the output.*/
|
** data required to add indents to the output.*/
|
||||||
if( pArg && pArg->mode==MODE_Explain ){
|
if( pArg && pArg->mode==MODE_Explain ){
|
||||||
|
@@ -6205,7 +6205,7 @@ int sqlite3_test_control(int op, ...);
|
|||||||
#define SQLITE_TESTCTRL_ISKEYWORD 16
|
#define SQLITE_TESTCTRL_ISKEYWORD 16
|
||||||
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17
|
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17
|
||||||
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
|
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
|
||||||
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19
|
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
|
||||||
#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
|
#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
|
||||||
#define SQLITE_TESTCTRL_VDBE_COVERAGE 21
|
#define SQLITE_TESTCTRL_VDBE_COVERAGE 21
|
||||||
#define SQLITE_TESTCTRL_BYTEORDER 22
|
#define SQLITE_TESTCTRL_BYTEORDER 22
|
||||||
|
@@ -469,6 +469,11 @@
|
|||||||
#define MIN(A,B) ((A)<(B)?(A):(B))
|
#define MIN(A,B) ((A)<(B)?(A):(B))
|
||||||
#define MAX(A,B) ((A)>(B)?(A):(B))
|
#define MAX(A,B) ((A)>(B)?(A):(B))
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Swap two objects of type TYPE.
|
||||||
|
*/
|
||||||
|
#define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Check to see if this machine uses EBCDIC. (Yes, believe it or
|
** Check to see if this machine uses EBCDIC. (Yes, believe it or
|
||||||
** not, there are still machines out there that use EBCDIC.)
|
** not, there are still machines out there that use EBCDIC.)
|
||||||
@@ -855,6 +860,7 @@ typedef struct StrAccum StrAccum;
|
|||||||
typedef struct Table Table;
|
typedef struct Table Table;
|
||||||
typedef struct TableLock TableLock;
|
typedef struct TableLock TableLock;
|
||||||
typedef struct Token Token;
|
typedef struct Token Token;
|
||||||
|
typedef struct TreeView TreeView;
|
||||||
typedef struct Trigger Trigger;
|
typedef struct Trigger Trigger;
|
||||||
typedef struct TriggerPrg TriggerPrg;
|
typedef struct TriggerPrg TriggerPrg;
|
||||||
typedef struct TriggerStep TriggerStep;
|
typedef struct TriggerStep TriggerStep;
|
||||||
@@ -2923,6 +2929,17 @@ struct With {
|
|||||||
} a[1];
|
} a[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef SQLITE_DEBUG
|
||||||
|
/*
|
||||||
|
** An instance of the TreeView object is used for printing the content of
|
||||||
|
** data structures on sqlite3DebugPrintf() using a tree-like view.
|
||||||
|
*/
|
||||||
|
struct TreeView {
|
||||||
|
int iLevel; /* Which level of the tree we are on */
|
||||||
|
u64 mLine; /* Mask of continuation lines to be drawn */
|
||||||
|
};
|
||||||
|
#endif /* SQLITE_DEBUG */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Assuming zIn points to the first byte of a UTF-8 character,
|
** Assuming zIn points to the first byte of a UTF-8 character,
|
||||||
** advance zIn to point to the first byte of the next UTF-8 character.
|
** advance zIn to point to the first byte of the next UTF-8 character.
|
||||||
@@ -3087,25 +3104,14 @@ char *sqlite3MAppendf(sqlite3*,char*,const char*,...);
|
|||||||
void *sqlite3TestTextToPtr(const char*);
|
void *sqlite3TestTextToPtr(const char*);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Output formatting for SQLITE_TESTCTRL_EXPLAIN */
|
#if defined(SQLITE_DEBUG)
|
||||||
#if defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
TreeView *sqlite3TreeViewPush(TreeView*,u8);
|
||||||
void sqlite3ExplainBegin(Vdbe*);
|
void sqlite3TreeViewPop(TreeView*);
|
||||||
void sqlite3ExplainPrintf(Vdbe*, const char*, ...);
|
void sqlite3TreeViewLine(TreeView*, const char*, ...);
|
||||||
void sqlite3ExplainNL(Vdbe*);
|
void sqlite3TreeViewItem(TreeView*, const char*, u8);
|
||||||
void sqlite3ExplainPush(Vdbe*);
|
void sqlite3TreeViewExpr(TreeView*, const Expr*, u8);
|
||||||
void sqlite3ExplainPop(Vdbe*);
|
void sqlite3TreeViewExprList(TreeView*, const ExprList*, u8, const char*);
|
||||||
void sqlite3ExplainFinish(Vdbe*);
|
void sqlite3TreeViewSelect(TreeView*, const Select*, u8);
|
||||||
void sqlite3ExplainSelect(Vdbe*, Select*);
|
|
||||||
void sqlite3ExplainExpr(Vdbe*, Expr*);
|
|
||||||
void sqlite3ExplainExprList(Vdbe*, ExprList*);
|
|
||||||
const char *sqlite3VdbeExplanation(Vdbe*);
|
|
||||||
#else
|
|
||||||
# define sqlite3ExplainBegin(X)
|
|
||||||
# define sqlite3ExplainSelect(A,B)
|
|
||||||
# define sqlite3ExplainExpr(A,B)
|
|
||||||
# define sqlite3ExplainExprList(A,B)
|
|
||||||
# define sqlite3ExplainFinish(X)
|
|
||||||
# define sqlite3VdbeExplanation(X) 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -3128,6 +3134,7 @@ Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
|
|||||||
Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*);
|
Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*);
|
||||||
void sqlite3ExprAssignVarNumber(Parse*, Expr*);
|
void sqlite3ExprAssignVarNumber(Parse*, Expr*);
|
||||||
void sqlite3ExprDelete(sqlite3*, Expr*);
|
void sqlite3ExprDelete(sqlite3*, Expr*);
|
||||||
|
void sqlite3ExprFactor(sqlite3*, Expr*, u8);
|
||||||
ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
|
ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
|
||||||
void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);
|
void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);
|
||||||
void sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*);
|
void sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*);
|
||||||
|
@@ -360,10 +360,6 @@ struct Vdbe {
|
|||||||
i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */
|
i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */
|
||||||
char *zSql; /* Text of the SQL statement that generated this */
|
char *zSql; /* Text of the SQL statement that generated this */
|
||||||
void *pFree; /* Free this when deleting the vdbe */
|
void *pFree; /* Free this when deleting the vdbe */
|
||||||
#ifdef SQLITE_ENABLE_TREE_EXPLAIN
|
|
||||||
Explain *pExplain; /* The explainer */
|
|
||||||
char *zExplain; /* Explanation of data structures */
|
|
||||||
#endif
|
|
||||||
VdbeFrame *pFrame; /* Parent frame */
|
VdbeFrame *pFrame; /* Parent frame */
|
||||||
VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
|
VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
|
||||||
int nFrame; /* Number of frames in pFrame list */
|
int nFrame; /* Number of frames in pFrame list */
|
||||||
|
@@ -2678,10 +2678,6 @@ void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
|
|||||||
sqlite3DbFree(db, p->aColName);
|
sqlite3DbFree(db, p->aColName);
|
||||||
sqlite3DbFree(db, p->zSql);
|
sqlite3DbFree(db, p->zSql);
|
||||||
sqlite3DbFree(db, p->pFree);
|
sqlite3DbFree(db, p->pFree);
|
||||||
#if defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
|
||||||
sqlite3DbFree(db, p->zExplain);
|
|
||||||
sqlite3DbFree(db, p->pExplain);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
115
src/vdbetrace.c
115
src/vdbetrace.c
@@ -183,118 +183,3 @@ char *sqlite3VdbeExpandSql(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* #ifndef SQLITE_OMIT_TRACE */
|
#endif /* #ifndef SQLITE_OMIT_TRACE */
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
** The following code implements the data-structure explaining logic
|
|
||||||
** for the Vdbe.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Allocate a new Explain object
|
|
||||||
*/
|
|
||||||
void sqlite3ExplainBegin(Vdbe *pVdbe){
|
|
||||||
if( pVdbe ){
|
|
||||||
Explain *p;
|
|
||||||
sqlite3BeginBenignMalloc();
|
|
||||||
p = (Explain *)sqlite3MallocZero( sizeof(Explain) );
|
|
||||||
if( p ){
|
|
||||||
p->pVdbe = pVdbe;
|
|
||||||
sqlite3_free(pVdbe->pExplain);
|
|
||||||
pVdbe->pExplain = p;
|
|
||||||
sqlite3StrAccumInit(&p->str, p->zBase, sizeof(p->zBase),
|
|
||||||
SQLITE_MAX_LENGTH);
|
|
||||||
p->str.useMalloc = 2;
|
|
||||||
}else{
|
|
||||||
sqlite3EndBenignMalloc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Return true if the Explain ends with a new-line.
|
|
||||||
*/
|
|
||||||
static int endsWithNL(Explain *p){
|
|
||||||
return p && p->str.zText && p->str.nChar
|
|
||||||
&& p->str.zText[p->str.nChar-1]=='\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Append text to the indentation
|
|
||||||
*/
|
|
||||||
void sqlite3ExplainPrintf(Vdbe *pVdbe, const char *zFormat, ...){
|
|
||||||
Explain *p;
|
|
||||||
if( pVdbe && (p = pVdbe->pExplain)!=0 ){
|
|
||||||
va_list ap;
|
|
||||||
if( p->nIndent && endsWithNL(p) ){
|
|
||||||
int n = p->nIndent;
|
|
||||||
if( n>ArraySize(p->aIndent) ) n = ArraySize(p->aIndent);
|
|
||||||
sqlite3AppendSpace(&p->str, p->aIndent[n-1]);
|
|
||||||
}
|
|
||||||
va_start(ap, zFormat);
|
|
||||||
sqlite3VXPrintf(&p->str, SQLITE_PRINTF_INTERNAL, zFormat, ap);
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Append a '\n' if there is not already one.
|
|
||||||
*/
|
|
||||||
void sqlite3ExplainNL(Vdbe *pVdbe){
|
|
||||||
Explain *p;
|
|
||||||
if( pVdbe && (p = pVdbe->pExplain)!=0 && !endsWithNL(p) ){
|
|
||||||
sqlite3StrAccumAppend(&p->str, "\n", 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Push a new indentation level. Subsequent lines will be indented
|
|
||||||
** so that they begin at the current cursor position.
|
|
||||||
*/
|
|
||||||
void sqlite3ExplainPush(Vdbe *pVdbe){
|
|
||||||
Explain *p;
|
|
||||||
if( pVdbe && (p = pVdbe->pExplain)!=0 ){
|
|
||||||
if( p->str.zText && p->nIndent<ArraySize(p->aIndent) ){
|
|
||||||
const char *z = p->str.zText;
|
|
||||||
int i = p->str.nChar-1;
|
|
||||||
int x;
|
|
||||||
while( i>=0 && z[i]!='\n' ){ i--; }
|
|
||||||
x = (p->str.nChar - 1) - i;
|
|
||||||
if( p->nIndent && x<p->aIndent[p->nIndent-1] ){
|
|
||||||
x = p->aIndent[p->nIndent-1];
|
|
||||||
}
|
|
||||||
p->aIndent[p->nIndent] = x;
|
|
||||||
}
|
|
||||||
p->nIndent++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Pop the indentation stack by one level.
|
|
||||||
*/
|
|
||||||
void sqlite3ExplainPop(Vdbe *p){
|
|
||||||
if( p && p->pExplain ) p->pExplain->nIndent--;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Free the indentation structure
|
|
||||||
*/
|
|
||||||
void sqlite3ExplainFinish(Vdbe *pVdbe){
|
|
||||||
if( pVdbe && pVdbe->pExplain ){
|
|
||||||
sqlite3_free(pVdbe->zExplain);
|
|
||||||
sqlite3ExplainNL(pVdbe);
|
|
||||||
pVdbe->zExplain = sqlite3StrAccumFinish(&pVdbe->pExplain->str);
|
|
||||||
sqlite3_free(pVdbe->pExplain);
|
|
||||||
pVdbe->pExplain = 0;
|
|
||||||
sqlite3EndBenignMalloc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Return the explanation of a virtual machine.
|
|
||||||
*/
|
|
||||||
const char *sqlite3VdbeExplanation(Vdbe *pVdbe){
|
|
||||||
return (pVdbe && pVdbe->zExplain) ? pVdbe->zExplain : 0;
|
|
||||||
}
|
|
||||||
#endif /* defined(SQLITE_DEBUG) */
|
|
||||||
|
59
src/where.c
59
src/where.c
@@ -364,11 +364,6 @@ static int allowedOp(int op){
|
|||||||
return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL;
|
return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
** Swap two objects of type TYPE.
|
|
||||||
*/
|
|
||||||
#define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Commute a comparison operator. Expressions of the form "X op Y"
|
** Commute a comparison operator. Expressions of the form "X op Y"
|
||||||
** are converted into "Y op X".
|
** are converted into "Y op X".
|
||||||
@@ -3761,22 +3756,6 @@ static Bitmask codeOneLoopStart(
|
|||||||
return pLevel->notReady;
|
return pLevel->notReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WHERETRACE_ENABLED) && defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
|
||||||
/*
|
|
||||||
** Generate "Explanation" text for a WhereTerm.
|
|
||||||
*/
|
|
||||||
static void whereExplainTerm(Vdbe *v, WhereTerm *pTerm){
|
|
||||||
char zType[4];
|
|
||||||
memcpy(zType, "...", 4);
|
|
||||||
if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V';
|
|
||||||
if( pTerm->eOperator & WO_EQUIV ) zType[1] = 'E';
|
|
||||||
if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L';
|
|
||||||
sqlite3ExplainPrintf(v, "%s ", zType);
|
|
||||||
sqlite3ExplainExpr(v, pTerm->pExpr);
|
|
||||||
}
|
|
||||||
#endif /* WHERETRACE_ENABLED && SQLITE_ENABLE_TREE_EXPLAIN */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WHERETRACE_ENABLED
|
#ifdef WHERETRACE_ENABLED
|
||||||
/*
|
/*
|
||||||
** Print a WhereLoop object for debugging purposes
|
** Print a WhereLoop object for debugging purposes
|
||||||
@@ -3819,27 +3798,6 @@ static void whereLoopPrint(WhereLoop *p, WhereClause *pWC){
|
|||||||
sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm);
|
sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm);
|
||||||
}
|
}
|
||||||
sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
|
sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
|
||||||
#ifdef SQLITE_ENABLE_TREE_EXPLAIN
|
|
||||||
/* If the 0x100 bit of wheretracing is set, then show all of the constraint
|
|
||||||
** expressions in the WhereLoop.aLTerm[] array.
|
|
||||||
*/
|
|
||||||
if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){ /* WHERETRACE 0x100 */
|
|
||||||
int i;
|
|
||||||
Vdbe *v = pWInfo->pParse->pVdbe;
|
|
||||||
sqlite3ExplainBegin(v);
|
|
||||||
for(i=0; i<p->nLTerm; i++){
|
|
||||||
WhereTerm *pTerm = p->aLTerm[i];
|
|
||||||
if( pTerm==0 ) continue;
|
|
||||||
sqlite3ExplainPrintf(v, " (%d) #%-2d ", i+1, (int)(pTerm-pWC->a));
|
|
||||||
sqlite3ExplainPush(v);
|
|
||||||
whereExplainTerm(v, pTerm);
|
|
||||||
sqlite3ExplainPop(v);
|
|
||||||
sqlite3ExplainNL(v);
|
|
||||||
}
|
|
||||||
sqlite3ExplainFinish(v);
|
|
||||||
sqlite3DebugPrintf("%s", sqlite3VdbeExplanation(v));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -6172,23 +6130,6 @@ WhereInfo *sqlite3WhereBegin(
|
|||||||
|
|
||||||
/* Construct the WhereLoop objects */
|
/* Construct the WhereLoop objects */
|
||||||
WHERETRACE(0xffff,("*** Optimizer Start ***\n"));
|
WHERETRACE(0xffff,("*** Optimizer Start ***\n"));
|
||||||
/* Display all terms of the WHERE clause */
|
|
||||||
#if defined(WHERETRACE_ENABLED) && defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
|
||||||
if( sqlite3WhereTrace & 0x100 ){
|
|
||||||
int i;
|
|
||||||
Vdbe *v = pParse->pVdbe;
|
|
||||||
sqlite3ExplainBegin(v);
|
|
||||||
for(i=0; i<sWLB.pWC->nTerm; i++){
|
|
||||||
sqlite3ExplainPrintf(v, "#%-2d ", i);
|
|
||||||
sqlite3ExplainPush(v);
|
|
||||||
whereExplainTerm(v, &sWLB.pWC->a[i]);
|
|
||||||
sqlite3ExplainPop(v);
|
|
||||||
sqlite3ExplainNL(v);
|
|
||||||
}
|
|
||||||
sqlite3ExplainFinish(v);
|
|
||||||
sqlite3DebugPrintf("%s", sqlite3VdbeExplanation(v));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if( nTabList!=1 || whereShortCut(&sWLB)==0 ){
|
if( nTabList!=1 || whereShortCut(&sWLB)==0 ){
|
||||||
rc = whereLoopAddAll(&sWLB);
|
rc = whereLoopAddAll(&sWLB);
|
||||||
if( rc ) goto whereBeginError;
|
if( rc ) goto whereBeginError;
|
||||||
|
Reference in New Issue
Block a user