** Add a new entry to the EXPLAIN QUERY PLAN data */
| 17281 | ** Add a new entry to the EXPLAIN QUERY PLAN data |
| 17282 | */ |
| 17283 | static void eqp_append(ShellState *p, int iEqpId, int p2, const char *zText){ |
| 17284 | EQPGraphRow *pNew; |
| 17285 | i64 nText; |
| 17286 | if( zText==0 ) return; |
| 17287 | nText = strlen(zText); |
| 17288 | if( p->autoEQPtest ){ |
| 17289 | utf8_printf(p->out, "%d,%d,%s\n", iEqpId, p2, zText); |
| 17290 | } |
| 17291 | pNew = sqlite3_malloc64( sizeof(*pNew) + nText ); |
| 17292 | shell_check_oom(pNew); |
| 17293 | pNew->iEqpId = iEqpId; |
| 17294 | pNew->iParentId = p2; |
| 17295 | memcpy(pNew->zText, zText, nText+1); |
| 17296 | pNew->pNext = 0; |
| 17297 | if( p->sGraph.pLast ){ |
| 17298 | p->sGraph.pLast->pNext = pNew; |
| 17299 | }else{ |
| 17300 | p->sGraph.pRow = pNew; |
| 17301 | } |
| 17302 | p->sGraph.pLast = pNew; |
| 17303 | } |
| 17304 | |
| 17305 | /* |
| 17306 | ** Free and reset the EXPLAIN QUERY PLAN data that has been collected |
no test coverage detected