aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordan <Dan Kennedy>2022-12-05 19:16:23 +0000
committerdan <Dan Kennedy>2022-12-05 19:16:23 +0000
commitd2db31c971cf0abb4dbe0ab51bfe0e8dbee232f2 (patch)
tree7400592902086b7443d0565ae0e1c7cd7bf53f13 /src/expr.c
parent49d402684b86e0f49264b5fbbe1d0ca2e7f64b93 (diff)
parent07c8e08889b840574bb28f7ffd0e19fc76ba5ea5 (diff)
downloadsqlite-d2db31c971cf0abb4dbe0ab51bfe0e8dbee232f2.tar.gz
sqlite-d2db31c971cf0abb4dbe0ab51bfe0e8dbee232f2.zip
Enhance the sqlite3_stmt_scanstatus() API and add sqlite3_stmt_scanstatus_v2(). For creation of enhanced query performance reports.
FossilOrigin-Name: 4893b4e3eafc7c9c22b24717f90a585862203f987cf108b079ce6e946093e675
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c
index d30ae9766..592e9dd25 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -3257,6 +3257,9 @@ int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
SelectDest dest; /* How to deal with SELECT result */
int nReg; /* Registers to allocate */
Expr *pLimit; /* New limit expression */
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
+ int addrExplain; /* Address of OP_Explain instruction */
+#endif
Vdbe *v = pParse->pVdbe;
assert( v!=0 );
@@ -3309,8 +3312,9 @@ int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
** In both cases, the query is augmented with "LIMIT 1". Any
** preexisting limit is discarded in place of the new LIMIT 1.
*/
- ExplainQueryPlan((pParse, 1, "%sSCALAR SUBQUERY %d",
+ ExplainQueryPlan2(addrExplain, (pParse, 1, "%sSCALAR SUBQUERY %d",
addrOnce?"":"CORRELATED ", pSel->selId));
+ sqlite3VdbeScanStatusCounters(v, addrExplain, addrExplain, -1);
nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1;
sqlite3SelectDestInit(&dest, 0, pParse->nMem+1);
pParse->nMem += nReg;
@@ -3353,6 +3357,7 @@ int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
if( addrOnce ){
sqlite3VdbeJumpHere(v, addrOnce);
}
+ sqlite3VdbeScanStatusRange(v, addrExplain, addrExplain, -1);
/* Subroutine return */
assert( ExprUseYSub(pExpr) );