From: danielk1977 Date: Fri, 21 May 2004 10:49:47 +0000 (+0000) Subject: Pretty-print blobs in vdbe-traces. (CVS 1428) X-Git-Tag: version-3.6.10~4646 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca6b291fcfd3ebb74618139aa97f8de8c0dd7fa4;p=thirdparty%2Fsqlite.git Pretty-print blobs in vdbe-traces. (CVS 1428) FossilOrigin-Name: 5eb94c97657b34ed2df6455e23875e2840743bda --- diff --git a/manifest b/manifest index d43af6334a..feed4199a3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\swork\son\sthe\snew\sAPI.\sAll\sthe\sfunctions\sto\sexecute\squeries\sare\sthere\nnow.\s(CVS\s1427) -D 2004-05-21T10:08:54 +C Pretty-print\sblobs\sin\svdbe-traces.\s(CVS\s1428) +D 2004-05-21T10:49:48 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -64,10 +64,10 @@ F src/update.c 1a5e9182596f3ea8c7a141e308a3d2a7e5689fee F src/utf.c c27c4f1120f7aaef00cd6942b3d9e3f4ca4fe0e4 F src/util.c 5cbeb452da09cfc7248de9948c15b14d840723f7 F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476 -F src/vdbe.c cafe464b807f480491e4e5212833af1b78e75c3c +F src/vdbe.c f0e24400884c3e3a5021f60ca2310e7373709e3e F src/vdbe.h 391d5642a83af686f35c228fcd36cb4456d68f44 F src/vdbeInt.h 8ed2272e97bef20c5302c3b2cb4f900e8b5e2642 -F src/vdbeaux.c bceaa0b9756d547c5dba871676e5cfc19f4f4322 +F src/vdbeaux.c 0a0de6f6097125960b02a3c8625fa896cbc61271 F src/where.c efe5d25fe18cd7381722457898cd863e84097a0c F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83 @@ -195,7 +195,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 25643a0137d395572f16cfec3ab3327d913138ba -R 538616d77e95f3accc922466e9ff1ada +P fc94575d77f9865e1553bb70c2e3eda2a0b8669e +R cca19851558a13016ede75fbc3903bef U danielk1977 -Z d2021785293946a744d708c10c8e94e3 +Z 37206e6737045cd1363c44f5a04c63c9 diff --git a/manifest.uuid b/manifest.uuid index 9f5cdd4fb7..10072d4711 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fc94575d77f9865e1553bb70c2e3eda2a0b8669e \ No newline at end of file +5eb94c97657b34ed2df6455e23875e2840743bda \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index c81fb67b62..51f954b70b 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.313 2004/05/21 10:08:54 danielk1977 Exp $ +** $Id: vdbe.c,v 1.314 2004/05/21 10:49:48 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -840,6 +840,48 @@ static void applyAffinity(Mem *pRec, char affinity){ } } +/* +** Write a nice string representation of the contents of cell pMem +** into buffer zBuf, length nBuf. +*/ +#ifndef NDEBUG +void prettyPrintMem(Mem *pMem, char *zBuf, int nBuf){ + char *zCsr = zBuf; + int f = pMem->flags; + + if( f&MEM_Blob ){ + int i; + char c; + if( f & MEM_Dyn ){ + c = 'z'; + assert( (f & (MEM_Static|MEM_Ephem))==0 ); + }else if( f & MEM_Static ){ + c = 't'; + assert( (f & (MEM_Dyn|MEM_Ephem))==0 ); + }else if( f & MEM_Ephem ){ + c = 'e'; + assert( (f & (MEM_Static|MEM_Dyn))==0 ); + }else{ + c = 's'; + } + + zCsr += sprintf(zCsr, "%c[", c); + for(i=0; i<16 && in; i++){ + zCsr += sprintf(zCsr, "%02X ", ((int)pMem->z[i] & 0xFF)); + } + for(i=0; i<16 && in; i++){ + char z = pMem->z[i]; + if( z<32 || z>126 ) *zCsr++ = '.'; + else *zCsr++ = z; + } + + zCsr += sprintf(zCsr, "]"); + } + + *zCsr = '\0'; +} +#endif + /* ** Move data out of a btree key or data field and into a Mem structure. ** The data or key is taken from the entry that pCur is currently pointing @@ -5274,7 +5316,7 @@ default: { fprintf(p->trace, " i:%lld", pTos[i].i); }else if( pTos[i].flags & MEM_Real ){ fprintf(p->trace, " r:%g", pTos[i].r); - }else if( pTos[i].flags & (MEM_Str|MEM_Blob) ){ + }else if( pTos[i].flags & MEM_Str ){ int j, k; char zBuf[100]; zBuf[0] = ' '; @@ -5307,7 +5349,10 @@ default: { zBuf[k++] = 0; fprintf(p->trace, "%s", zBuf); }else{ - fprintf(p->trace, " ???"); + char zBuf[100]; + prettyPrintMem(pTos, zBuf, 100); + fprintf(p->trace, " "); + fprintf(p->trace, zBuf); } } if( rc!=0 ) fprintf(p->trace," rc=%d",rc); diff --git a/src/vdbeaux.c b/src/vdbeaux.c index b6bc0b965d..bf280507c0 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1281,6 +1281,12 @@ void sqlite3VdbeDelete(Vdbe *p){ sqliteFree(p->apVar[i].z); } } + if( p->azColName16 ){ + for(i=0; inResColumn; i++){ + if( p->azColName16[i] ) sqliteFree(p->azColName16[i]); + } + sqliteFree(p->azColName16); + } sqliteFree(p->aOp); sqliteFree(p->aLabel); sqliteFree(p->aStack);