mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Improvements to EXPLAIN QUERY PLAN output for multi-row VALUES claues.
FossilOrigin-Name: ac6f095e13e43d66c06552c8b01f6bec3407c9d41a34c4cdb0be57b0b828ad0d
This commit is contained in:
@@ -721,6 +721,7 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){
|
||||
p->addrFillSub = sqlite3VdbeCurrentAddr(v) + 1;
|
||||
p->regReturn = ++pParse->nMem;
|
||||
p->iCursor = -1;
|
||||
p->u1.nRow = 2;
|
||||
sqlite3VdbeAddOp3(v,OP_InitCoroutine,p->regReturn,0,p->addrFillSub);
|
||||
sqlite3SelectDestInit(&dest, SRT_Coroutine, p->regReturn);
|
||||
|
||||
@@ -733,6 +734,7 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){
|
||||
dest.nSdst = pLeft->pEList->nExpr;
|
||||
pParse->nMem += 2 + dest.nSdst;
|
||||
|
||||
pLeft->selFlags |= SF_MultiValue;
|
||||
sqlite3Select(pParse, pLeft, &dest);
|
||||
p->regResult = dest.iSdst;
|
||||
assert( pParse->nErr || dest.iSdst>0 );
|
||||
@@ -740,6 +742,7 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){
|
||||
}
|
||||
}else{
|
||||
p = &pLeft->pSrc->a[0];
|
||||
p->u1.nRow++;
|
||||
}
|
||||
|
||||
if( pParse->nErr==0 ){
|
||||
@@ -1102,6 +1105,7 @@ void sqlite3Insert(
|
||||
dest.iSDParm = regYield = pItem->regReturn;
|
||||
regFromSelect = pItem->regResult;
|
||||
nColumn = pItem->pSelect->pEList->nExpr;
|
||||
ExplainQueryPlan((pParse, 0, "SCAN %S", pItem));
|
||||
if( bIdListInOrder && nColumn==pTab->nCol ){
|
||||
regData = regFromSelect;
|
||||
regRowid = regData - 1;
|
||||
|
@@ -860,6 +860,9 @@ void sqlite3_str_vappendf(
|
||||
assert( pSel!=0 );
|
||||
if( pSel->selFlags & SF_NestedFrom ){
|
||||
sqlite3_str_appendf(pAccum, "(join-%u)", pSel->selId);
|
||||
}else if( pSel->selFlags & SF_MultiValue ){
|
||||
sqlite3_str_appendf(pAccum, "%u-ROW VALUES CLAUSE",
|
||||
pItem->u1.nRow);
|
||||
}else{
|
||||
sqlite3_str_appendf(pAccum, "(subquery-%u)", pSel->selId);
|
||||
}
|
||||
|
@@ -3311,6 +3311,7 @@ struct SrcItem {
|
||||
union {
|
||||
char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */
|
||||
ExprList *pFuncArg; /* Arguments to table-valued-function */
|
||||
u32 nRow; /* Number of rows in a VALUES clause */
|
||||
} u1;
|
||||
union {
|
||||
Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */
|
||||
|
@@ -6144,7 +6144,11 @@ WhereInfo *sqlite3WhereBegin(
|
||||
){
|
||||
pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
|
||||
}
|
||||
ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW"));
|
||||
if( ALWAYS(pWInfo->pSelect)
|
||||
&& (pWInfo->pSelect->selFlags & SF_MultiValue)==0
|
||||
){
|
||||
ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW"));
|
||||
}
|
||||
}else{
|
||||
/* Assign a bit from the bitmask to every term in the FROM clause.
|
||||
**
|
||||
|
Reference in New Issue
Block a user