Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | For the kvtest utility, add the --vacuum option to "kvtest stat" and also run PRAGMA integrity_check with "kvtest stat". |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f3c25df4562efda2adeb211a4cc89324 |
User & Date: | drh 2017-06-05 13:28:17.990 |
Context
2017-06-05
| ||
16:33 | Fix a bug in test_fs.c that occurs when the first component of a path contains a GLOB or LIKE escape character. (check-in: 73c70590d7 user: dan tags: trunk) | |
13:28 | For the kvtest utility, add the --vacuum option to "kvtest stat" and also run PRAGMA integrity_check with "kvtest stat". (check-in: f3c25df456 user: drh tags: trunk) | |
12:29 | Fix the column width deduction logic in the command-line shell to account for multi-byte utf8 characters. (check-in: ed0842c156 user: drh tags: trunk) | |
Changes
Changes to test/kvtest.c.
︙ | ︙ | |||
77 78 79 80 81 82 83 | " files in DIRECTORY. DIRECTORY is created if it does not previously\n" " exist. If the --tree option is used, then the blobs are written\n" " into a hierarchy of directories, using names like 00/00/00,\n" " 00/00/01, 00/00/02, and so forth. Without the --tree option, all\n" " files are in the top-level directory with names like 000000, 000001,\n" " 000002, and so forth.\n" "\n" | | | > > | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | " files in DIRECTORY. DIRECTORY is created if it does not previously\n" " exist. If the --tree option is used, then the blobs are written\n" " into a hierarchy of directories, using names like 00/00/00,\n" " 00/00/01, 00/00/02, and so forth. Without the --tree option, all\n" " files are in the top-level directory with names like 000000, 000001,\n" " 000002, and so forth.\n" "\n" " kvtest stat DBFILE [options]\n" "\n" " Display summary information about DBFILE. Options:\n" "\n" " --vacuum Run VACUUM on the database file\n" "\n" " kvtest run DBFILE [options]\n" "\n" " Run a performance test. DBFILE can be either the name of a\n" " database or a directory containing sample files. Options:\n" "\n" " --asc Read blobs in ascending order\n" |
︙ | ︙ | |||
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | */ static int statMain(int argc, char **argv){ char *zDb; int i, rc; sqlite3 *db; char *zSql; sqlite3_stmt *pStmt; assert( strcmp(argv[1],"stat")==0 ); assert( argc>=3 ); zDb = argv[2]; for(i=3; i<argc; i++){ char *z = argv[i]; if( z[0]!='-' ) fatalError("unknown argument: \"%s\"", z); if( z[1]=='-' ) z++; fatalError("unknown option: \"%s\"", argv[i]); } rc = sqlite3_open(zDb, &db); if( rc ){ fatalError("cannot open database \"%s\": %s", zDb, sqlite3_errmsg(db)); } zSql = sqlite3_mprintf( "SELECT count(*), min(length(v)), max(length(v)), avg(length(v))" " FROM kv" ); rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); if( rc ) fatalError("cannot prepare SQL [%s]: %s", zSql, sqlite3_errmsg(db)); sqlite3_free(zSql); | > > > > > > > > > > | 381 382 383 384 385 386 387 388 389 390 391 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 | */ static int statMain(int argc, char **argv){ char *zDb; int i, rc; sqlite3 *db; char *zSql; sqlite3_stmt *pStmt; int doVacuum = 0; assert( strcmp(argv[1],"stat")==0 ); assert( argc>=3 ); zDb = argv[2]; for(i=3; i<argc; i++){ 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" ); rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); if( rc ) fatalError("cannot prepare SQL [%s]: %s", zSql, sqlite3_errmsg(db)); sqlite3_free(zSql); |
︙ | ︙ | |||
424 425 426 427 428 429 430 431 432 433 434 435 436 437 | zSql = sqlite3_mprintf("PRAGMA page_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("Page-count: %8d\n", sqlite3_column_int(pStmt, 0)); } sqlite3_finalize(pStmt); sqlite3_close(db); return 0; } /* ** remember(V,PTR) | > > > > > > > > > > > > > > | 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 | zSql = sqlite3_mprintf("PRAGMA page_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("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; } /* ** remember(V,PTR) |
︙ | ︙ |