1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Split more subfunctions of where.c out into a new whereexpr.c source file,

for improved maintainability.

FossilOrigin-Name: 46ef95c108ad8961f2bf3d2dc839d4fb1fddd770
This commit is contained in:
drh
2015-06-08 14:23:15 +00:00
parent 6f82e85a80
commit 6c1f4ef217
9 changed files with 1306 additions and 1247 deletions

View File

@@ -184,7 +184,8 @@ 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 wherecode.lo utf.lo vtab.lo vdbetrace.lo wal.lo walker.lo where.lo wherecode.lo whereexpr.lo \
utf.lo vtab.lo
# Object files for the amalgamation. # Object files for the amalgamation.
# #
@@ -294,6 +295,7 @@ SRC = \
$(TOP)/src/walker.c \ $(TOP)/src/walker.c \
$(TOP)/src/where.c \ $(TOP)/src/where.c \
$(TOP)/src/wherecode.c \ $(TOP)/src/wherecode.c \
$(TOP)/src/whereexpr.c \
$(TOP)/src/whereInt.h $(TOP)/src/whereInt.h
# Source code for extensions # Source code for extensions
@@ -456,6 +458,7 @@ TESTSRC2 = \
$(TOP)/src/vdbetrace.c \ $(TOP)/src/vdbetrace.c \
$(TOP)/src/where.c \ $(TOP)/src/where.c \
$(TOP)/src/wherecode.c \ $(TOP)/src/wherecode.c \
$(TOP)/src/whereexpr.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 \
@@ -854,6 +857,9 @@ where.lo: $(TOP)/src/where.c $(HDR)
wherecode.lo: $(TOP)/src/wherecode.c $(HDR) wherecode.lo: $(TOP)/src/wherecode.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/wherecode.c $(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/wherecode.c
whereexpr.lo: $(TOP)/src/whereexpr.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/whereexpr.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

View File

@@ -838,7 +838,8 @@ 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 wherecode.lo utf.lo vtab.lo vdbetrace.lo wal.lo walker.lo where.lo wherecode.lo whereexpr.lo \
utf.lo vtab.lo
# Object files for the amalgamation. # Object files for the amalgamation.
# #
@@ -960,6 +961,7 @@ SRC2 = \
$(TOP)\src\walker.c \ $(TOP)\src\walker.c \
$(TOP)\src\where.c \ $(TOP)\src\where.c \
$(TOP)\src\wherecode.c \ $(TOP)\src\wherecode.c \
$(TOP)\src\whereexpr.c \
$(TOP)\src\whereInt.h $(TOP)\src\whereInt.h
# Source code for extensions # Source code for extensions
@@ -1123,6 +1125,7 @@ TESTSRC2 = \
$(TOP)\src\vdbetrace.c \ $(TOP)\src\vdbetrace.c \
$(TOP)\src\where.c \ $(TOP)\src\where.c \
$(TOP)\src\wherecode.c \ $(TOP)\src\wherecode.c \
$(TOP)\src\whereexpr.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 \
@@ -1535,6 +1538,9 @@ where.lo: $(TOP)\src\where.c $(HDR)
wherecode.lo: $(TOP)\src\wherecode.c $(HDR) wherecode.lo: $(TOP)\src\wherecode.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wherecode.c $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wherecode.c
whereexpr.lo: $(TOP)\src\whereexpr.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\whereexpr.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

View File

@@ -69,7 +69,8 @@ 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 wherecode.o utf.o vtab.o vdbetrace.o wal.o walker.o where.o wherecode.o whereexpr.o \
utf.o vtab.o
@@ -172,6 +173,7 @@ SRC = \
$(TOP)/src/walker.c \ $(TOP)/src/walker.c \
$(TOP)/src/where.c \ $(TOP)/src/where.c \
$(TOP)/src/wherecode.c \ $(TOP)/src/wherecode.c \
$(TOP)/src/whereexpr.c \
$(TOP)/src/whereInt.h $(TOP)/src/whereInt.h
# Source code for extensions # Source code for extensions
@@ -339,6 +341,7 @@ TESTSRC2 = \
$(TOP)/src/vdbemem.c \ $(TOP)/src/vdbemem.c \
$(TOP)/src/where.c \ $(TOP)/src/where.c \
$(TOP)/src/wherecode.c \ $(TOP)/src/wherecode.c \
$(TOP)/src/whereexpr.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 \

View File

@@ -1,9 +1,9 @@
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. C Split\smore\ssubfunctions\sof\swhere.c\sout\sinto\sa\snew\swhereexpr.c\ssource\sfile,\nfor\simproved\smaintainability.
D 2015-06-06T20:12:09.183 D 2015-06-08T14:23:15.485
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 64136f59edd49b389b5c5d24388e204929b807e5 F Makefile.in d7bde8e39e88f23c99219e822aaab80a9ce48a53
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F Makefile.msc e2f1f95dc4a0af0b9ac3c2ee66878700b71ad93f F Makefile.msc e4e8cbbe98d77d62b1fed34d95d966d5db2a1b01
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 b9e0c806c04739b20f281680f8771bc2e20acd54 F main.mk 4aed2f4087f3880a92c505fba772f2368d699da5
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,9 +326,10 @@ 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 c9d804dcf02388207096e4da19487d9a2a7a9a67 F src/where.c a328fcc3342044992644b6a11bf301593b8dafb4
F src/whereInt.h 40e1d060b6aa02edbb7b8a1f3dfc0cc4ff140881 F src/whereInt.h 5f87e3c4b0551747d119730dfebddd3c54f04047
F src/wherecode.c 0669481cabaf5caf934b6bb825df15bc57f60d40 F src/wherecode.c 0669481cabaf5caf934b6bb825df15bc57f60d40
F src/whereexpr.c 9ce1c9cfedbf80c93c7d899497025ec8256ce652
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
@@ -1248,7 +1249,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 9f60238b2273048a4089077a43716d3b33a67c51 F tool/mksqlite3c.tcl 9a4b87e86c6036b285b5f0fe1e4db0c79c4092ab
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
@@ -1283,7 +1284,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 4f20ac90bce8bd7ba43ef59af5cc4ef7aa282fe8 P faa0e420e93a2bc1c84df9eb9fef4748d29ce339
R f7b66d3e1070ad2d563a494aba699c70 R d7cd77de896255756abb541430f78771
U drh U drh
Z 85351aea272e066665037522f98406f9 Z 58efdf4d20fca9a444e5c6368ea56c89

View File

@@ -1 +1 @@
faa0e420e93a2bc1c84df9eb9fef4748d29ce339 46ef95c108ad8961f2bf3d2dc839d4fb1fddd770

File diff suppressed because it is too large Load Diff

View File

@@ -368,6 +368,11 @@ struct WhereMaskSet {
int ix[BMS]; /* Cursor assigned to each bit */ int ix[BMS]; /* Cursor assigned to each bit */
}; };
/*
** Initialize a WhereMaskSet object
*/
#define initMaskSet(P) (P)->n=0
/* /*
** This object is a convenience wrapper holding all information needed ** This object is a convenience wrapper holding all information needed
** to construct WhereLoop objects for a particular query. ** to construct WhereLoop objects for a particular query.
@@ -421,6 +426,8 @@ struct WhereInfo {
/* /*
** Private interfaces - callable only by other where.c routines. ** Private interfaces - callable only by other where.c routines.
**
** where.c:
*/ */
Bitmask sqlite3WhereGetMask(WhereMaskSet*,int); Bitmask sqlite3WhereGetMask(WhereMaskSet*,int);
WhereTerm *sqlite3WhereFindTerm( WhereTerm *sqlite3WhereFindTerm(
@@ -431,6 +438,8 @@ WhereTerm *sqlite3WhereFindTerm(
u32 op, /* Mask of WO_xx values describing operator */ u32 op, /* Mask of WO_xx values describing operator */
Index *pIdx /* Must be compatible with this index, if not NULL */ Index *pIdx /* Must be compatible with this index, if not NULL */
); );
/* wherecode.c: */
#ifndef SQLITE_OMIT_EXPLAIN #ifndef SQLITE_OMIT_EXPLAIN
int sqlite3WhereExplainOneScan( int sqlite3WhereExplainOneScan(
Parse *pParse, /* Parse context */ Parse *pParse, /* Parse context */
@@ -459,7 +468,13 @@ Bitmask sqlite3WhereCodeOneLoopStart(
Bitmask notReady /* Which tables are currently available */ Bitmask notReady /* Which tables are currently available */
); );
/* whereexpr.c: */
void sqlite3WhereClauseInit(WhereClause*,WhereInfo*);
void sqlite3WhereClauseClear(WhereClause*);
void sqlite3WhereSplit(WhereClause*,Expr*,u8);
Bitmask sqlite3WhereExprUsage(WhereMaskSet*, Expr*);
Bitmask sqlite3WhereExprListUsage(WhereMaskSet*, ExprList*);
void sqlite3WhereExprAnalyze(SrcList*, WhereClause*);

1249
src/whereexpr.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -344,6 +344,7 @@ foreach file {
vacuum.c vacuum.c
vtab.c vtab.c
wherecode.c wherecode.c
whereexpr.c
where.c where.c
parse.c parse.c