/ Check-in [bb39744f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update the built procedures for the sqlite3_analyzer utility to allow it to be linked with an external sqlite3.o library. Automatically detect a missing dbstat extension and report the compile-time error.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bb39744f4b2b25c10d293e85db7579e2a99c639fdab45e93d1de75952b68b2de
User & Date: drh 2017-10-31 14:56:44
Context
2017-11-01
19:44
Add the checkindex.c extension and the sqlite3_checker utility program used for doing live validation of large databases. check-in: 0c5d18a0 user: drh tags: trunk
07:06
Merge latest trunk changes into this branch. check-in: 985bfc99 user: dan tags: readonly-wal-recovery
2017-10-31
18:15
Merge all recent enhancements from trunk. check-in: 24adf90f user: drh tags: checkindex
14:56
Update the built procedures for the sqlite3_analyzer utility to allow it to be linked with an external sqlite3.o library. Automatically detect a missing dbstat extension and report the compile-time error. check-in: bb39744f user: drh tags: trunk
12:20
Fix redundancies in the makefiles that resulted from moving shell.c over to shell.c.in. check-in: bf09fa68 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/spaceanal.tcl.

     1         -# Run this TCL script using "testfixture" in order get a report that shows
     2         -# how much disk space is used by a particular data to actually store data
            1  +# Run this TCL script using an SQLite-enabled TCL interpreter to get a report
            2  +# on how much disk space is used by a particular data to actually store data
     3      3   # versus how much space is unused.
            4  +#
            5  +# The dbstat virtual table is required.
     4      6   #
     5      7   
     6      8   if {[catch {
     7      9   
     8     10   # Argument $tname is the name of a table within the database opened by
     9     11   # database handle [db]. Return true if it is a WITHOUT ROWID table, or
    10     12   # false otherwise.
................................................................................
   142    144     puts stderr "error trying to open $file_to_analyze: $msg"
   143    145     exit 1
   144    146   }
   145    147   if {$flags(-debug)} {
   146    148     proc dbtrace {txt} {puts $txt; flush stdout;}
   147    149     db trace ::dbtrace
   148    150   }
          151  +
          152  +# Make sure all required compile-time options are available
          153  +#
          154  +if {![db exists {SELECT 1 FROM pragma_compile_options
          155  +                WHERE compile_options='ENABLE_DBSTAT_VTAB'}]} {
          156  +  puts "The SQLite database engine linked with this application\
          157  +        lacks required capabilities. Recompile using the\
          158  +        -DSQLITE_ENABLE_DBSTAT_VTAB compile-time option to fix\
          159  +        this problem."
          160  +  exit 1
          161  +}
   149    162   
   150    163   db eval {SELECT count(*) FROM sqlite_master}
   151    164   set pageSize [expr {wide([db one {PRAGMA page_size}])}]
   152    165   
   153    166   if {$flags(-pageinfo)} {
   154    167     db eval {CREATE VIRTUAL TABLE temp.stat USING dbstat}
   155    168     db eval {SELECT name, path, pageno FROM temp.stat ORDER BY pageno} {

Changes to tool/sqlite3_analyzer.c.in.

    10     10   #define SQLITE_OMIT_DECLTYPE 1
    11     11   #define SQLITE_OMIT_DEPRECATED 1
    12     12   #define SQLITE_OMIT_PROGRESS_CALLBACK 1
    13     13   #define SQLITE_OMIT_SHARED_CACHE 1
    14     14   #define SQLITE_DEFAULT_MEMSTATUS 0
    15     15   #define SQLITE_MAX_EXPR_DEPTH 0
    16     16   #define SQLITE_OMIT_LOAD_EXTENSION 1
           17  +#ifndef USE_EXTERNAL_SQLITE
    17     18   INCLUDE sqlite3.c
           19  +#endif
    18     20   INCLUDE $ROOT/src/tclsqlite.c
    19     21   
    20     22   const char *sqlite3_analyzer_init_proc(Tcl_Interp *interp){
    21     23     (void)interp;
    22     24     return
    23     25   BEGIN_STRING
    24     26   INCLUDE $ROOT/tool/spaceanal.tcl
    25     27   END_STRING
    26     28   ;
    27     29   }