-C Fix\sthe\scolumn\swidth\sdeduction\slogic\sin\sthe\scommand-line\sshell\sto\saccount\nfor\smulti-byte\sutf8\scharacters.
-D 2017-06-05T12:29:26.935
+C For\sthe\skvtest\sutility,\sadd\sthe\s--vacuum\soption\sto\s"kvtest\sstat"\sand\salso\nrun\sPRAGMA\sintegrity_check\swith\s"kvtest\sstat".
+D 2017-06-05T13:28:17.990
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
F test/json103.test c5f6b85e69de05f6b3195f9f9d5ce9cd179099a0
F test/json104.test 877d5845f6303899b7889ea5dd1bea99076e3100574d5c536082245c5805dcaa
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
-F test/kvtest.c d6c222497db645838afe6c48e173e337ca24b97be4fd4d1dc05c38cdb4af560e
+F test/kvtest.c 4e274696ee1cc588be38ce2d50015b564a79c076084126839a4599bf705fbd15
F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200
F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P ead29f9cb757a5f9921086e3bb4998f60e0d6cfcf41ef0f9a230b365b6226947
-R a0798b817cd3131e3fcd85873638461d
+P ed0842c156ab1a78d5d00d3a55dab5e3f08cd349328d606724688f1528df3f6b
+R 469299041958944268a194091870ce94
U drh
-Z 989f90c118a47ae7c1914060875ac3d8
+Z 36dcea3e9252ed2e301fc8394580d033
" files are in the top-level directory with names like 000000, 000001,\n"
" 000002, and so forth.\n"
"\n"
-" kvtest stat DBFILE\n"
+" kvtest stat DBFILE [options]\n"
"\n"
-" Display summary information about DBFILE\n"
+" Display summary information about DBFILE. Options:\n"
+"\n"
+" --vacuum Run VACUUM on the database file\n"
"\n"
" kvtest run DBFILE [options]\n"
"\n"
sqlite3 *db;
char *zSql;
sqlite3_stmt *pStmt;
+ int doVacuum = 0;
assert( strcmp(argv[1],"stat")==0 );
assert( argc>=3 );
char *z = argv[i];
if( z[0]!='-' ) fatalError("unknown argument: \"%s\"", z);
if( z[1]=='-' ) z++;
+ if( strcmp(z, "-vacuum")==0 ){
+ doVacuum = 1;
+ continue;
+ }
fatalError("unknown option: \"%s\"", argv[i]);
}
rc = sqlite3_open(zDb, &db);
if( rc ){
fatalError("cannot open database \"%s\": %s", zDb, sqlite3_errmsg(db));
}
+ if( doVacuum ){
+ printf("Vacuuming...."); fflush(stdout);
+ sqlite3_exec(db, "VACUUM", 0, 0, 0);
+ printf(" done\n");
+ }
zSql = sqlite3_mprintf(
"SELECT count(*), min(length(v)), max(length(v)), avg(length(v))"
" FROM kv"
printf("Page-count: %8d\n", sqlite3_column_int(pStmt, 0));
}
sqlite3_finalize(pStmt);
+ zSql = sqlite3_mprintf("PRAGMA freelist_count");
+ rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
+ if( rc ) fatalError("cannot prepare SQL [%s]: %s", zSql, sqlite3_errmsg(db));
+ sqlite3_free(zSql);
+ if( sqlite3_step(pStmt)==SQLITE_ROW ){
+ printf("Freelist-count: %8d\n", sqlite3_column_int(pStmt, 0));
+ }
+ sqlite3_finalize(pStmt);
+ rc = sqlite3_prepare_v2(db, "PRAGMA integrity_check(10)", -1, &pStmt, 0);
+ if( rc ) fatalError("cannot prepare integrity check: %s", sqlite3_errmsg(db));
+ while( sqlite3_step(pStmt)==SQLITE_ROW ){
+ printf("Integrity-check: %s\n", sqlite3_column_text(pStmt, 0));
+ }
+ sqlite3_finalize(pStmt);
sqlite3_close(db);
return 0;
}