-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-C Increment\sthe\sversion\snumber\sto\s3.7.5.
-D 2011-01-05T13:43:24
+C Enhancements\sto\sthe\s"showdb"\sdebugging\stool.\s\sAdd\sthe\sability\sto\sdisplay\nthe\scontent\sof\sa\scell.
+D 2011-01-05T21:20:52
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in de6498556d536ae60bb8bb10e8c1ba011448658c
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F tool/shell3.test 4fad469e8003938426355afdf34155f08c587836
F tool/shell4.test 35f9c3d452b4e76d5013c63e1fd07478a62f14ce
F tool/shell5.test 62bfaf9267296da1b91e4b1c03e44e7b393f6a94
-F tool/showdb.c c7a978cf525ef0f8bc2fd29cd52108dd1dfa605a
+F tool/showdb.c 1496ea81d21072633fd559e3f39262d2392dc069
F tool/showjournal.c b62cecaab86a4053d944c276bb5232e4d17ece02
F tool/showwal.c f09e5a80a293919290ec85a6a37c85a5ddcf37d9
F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P fc67adea414320e0c0b24054f76070cfaeebb401
-R b51bcff3419da43413c66f28a4b457e3
+P 9ec3896e2fda5b04e609300463dc5b6e79d6cff1
+R e186367957c82f3f2e1fafed8df69dbf
U drh
-Z 2557ea75f46cff086921c5cb180d1215
+Z cd277adeb367840ebc217b239c3df117
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-iD8DBQFNJHWAoxKgR168RlERAoy1AJ9uLWl2o3iLADUipTYKkyjr8TgZUACeN166
-VPCKM2cZ5hq8bpokjQkRLp4=
-=u7CG
+iD8DBQFNJOC3oxKgR168RlERAqoaAJ0WxGOj5UtyDg8CWCSQ3WoqPL2v+ACggqUJ
+bS9FcHu8epTJHsJhYAEdEvE=
+=TSIi
-----END PGP SIGNATURE-----
print_decode_line(aData, 96, 4, "SQLite version number");
}
+/*
+** Describe cell content.
+*/
+static int describeContent(
+ unsigned char *a,
+ char *zDesc
+){
+ int nDesc = 0;
+ int n, i, j;
+ i64 x, v;
+ const unsigned char *pData;
+ char sep = ' ';
+
+ n = decodeVarint(a, &x);
+ pData = &a[x];
+ a += n;
+ i = x - n;
+ while( i>0 ){
+ n = decodeVarint(a, &x);
+ a += n;
+ i -= n;
+ zDesc[0] = sep;
+ sep = ',';
+ nDesc++;
+ zDesc++;
+ if( x==0 ){
+ sprintf(zDesc, "null");
+ }else if( x>=1 && x<=6 ){
+ v = (signed char)pData[0];
+ pData++;
+ switch( x ){
+ case 6: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2;
+ case 5: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2;
+ case 4: v = (v<<8) + pData[0]; pData++;
+ case 3: v = (v<<8) + pData[0]; pData++;
+ case 2: v = (v<<8) + pData[0]; pData++;
+ }
+ sprintf(zDesc, "%lld", v);
+ }else if( x==7 ){
+ sprintf(zDesc, "real");
+ pData += 8;
+ }else if( x==8 ){
+ sprintf(zDesc, "0");
+ }else if( x==9 ){
+ sprintf(zDesc, "1");
+ }else if( x>=12 ){
+ int size = (x-12)/2;
+ if( x&1 ){
+ sprintf(zDesc, "blob(%d)", size);
+ }else{
+ sprintf(zDesc, "text(%d)", size);
+ }
+ pData += size;
+ }
+ j = strlen(zDesc);
+ zDesc += j;
+ nDesc += j;
+ }
+ return nDesc;
+}
+
+
/*
** Create a description for a single cell.
*/
-static int describeCell(unsigned char cType, unsigned char *a, char **pzDesc){
+static int describeCell(
+ unsigned char cType, /* Page type */
+ unsigned char *a, /* Cell content */
+ int showCellContent, /* Show cell content if true */
+ char **pzDesc /* Store description here */
+){
int i;
int nDesc = 0;
int n = 0;
int leftChild;
i64 nPayload;
i64 rowid;
- static char zDesc[100];
+ int nLocal;
+ static char zDesc[1000];
i = 0;
if( cType<=5 ){
leftChild = ((a[0]*256 + a[1])*256 + a[2])*256 + a[3];
a += 4;
n += 4;
- sprintf(zDesc, "left-child: %d ", leftChild);
+ sprintf(zDesc, "lx: %d ", leftChild);
nDesc = strlen(zDesc);
}
if( cType!=5 ){
i = decodeVarint(a, &nPayload);
a += i;
n += i;
- sprintf(&zDesc[nDesc], "sz: %lld ", nPayload);
+ sprintf(&zDesc[nDesc], "n: %lld ", nPayload);
nDesc += strlen(&zDesc[nDesc]);
}
if( cType==5 || cType==13 ){
i = decodeVarint(a, &rowid);
a += i;
n += i;
- sprintf(&zDesc[nDesc], "rowid: %lld ", rowid);
+ sprintf(&zDesc[nDesc], "r: %lld ", rowid);
nDesc += strlen(&zDesc[nDesc]);
}
+ if( showCellContent && cType!=5 ){
+ nDesc += describeContent(a, &zDesc[nDesc]);
+ }
*pzDesc = zDesc;
return n;
}
/*
** Decode a btree page
*/
-static void decode_btree_page(unsigned char *a, int pgno, int hdrSize){
+static void decode_btree_page(
+ unsigned char *a, /* Page content */
+ int pgno, /* Page number */
+ int hdrSize, /* Size of the page header. 0 or 100 */
+ char *zArgs /* Flags to control formatting */
+){
const char *zType = "unknown";
int nCell;
int i;
int iCellPtr;
+ int showCellContent = 0;
switch( a[0] ){
case 2: zType = "index interior node"; break;
case 5: zType = "table interior node"; break;
case 10: zType = "index leaf"; break;
case 13: zType = "table leaf"; break;
}
+ while( zArgs[0] ){
+ switch( zArgs[0] ){
+ case 'c': showCellContent = 1; break;
+ }
+ zArgs++;
+ }
printf("Decode of btree page %d:\n", pgno);
print_decode_line(a, 0, 1, zType);
print_decode_line(a, 1, 2, "Offset to first freeblock");
nCell = a[3]*256 + a[4];
print_decode_line(a, 5, 2, "Offset to cell content area");
print_decode_line(a, 7, 1, "Fragmented byte count");
+ if( nCell>0 ){
+ printf(" key: lx=left-child n=payload-size r=rowid\n");
+ }
if( a[0]==2 || a[0]==5 ){
print_decode_line(a, 8, 4, "Right child");
iCellPtr = 12;
int cofst = iCellPtr + i*2;
char *zDesc;
cofst = a[cofst]*256 + a[cofst+1];
- describeCell(a[0], &a[cofst-hdrSize], &zDesc);
+ describeCell(a[0], &a[cofst-hdrSize], showCellContent, &zDesc);
printf(" %03x: cell[%d] %s\n", cofst, i, zDesc);
}
}
nByte = pagesize;
}
a = getContent(ofst, nByte);
- decode_btree_page(a, iStart, hdrSize);
+ decode_btree_page(a, iStart, hdrSize, &zLeft[1]);
free(a);
continue;
}else if( zLeft && zLeft[0]=='t' ){