mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Split out the bulk of the actual VDBE code generation logic from where.c
into a new file, leaving behind the analysis logic. This makes the original where.c smaller and hopefully easier to edit. FossilOrigin-Name: faa0e420e93a2bc1c84df9eb9fef4748d29ce339
This commit is contained in:
@@ -184,7 +184,7 @@ LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
|
|||||||
table.lo threads.lo tokenize.lo trigger.lo \
|
table.lo threads.lo tokenize.lo trigger.lo \
|
||||||
update.lo util.lo vacuum.lo \
|
update.lo util.lo vacuum.lo \
|
||||||
vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
|
vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
|
||||||
vdbetrace.lo wal.lo walker.lo where.lo utf.lo vtab.lo
|
vdbetrace.lo wal.lo walker.lo where.lo wherecode.lo utf.lo vtab.lo
|
||||||
|
|
||||||
# Object files for the amalgamation.
|
# Object files for the amalgamation.
|
||||||
#
|
#
|
||||||
@@ -293,6 +293,7 @@ SRC = \
|
|||||||
$(TOP)/src/wal.h \
|
$(TOP)/src/wal.h \
|
||||||
$(TOP)/src/walker.c \
|
$(TOP)/src/walker.c \
|
||||||
$(TOP)/src/where.c \
|
$(TOP)/src/where.c \
|
||||||
|
$(TOP)/src/wherecode.c \
|
||||||
$(TOP)/src/whereInt.h
|
$(TOP)/src/whereInt.h
|
||||||
|
|
||||||
# Source code for extensions
|
# Source code for extensions
|
||||||
@@ -454,6 +455,7 @@ TESTSRC2 = \
|
|||||||
$(TOP)/src/vdbemem.c \
|
$(TOP)/src/vdbemem.c \
|
||||||
$(TOP)/src/vdbetrace.c \
|
$(TOP)/src/vdbetrace.c \
|
||||||
$(TOP)/src/where.c \
|
$(TOP)/src/where.c \
|
||||||
|
$(TOP)/src/wherecode.c \
|
||||||
parse.c \
|
parse.c \
|
||||||
$(TOP)/ext/fts3/fts3.c \
|
$(TOP)/ext/fts3/fts3.c \
|
||||||
$(TOP)/ext/fts3/fts3_aux.c \
|
$(TOP)/ext/fts3/fts3_aux.c \
|
||||||
@@ -849,6 +851,9 @@ walker.lo: $(TOP)/src/walker.c $(HDR)
|
|||||||
where.lo: $(TOP)/src/where.c $(HDR)
|
where.lo: $(TOP)/src/where.c $(HDR)
|
||||||
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/where.c
|
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/where.c
|
||||||
|
|
||||||
|
wherecode.lo: $(TOP)/src/wherecode.c $(HDR)
|
||||||
|
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/wherecode.c
|
||||||
|
|
||||||
tclsqlite.lo: $(TOP)/src/tclsqlite.c $(HDR)
|
tclsqlite.lo: $(TOP)/src/tclsqlite.c $(HDR)
|
||||||
$(LTCOMPILE) -DUSE_TCL_STUBS=1 -c $(TOP)/src/tclsqlite.c
|
$(LTCOMPILE) -DUSE_TCL_STUBS=1 -c $(TOP)/src/tclsqlite.c
|
||||||
|
|
||||||
|
|||||||
@@ -838,7 +838,7 @@ LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
|
|||||||
table.lo threads.lo tokenize.lo trigger.lo \
|
table.lo threads.lo tokenize.lo trigger.lo \
|
||||||
update.lo util.lo vacuum.lo \
|
update.lo util.lo vacuum.lo \
|
||||||
vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
|
vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
|
||||||
vdbetrace.lo wal.lo walker.lo where.lo utf.lo vtab.lo
|
vdbetrace.lo wal.lo walker.lo where.lo wherecode.lo utf.lo vtab.lo
|
||||||
|
|
||||||
# Object files for the amalgamation.
|
# Object files for the amalgamation.
|
||||||
#
|
#
|
||||||
@@ -959,6 +959,7 @@ SRC2 = \
|
|||||||
$(TOP)\src\wal.h \
|
$(TOP)\src\wal.h \
|
||||||
$(TOP)\src\walker.c \
|
$(TOP)\src\walker.c \
|
||||||
$(TOP)\src\where.c \
|
$(TOP)\src\where.c \
|
||||||
|
$(TOP)\src\wherecode.c \
|
||||||
$(TOP)\src\whereInt.h
|
$(TOP)\src\whereInt.h
|
||||||
|
|
||||||
# Source code for extensions
|
# Source code for extensions
|
||||||
@@ -1121,6 +1122,7 @@ TESTSRC2 = \
|
|||||||
$(TOP)\src\vdbesort.c \
|
$(TOP)\src\vdbesort.c \
|
||||||
$(TOP)\src\vdbetrace.c \
|
$(TOP)\src\vdbetrace.c \
|
||||||
$(TOP)\src\where.c \
|
$(TOP)\src\where.c \
|
||||||
|
$(TOP)\src\wherecode.c \
|
||||||
parse.c \
|
parse.c \
|
||||||
$(TOP)\ext\fts3\fts3.c \
|
$(TOP)\ext\fts3\fts3.c \
|
||||||
$(TOP)\ext\fts3\fts3_aux.c \
|
$(TOP)\ext\fts3\fts3_aux.c \
|
||||||
@@ -1530,6 +1532,9 @@ walker.lo: $(TOP)\src\walker.c $(HDR)
|
|||||||
where.lo: $(TOP)\src\where.c $(HDR)
|
where.lo: $(TOP)\src\where.c $(HDR)
|
||||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\where.c
|
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\where.c
|
||||||
|
|
||||||
|
wherecode.lo: $(TOP)\src\wherecode.c $(HDR)
|
||||||
|
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wherecode.c
|
||||||
|
|
||||||
tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR)
|
tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR)
|
||||||
$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
|
$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
|
||||||
|
|
||||||
|
|||||||
4
main.mk
4
main.mk
@@ -69,7 +69,7 @@ LIBOBJ+= vdbe.o parse.o \
|
|||||||
table.o threads.o tokenize.o trigger.o \
|
table.o threads.o tokenize.o trigger.o \
|
||||||
update.o userauth.o util.o vacuum.o \
|
update.o userauth.o util.o vacuum.o \
|
||||||
vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
|
vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
|
||||||
vdbetrace.o wal.o walker.o where.o utf.o vtab.o
|
vdbetrace.o wal.o walker.o where.o wherecode.o utf.o vtab.o
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -171,6 +171,7 @@ SRC = \
|
|||||||
$(TOP)/src/wal.h \
|
$(TOP)/src/wal.h \
|
||||||
$(TOP)/src/walker.c \
|
$(TOP)/src/walker.c \
|
||||||
$(TOP)/src/where.c \
|
$(TOP)/src/where.c \
|
||||||
|
$(TOP)/src/wherecode.c \
|
||||||
$(TOP)/src/whereInt.h
|
$(TOP)/src/whereInt.h
|
||||||
|
|
||||||
# Source code for extensions
|
# Source code for extensions
|
||||||
@@ -337,6 +338,7 @@ TESTSRC2 = \
|
|||||||
$(TOP)/src/vdbe.c \
|
$(TOP)/src/vdbe.c \
|
||||||
$(TOP)/src/vdbemem.c \
|
$(TOP)/src/vdbemem.c \
|
||||||
$(TOP)/src/where.c \
|
$(TOP)/src/where.c \
|
||||||
|
$(TOP)/src/wherecode.c \
|
||||||
parse.c \
|
parse.c \
|
||||||
$(TOP)/ext/fts3/fts3.c \
|
$(TOP)/ext/fts3/fts3.c \
|
||||||
$(TOP)/ext/fts3/fts3_aux.c \
|
$(TOP)/ext/fts3/fts3_aux.c \
|
||||||
|
|||||||
23
manifest
23
manifest
@@ -1,9 +1,9 @@
|
|||||||
C Code\ssimplifications\sin\sselect.c\sand\swhere.c.
|
C Split\sout\sthe\sbulk\sof\sthe\sactual\sVDBE\scode\sgeneration\slogic\sfrom\swhere.c\ninto\sa\snew\sfile,\sleaving\sbehind\sthe\sanalysis\slogic.\s\sThis\smakes\sthe\soriginal\nwhere.c\ssmaller\sand\shopefully\seasier\sto\sedit.
|
||||||
D 2015-06-06T18:30:17.822
|
D 2015-06-06T20:12:09.183
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 994bab32a3a69e0c35bd148b65cde49879772964
|
F Makefile.in 64136f59edd49b389b5c5d24388e204929b807e5
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
F Makefile.msc d37d2c2323df3acae6e24c71a478889421c17264
|
F Makefile.msc e2f1f95dc4a0af0b9ac3c2ee66878700b71ad93f
|
||||||
F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
|
F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
|
||||||
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
||||||
F VERSION ce0ae95abd7121c534f6917c1c8f2b70d9acd4db
|
F VERSION ce0ae95abd7121c534f6917c1c8f2b70d9acd4db
|
||||||
@@ -171,7 +171,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
|
|||||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||||
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
||||||
F main.mk 8d418497da6a152a59b00d64ae3d66f3c665974c
|
F main.mk b9e0c806c04739b20f281680f8771bc2e20acd54
|
||||||
F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
|
F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
|
||||||
F mkopcodeh.awk d5e22023b5238985bb54a72d33e0ac71fe4f8a32
|
F mkopcodeh.awk d5e22023b5238985bb54a72d33e0ac71fe4f8a32
|
||||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||||
@@ -326,8 +326,9 @@ F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb
|
|||||||
F src/wal.c ce2cb2d06faab54d1bce3e739bec79e063dd9113
|
F src/wal.c ce2cb2d06faab54d1bce3e739bec79e063dd9113
|
||||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||||
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
|
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
|
||||||
F src/where.c 5cc416ad6d8b6d2027735fcf7c5a6165bb745636
|
F src/where.c c9d804dcf02388207096e4da19487d9a2a7a9a67
|
||||||
F src/whereInt.h a6f5a762bc1b4b1c76e1cea79976b437ac35a435
|
F src/whereInt.h 40e1d060b6aa02edbb7b8a1f3dfc0cc4ff140881
|
||||||
|
F src/wherecode.c 0669481cabaf5caf934b6bb825df15bc57f60d40
|
||||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||||
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
|
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
@@ -1247,7 +1248,7 @@ F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
|||||||
F tool/mkpragmatab.tcl 40c287d3f929ece67da6e9e7c49885789960accf
|
F tool/mkpragmatab.tcl 40c287d3f929ece67da6e9e7c49885789960accf
|
||||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
||||||
F tool/mksqlite3c-noext.tcl 69bae8ce4aa52d2ff82d4a8a856bf283ec035b2e
|
F tool/mksqlite3c-noext.tcl 69bae8ce4aa52d2ff82d4a8a856bf283ec035b2e
|
||||||
F tool/mksqlite3c.tcl fdeab4c1eed90b7ab741ec12a7bc5c2fb60188bd
|
F tool/mksqlite3c.tcl 9f60238b2273048a4089077a43716d3b33a67c51
|
||||||
F tool/mksqlite3h.tcl 44730d586c9031638cdd2eb443b801c0d2dbd9f8
|
F tool/mksqlite3h.tcl 44730d586c9031638cdd2eb443b801c0d2dbd9f8
|
||||||
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
|
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
|
||||||
F tool/mkvsix.tcl 3b58b9398f91c7dbf18d49eb87cefeee9efdbce1
|
F tool/mkvsix.tcl 3b58b9398f91c7dbf18d49eb87cefeee9efdbce1
|
||||||
@@ -1282,7 +1283,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 f4c90d06bb941453d8110680c7b279e471e8f034
|
P 4f20ac90bce8bd7ba43ef59af5cc4ef7aa282fe8
|
||||||
R 042f84cf941d82ab55744b287e51eff7
|
R f7b66d3e1070ad2d563a494aba699c70
|
||||||
U drh
|
U drh
|
||||||
Z f6bc4d318934fdab6d55b7066c6ff342
|
Z 85351aea272e066665037522f98406f9
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
4f20ac90bce8bd7ba43ef59af5cc4ef7aa282fe8
|
faa0e420e93a2bc1c84df9eb9fef4748d29ce339
|
||||||
1528
src/where.c
1528
src/where.c
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@
|
|||||||
** Trace output macros
|
** Trace output macros
|
||||||
*/
|
*/
|
||||||
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
|
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
|
||||||
/***/ int sqlite3WhereTrace = 0;
|
/***/ int sqlite3WhereTrace;
|
||||||
#endif
|
#endif
|
||||||
#if defined(SQLITE_DEBUG) \
|
#if defined(SQLITE_DEBUG) \
|
||||||
&& (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
|
&& (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
|
||||||
@@ -161,10 +161,6 @@ struct WhereOrSet {
|
|||||||
WhereOrCost a[N_OR_COST]; /* Set of best costs */
|
WhereOrCost a[N_OR_COST]; /* Set of best costs */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Forward declaration of methods */
|
|
||||||
static int whereLoopResize(sqlite3*, WhereLoop*, int);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Each instance of this object holds a sequence of WhereLoop objects
|
** Each instance of this object holds a sequence of WhereLoop objects
|
||||||
** that implement some or all of a query plan.
|
** that implement some or all of a query plan.
|
||||||
@@ -423,6 +419,52 @@ struct WhereInfo {
|
|||||||
WhereLevel a[1]; /* Information about each nest loop in WHERE */
|
WhereLevel a[1]; /* Information about each nest loop in WHERE */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Private interfaces - callable only by other where.c routines.
|
||||||
|
*/
|
||||||
|
Bitmask sqlite3WhereGetMask(WhereMaskSet*,int);
|
||||||
|
WhereTerm *sqlite3WhereFindTerm(
|
||||||
|
WhereClause *pWC, /* The WHERE clause to be searched */
|
||||||
|
int iCur, /* Cursor number of LHS */
|
||||||
|
int iColumn, /* Column number of LHS */
|
||||||
|
Bitmask notReady, /* RHS must not overlap with this mask */
|
||||||
|
u32 op, /* Mask of WO_xx values describing operator */
|
||||||
|
Index *pIdx /* Must be compatible with this index, if not NULL */
|
||||||
|
);
|
||||||
|
#ifndef SQLITE_OMIT_EXPLAIN
|
||||||
|
int sqlite3WhereExplainOneScan(
|
||||||
|
Parse *pParse, /* Parse context */
|
||||||
|
SrcList *pTabList, /* Table list this loop refers to */
|
||||||
|
WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
|
||||||
|
int iLevel, /* Value for "level" column of output */
|
||||||
|
int iFrom, /* Value for "from" column of output */
|
||||||
|
u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
# define sqlite3WhereExplainOneScan(u,v,w,x,y,z) 0
|
||||||
|
#endif /* SQLITE_OMIT_EXPLAIN */
|
||||||
|
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
|
||||||
|
void sqlite3WhereAddScanStatus(
|
||||||
|
Vdbe *v, /* Vdbe to add scanstatus entry to */
|
||||||
|
SrcList *pSrclist, /* FROM clause pLvl reads data from */
|
||||||
|
WhereLevel *pLvl, /* Level to add scanstatus() entry for */
|
||||||
|
int addrExplain /* Address of OP_Explain (or 0) */
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
# define sqlite3WhereAddScanStatus(a, b, c, d) ((void)d)
|
||||||
|
#endif
|
||||||
|
Bitmask sqlite3WhereCodeOneLoopStart(
|
||||||
|
WhereInfo *pWInfo, /* Complete information about the WHERE clause */
|
||||||
|
int iLevel, /* Which level of pWInfo->a[] should be coded */
|
||||||
|
Bitmask notReady /* Which tables are currently available */
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Bitmasks for the operators on WhereTerm objects. These are all
|
** Bitmasks for the operators on WhereTerm objects. These are all
|
||||||
** operators that are of interest to the query planner. An
|
** operators that are of interest to the query planner. An
|
||||||
|
|||||||
1501
src/wherecode.c
Normal file
1501
src/wherecode.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -343,6 +343,7 @@ foreach file {
|
|||||||
update.c
|
update.c
|
||||||
vacuum.c
|
vacuum.c
|
||||||
vtab.c
|
vtab.c
|
||||||
|
wherecode.c
|
||||||
where.c
|
where.c
|
||||||
|
|
||||||
parse.c
|
parse.c
|
||||||
|
|||||||
Reference in New Issue
Block a user