1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
--- Makefile.in
+++ Makefile.in
@@ -163,8 +163,8 @@
#
LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
- callback.lo complete.lo ctime.lo date.lo db_pragma.lo delete.lo \
- expr.lo fault.lo fkey.lo \
+ callback.lo complete.lo ctime.lo date.lo db_pragma.lo db_shell.lo \
+ delete.lo expr.lo fault.lo fkey.lo \
fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo fts3_porter.lo \
fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo fts3_write.lo \
func.lo global.lo hash.lo \
@@ -208,6 +208,7 @@ SRC = \
$(TOP)/src/ctime.c \
$(TOP)/src/date.c \
$(TOP)/../adapter/db_pragma.c \
+ $(TOP)/../adapter/db_shell.c \
$(TOP)/src/delete.c \
$(TOP)/src/expr.c \
$(TOP)/src/fault.c \
@@ -583,6 +584,10 @@ db_pragma.lo: $(TOP)/../adapter/db_pragm
$(TOP)/../adapter/btreeInt.h
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/../adapter/db_pragma.c
+db_shell.lo: $(TOP)/../adapter/db_shell.c $(HDR) \
+ $(TOP)/../adapter/btreeInt.h
+ $(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/../adapter/db_shell.c
+
delete.lo: $(TOP)/src/delete.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/delete.c
--- src/shell.c
+++ src/shell.c
@@ -1368,6 +1368,17 @@ static char zHelp[] =
" LIKE pattern TABLE.\n"
".separator STRING Change separator used by output mode and .import\n"
".show Show the current values for various settings\n"
+ ".stat ?ITEM? Print statistics\n"
+ " If ITEM=':env:', print statistics for the\n"
+ " Berkeley DB environment.\n"
+ " If ITEM=':rep:', print a summary of replication\n"
+ " statistics for the Berkeley DB environment.\n"
+ " If ITEM is the name of a table or index, print\n"
+ " statistics for the table or index.\n"
+ " If ITEM is not specified, print statistics for\n"
+ " the Berkeley DB environment followed by\n"
+ " statistics for all tables and indexes within the\n"
+ " database.\n"
".stats ON|OFF Turn stats on or off\n"
".tables ?TABLE? List names of tables\n"
" If TABLE specified, only list tables matching\n"
@@ -2128,6 +2137,27 @@ static int do_meta_command(char *zLine,
}
fprintf(p->out,"\n");
}else
+
+ if( c=='s' && strncmp(azArg[0], "stat", n)==0 ){
+ extern int bdbSqlDbStatPrint(sqlite3 *, FILE *, char *);
+ extern int bdbSqlEnvStatPrint(sqlite3 *db, FILE *);
+ extern int bdbSqlRepSumStatPrint(sqlite3 *db, FILE *);
+
+ open_db(p);
+
+ if (nArg == 1 || nArg == 2 && strcmp(azArg[1], ":env:") == 0)
+ rc = bdbSqlEnvStatPrint(p->db, p->out);
+ else if (nArg == 2 && strcmp(azArg[1], ":rep:") == 0)
+ rc = bdbSqlRepSumStatPrint(p->db, p->out);
+ if (rc != SQLITE_OK) {
+ fprintf(stderr, "Error: environment not created yet\n");
+ rc = 1;
+ }
+ else if (nArg == 1)
+ rc = bdbSqlDbStatPrint(p->db, p->out, NULL);
+ else
+ rc = bdbSqlDbStatPrint(p->db, p->out, azArg[1]);
+ }else
if( c=='s' && strncmp(azArg[0], "stats", n)==0 && nArg>1 && nArg<3 ){
p->statsOn = booleanValue(azArg[1]);
--- tool/mksqlite3c.tcl
+++ tool/mksqlite3c.tcl
@@ -251,6 +251,7 @@ foreach file {
btree.c
backup.c
db_pragma.c
+ db_shell.c
vdbemem.c
vdbeaux.c
|