Change the P4_INTARRAY so that always begins with a length integer. Print

the content of the INTARRAY on EXPLAIN output.

FossilOrigin-Name: 6c520d5726e80b4251338c43c405270d150ea81e
This commit is contained in:
drh
2016-01-30 00:45:18 +00:00
parent eaa6cd87e8
commit b17020265b
6 changed files with 39 additions and 19 deletions
+18 -3
View File
@@ -1288,7 +1288,21 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){
}
#endif
case P4_INTARRAY: {
sqlite3_snprintf(nTemp, zTemp, "intarray");
int i, j;
int *ai = pOp->p4.ai;
int n = ai[0]; /* The first element of an INTARRAY is always the
** count of the number of elements to follow */
zTemp[0] = '[';
for(i=j=1; i<n && j<nTemp-7; i++){
if( j>1 ) zTemp[j++] = ',';
sqlite3_snprintf(nTemp-j, zTemp+j, "%d", ai[i]);
j += sqlite3Strlen30(zTemp+j);
}
if( i<n ){
memcpy(zTemp+j, ",...]", 6);
}else{
memcpy(zTemp+j, "]", 2);
}
break;
}
case P4_SUBPROGRAM: {
@@ -3012,9 +3026,10 @@ int sqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){
VdbeCursor *p = *pp;
if( p->eCurType==CURTYPE_BTREE ){
if( p->deferredMoveto ){
if( p->aAltMap && p->aAltMap[*piCol] ){
int iMap;
if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 ){
*pp = p->pAltCursor;
*piCol = p->aAltMap[*piCol] - 1;
*piCol = iMap - 1;
return SQLITE_OK;
}
return handleDeferredMoveto(p);