Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the "kvdump" pragma for debugging. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4746d99cc1f7154f7dfcc4f5b1b7f609 |
User & Date: | drh 2012-02-22 14:20:33.348 |
Context
2012-02-23
| ||
17:56 | Modify the key encoding so that integer values use one less byte of space. check-in: af96bd359f user: drh tags: trunk | |
2012-02-22
| ||
14:20 | Add the "kvdump" pragma for debugging. check-in: 4746d99cc1 user: drh tags: trunk | |
13:15 | CREATE INDEX runs, though index queries does not work yet so there is no way to test that the index was correctly created. check-in: 70f15a5352 user: drh tags: trunk | |
Changes
Changes to src/pragma.c.
︙ | ︙ | |||
519 520 521 522 523 524 525 526 527 528 529 530 531 532 | sqlite4VdbeSetNumCols(v, 1); pParse->nMem = 1; sqlite4VdbeSetColName(v, 0, COLNAME_NAME, "compile_option", SQLITE_STATIC); while( (zOpt = sqlite4_compileoption_get(i++))!=0 ){ sqlite4VdbeAddOp4(v, OP_String8, 0, 1, 0, zOpt, 0); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 1); } }else #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ /* ** PRAGMA shrink_memory ** | > > > > > > > > > > > | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | sqlite4VdbeSetNumCols(v, 1); pParse->nMem = 1; sqlite4VdbeSetColName(v, 0, COLNAME_NAME, "compile_option", SQLITE_STATIC); while( (zOpt = sqlite4_compileoption_get(i++))!=0 ){ sqlite4VdbeAddOp4(v, OP_String8, 0, 1, 0, zOpt, 0); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 1); } }else #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ #ifdef SQLITE_DEBUG /* ** PRAGMA kvdump ** ** Print an ascii rendering of the complete content of the database file. */ if( sqlite4StrICmp(zLeft, "kvdump")==0 ){ sqlite4KVStoreDump(db->aDb[0].pKV); }else #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ /* ** PRAGMA shrink_memory ** |
︙ | ︙ |
Changes to src/storage.c.
︙ | ︙ | |||
392 393 394 395 396 397 398 | sqlite4DbFree(db, aNew); } } sqlite4KVCursorClose(pCur); } return rc; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | sqlite4DbFree(db, aNew); } } sqlite4KVCursorClose(pCur); } return rc; } #if defined(SQLITE_DEBUG) /* ** Output binary data for debugging display purposes. */ static void outputBinary( KVByteArray *a, KVSize n, const char *zPrefix ){ int i, j; char zOut[80]; static const char base16[] = "0123456789abcdef"; memset(zOut, ' ', sizeof(zOut)); zOut[16*3+3+16] = 0; while( n>=0 ){ for(i=0; i<16 && i<n; i++){ unsigned char v = a[i]; zOut[i*3] = base16[v>>4]; zOut[i*3+1] = base16[v&0xf]; zOut[16*3+3+i] = (v>=0x20 && v<=0x7e) ? v : '.'; } while( i<16 ){ zOut[i*3] = ' '; zOut[i*3+1] = ' '; zOut[16*3+3+i] = ' '; i++; } sqlite4DebugPrintf("%.3s %s\n", zPrefix, zOut); n -= 16; if( n<=0 ) break; a += 16; zPrefix = " "; } } /* ** Dump the entire content of a key-value database */ void sqlite4KVStoreDump(KVStore *pStore){ int rc; int nRow = 0; KVCursor *pCur; KVSize nKey, nData; KVByteArray *aKey, *aData; static const KVByteArray aProbe[] = { 0x00 }; rc = sqlite4KVStoreOpenCursor(pStore, &pCur); if( rc==SQLITE_OK ){ rc = sqlite4KVCursorSeek(pCur, aProbe, 1, +1); while( rc!=SQLITE_NOTFOUND ){ rc = sqlite4KVCursorKey(pCur, &aKey, &nKey); if( rc ) break; if( nRow>0 ) sqlite4DebugPrintf("\n"); nRow++; outputBinary(aKey, nKey, "K: "); rc = sqlite4KVCursorData(pCur, 0, -1, &aData, &nData); if( rc ) break; outputBinary(aData, nData, "V: "); rc = sqlite4KVCursorNext(pCur); } sqlite4KVCursorClose(pCur); } } #endif /* SQLITE_DEBUG */ |
Changes to src/storage.h.
︙ | ︙ | |||
219 220 221 222 223 224 225 | int sqlite4KVStoreCommit(KVStore *p, int iLevel); int sqlite4KVStoreRollback(KVStore *p, int iLevel); int sqlite4KVStoreRevert(KVStore *p, int iLevel); int sqlite4KVStoreClose(KVStore *p); int sqlite4KVStoreGetMeta(KVStore *p, int, int, unsigned int*); int sqlite4KVStorePutMeta(sqlite4*, KVStore *p, int, int, unsigned int*); | > > > | 219 220 221 222 223 224 225 226 227 228 | int sqlite4KVStoreCommit(KVStore *p, int iLevel); int sqlite4KVStoreRollback(KVStore *p, int iLevel); int sqlite4KVStoreRevert(KVStore *p, int iLevel); int sqlite4KVStoreClose(KVStore *p); int sqlite4KVStoreGetMeta(KVStore *p, int, int, unsigned int*); int sqlite4KVStorePutMeta(sqlite4*, KVStore *p, int, int, unsigned int*); #ifdef SQLITE_DEBUG void sqlite4KVStoreDump(KVStore *p); #endif |