1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-02 05:54:29 +03:00

Enhance the CLI to render EXPLAIN QUERY PLAN using an ASCII-art graph.

This works with ".eqp" modes and when the query begins with exactly
"EXPLAIN QUERY PLAN".  To see the original output format, add extra space
characters in between words of the initial "EXPLAIN QUERY PLAN".

FossilOrigin-Name: f53716ee2ab5a6d47a5551529aae526bb39058f4a8e11e6243b32c1ddc25a19e
This commit is contained in:
drh
2018-04-24 13:07:40 +00:00
parent 4d3e61403a
commit 4b5345ccc7
4 changed files with 176 additions and 76 deletions

View File

@@ -1645,6 +1645,9 @@ void sqlite3VdbeFrameDelete(VdbeFrame *p){
** p->explain==2, only OP_Explain instructions are listed and these
** are shown in a different format. p->explain==2 is used to implement
** EXPLAIN QUERY PLAN.
** 2018-04-24: In p->explain==2 mode, the OP_Init opcodes of triggers
** are also shown, so that the boundaries between the main program and
** each trigger are clear.
**
** When p->explain==1, first the main program is listed, then each of
** the trigger subprograms are listed one by one.
@@ -1707,7 +1710,7 @@ int sqlite3VdbeList(
}
}
do{
while(1){ /* Loop exits via break */
i = p->pc++;
if( i>=nRow ){
p->rc = SQLITE_OK;
@@ -1753,7 +1756,10 @@ int sqlite3VdbeList(
nRow += pOp->p4.pProgram->nOp;
}
}
}while( p->explain==2 && pOp->opcode!=OP_Explain );
if( p->explain<2 ) break;
if( pOp->opcode==OP_Explain ) break;
if( pOp->opcode==OP_Init && p->pc>1 ) break;
}
if( rc==SQLITE_OK ){
if( db->u1.isInterrupted ){