-C Add\ssupport\sfor\svector\sassignments\sin\sthe\sSET\sclause\sof\san\sUPDATE\sstatement.
-D 2016-08-20T00:51:37.333
+C Improvements\sto\scomments.\s\sNo\scode\schanges.
+D 2016-08-20T01:06:22.412
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a
F src/date.c 95c9a8d00767e7221a8e9a31f4e913fc8029bf6b
F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d
F src/delete.c 76c084f0265f4a3cd1ecf17eee112a94f1ccbc05
-F src/expr.c bdc98d3301358bac9b19e23a22375f5220a77274
+F src/expr.c d5cffb307d4e812c41a6fb1f6bc94e6b0801e3e8
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e2be0968c1adc679c87e467aa5b4f167588f38a8
F src/func.c 29cc9acb170ec1387b9f63eb52cd85f8de96c771
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d8feea7dcde83179bff303072426561cfe825e58
-R d0cc8110f72472ebd6ad961310b5fb0d
+P f320d47d6b7b08d9552c8444004bc256348bda90
+R d44ef1061d1c50d06d327d2ef8a626d9
U drh
-Z 375b2bf2a6add0d9f506b37662f21e95
+Z fa86522a92bb8bcf293bd50750ba2b7b
** sqlite3ExprCode() will generate all necessary code to compute
** the iField-th column of the vector expression pVector.
**
+** It is ok for pVector to be a scalar (as long as iField==0).
+** In that case, this routine works like sqlite3ExprDup().
+**
** The caller owns the returned Expr object and is responsible for
** ensuring that the returned value eventually gets freed.
**
-** The caller retains ownership of pVector and must ensure that pVector
-** remains valid as long as the returned value is in use.
+** The caller retains ownership of pVector. If pVector is a TK_SELECT,
+** then the return value will reference pVector and so pVector must remain
+** valid for the life of the returned object. If pVector is a TK_VECTOR
+** or a scalar expression, then it can be deleted as soon as this routine
+** routines.
+**
+** A trick to cause a TK_SELECT pVector to be deleted together with
+** the returned Expr object is to attach the pVector to the pRight field
+** of the returned TK_SELECT_COLUMN Expr object.
*/
Expr *sqlite3ExprForVectorField(
Parse *pParse, /* Parsing context */
/* The TK_SELECT_COLUMN Expr node:
**
** pLeft: pVector containing TK_SELECT
- ** pRight: pVector if ownership taken
+ ** pRight: not used. But recursively deleted.
** iColumn: Index of a column in pVector
** pLeft->iTable: First in an array of register holding result, or 0
** if the result is not yet computed.
**
** sqlite3ExprDelete() specifically skips the recursive delete of
** pLeft on TK_SELECT_COLUMN nodes. But pRight is followed, so pVector
- ** is included on pRight if ownership is taken. Typically there will
- ** be multiple TK_SELECT_COLUMN nodes with the same pLeft pointer to
- ** the pVector, but only one of them will own the pVector.
+ ** can be attached to pRight to cause this node to take ownership of
+ ** pVector. Typically there will be multiple TK_SELECT_COLUMN nodes
+ ** with the same pLeft pointer to the pVector, but only one of them
+ ** will own the pVector.
*/
pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, pVector, 0, 0);
if( pRet ) pRet->iColumn = iField;
}
/*
-** pColumns and pExpr for a vector assignment, like this:
+** pColumns and pExpr form a vector assignment which is part of the SET
+** clause of an UPDATE statement. Like this:
**
** (a,b,c) = (expr1,expr2,expr3)
** Or: (a,b,c) = (SELECT x,y,z FROM ....)
**
** For each term of the vector assignment, append new entries to the
-** expression list. In the case of a subquery on the LHS, append
+** expression list pList. In the case of a subquery on the LHS, append
** TK_SELECT_COLUMN expressions.
*/
ExprList *sqlite3ExprListAppendVector(