1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Improved comments on sqlite3CodeSubquery(). No changes to code.

FossilOrigin-Name: acea4ee136def4815d22eec240c5903a72bde9bd
This commit is contained in:
drh
2016-08-19 19:12:58 +00:00
parent a15a8bc822
commit 39a11819f3
3 changed files with 25 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
C Show\sthe\sWhereTerm.iField\svalue\son\sdebugging\soutput,\swhen\sit\sis\snon-zero. C Improved\scomments\son\ssqlite3CodeSubquery().\s\sNo\schanges\sto\scode.
D 2016-08-19T18:40:17.138 D 2016-08-19T19:12:58.298
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a
@@ -338,7 +338,7 @@ F src/ctime.c e77f3dc297b4b65c96da78b4ae4272fdfae863d7
F src/date.c 95c9a8d00767e7221a8e9a31f4e913fc8029bf6b F src/date.c 95c9a8d00767e7221a8e9a31f4e913fc8029bf6b
F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d
F src/delete.c 76c084f0265f4a3cd1ecf17eee112a94f1ccbc05 F src/delete.c 76c084f0265f4a3cd1ecf17eee112a94f1ccbc05
F src/expr.c d79a02ba0f5b44c3319154641247979c48eec637 F src/expr.c e139851835a8532e3974ca4bc8f6b0e5aef0e06f
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e2be0968c1adc679c87e467aa5b4f167588f38a8 F src/fkey.c e2be0968c1adc679c87e467aa5b4f167588f38a8
F src/func.c 29cc9acb170ec1387b9f63eb52cd85f8de96c771 F src/func.c 29cc9acb170ec1387b9f63eb52cd85f8de96c771
@@ -1518,7 +1518,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P d07be5afb0a915769382dfd815403f8832cb3eec P 931c95358d8bc02f3e3d8ee4e545a07b2d2c97e8
R 8b996d549f6c06da9085faa1b04f9847 R 041e4a08027e633fe8c3ceee8cf4a385
U drh U drh
Z 5690c4429160dd9b0cc8734ae0e94c60 Z b93c8a041c20867db97a84e58d7255a6

View File

@@ -1 +1 @@
931c95358d8bc02f3e3d8ee4e545a07b2d2c97e8 acea4ee136def4815d22eec240c5903a72bde9bd

View File

@@ -2211,7 +2211,9 @@ void sqlite3SubselectError(Parse *pParse, int nActual, int nExpect){
** value to non-NULL if the RHS is NULL-free. ** value to non-NULL if the RHS is NULL-free.
** **
** For a SELECT or EXISTS operator, return the register that holds the ** For a SELECT or EXISTS operator, return the register that holds the
** result. For IN operators or if an error occurs, the return value is 0. ** result. For a multi-column SELECT, the result is stored in a contiguous
** array of registers and the return value is the register of the left-most
** result column. Return 0 for IN operators or if an error occurs.
*/ */
#ifndef SQLITE_OMIT_SUBQUERY #ifndef SQLITE_OMIT_SUBQUERY
int sqlite3CodeSubselect( int sqlite3CodeSubselect(
@@ -2226,8 +2228,8 @@ int sqlite3CodeSubselect(
if( NEVER(v==0) ) return 0; if( NEVER(v==0) ) return 0;
sqlite3ExprCachePush(pParse); sqlite3ExprCachePush(pParse);
/* This code must be run in its entirety every time it is encountered /* The evaluation of the IN/EXISTS/SELECT must be repeated every time it
** if any of the following is true: ** is encountered if any of the following is true:
** **
** * The right-hand side is a correlated subquery ** * The right-hand side is a correlated subquery
** * The right-hand side is an expression list containing variables ** * The right-hand side is an expression list containing variables
@@ -2387,14 +2389,21 @@ int sqlite3CodeSubselect(
case TK_EXISTS: case TK_EXISTS:
case TK_SELECT: case TK_SELECT:
default: { default: {
/* If this has to be a scalar SELECT. Generate code to put the /* Case 3: (SELECT ... FROM ...)
** value of this select in a memory cell and record the number ** or: EXISTS(SELECT ... FROM ...)
** of the memory cell in iColumn. If this is an EXISTS, write **
** an integer 0 (not exists) or 1 (exists) into a memory cell ** For a SELECT, generate code to put the values for all columns of
** and record that memory cell in iColumn. ** the first row into an array of registers and return the index of
** the first register.
**
** If this is an EXISTS, write an integer 0 (not exists) or 1 (exists)
** into a register and return that register number.
**
** In both cases, the query is augmented with "LIMIT 1". Any
** preexisting limit is discarded in place of the new LIMIT 1.
*/ */
Select *pSel; /* SELECT statement to encode */ Select *pSel; /* SELECT statement to encode */
SelectDest dest; /* How to deal with SELECt result */ SelectDest dest; /* How to deal with SELECT result */
int nReg; /* Registers to allocate */ int nReg; /* Registers to allocate */
testcase( pExpr->op==TK_EXISTS ); testcase( pExpr->op==TK_EXISTS );