-C New\stestcase()\smacros\sto\sensure\scoverage\sof\sthe\sORDER\sBY\sLIMIT\soptimization\ncode\sin\swhere.c.
-D 2016-10-12T15:15:30.391
+C Add\sto\ssqlite3_analyzer\scommand-line\soptions\s--version\sand\s--tclsh,\sand\salso\nthe\sundocumented\s--debug\soption.
+D 2016-10-12T18:26:26.364
F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f
F tool/showstat4.c bda40d6e395df7edb6e9ea630784d3d762c35b4b
F tool/showwal.c ec79959834f7b21f1e0a2aa52bb7c056d2203977
F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe
-F tool/spaceanal.tcl 85d90e6674d8298e3eaf82dbcef3abc2d5317f3e
+F tool/spaceanal.tcl ab7d9bf68062907282a64b3e12ccbfad47193c5a
F tool/speed-check.sh da6ce45957c509ba6343fe3fef167e7e2b306262
F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
F tool/speedtest16.c ecb6542862151c3e6509bbc00509b234562ae81e
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 8e2b25f9b8a7ed087d3cece74239814bee19429e
-R 85b771c181ab2a587da3b9154662733d
+P 61f0526978af667781c57bcc87510e4524efd0d8
+R 939be1793993bb5a0733cfe788e02f4d
U drh
-Z ed0e3333d86697e18712f68be162b390
+Z 3046f41ed5ee9baf8f6c825aaff1459e
return 0
}
+# Read and run TCL commands from standard input. Used to implement
+# the --tclsh option.
+#
+proc tclsh {} {
+ set line {}
+ while {![eof stdin]} {
+ if {$line!=""} {
+ puts -nonewline "> "
+ } else {
+ puts -nonewline "% "
+ }
+ flush stdout
+ append line [gets stdin]
+ if {[info complete $line]} {
+ if {[catch {uplevel #0 $line} result]} {
+ puts stderr "Error: $result"
+ } elseif {$result!=""} {
+ puts $result
+ }
+ set line {}
+ } else {
+ append line \n
+ }
+ }
+}
+
+
# Get the name of the database to analyze
#
proc usage {} {
Options:
- --stats Output SQL text that creates a new database containing
- statistics about the database that was analyzed
+ --pageinfo Show how each page of the database-file is used
+
+ --stats Output SQL text that creates a new database containing
+ statistics about the database that was analyzed
+
+ --tclsh Run the built-in TCL interpreter interactively (for debugging)
- --pageinfo Show how each page of the database-file is used
+ --version Show the version number of SQLite
}
exit 1
}
set file_to_analyze {}
set flags(-pageinfo) 0
set flags(-stats) 0
+set flags(-debug) 0
append argv {}
foreach arg $argv {
if {[regexp {^-+pageinfo$} $arg]} {
set flags(-pageinfo) 1
} elseif {[regexp {^-+stats$} $arg]} {
set flags(-stats) 1
+ } elseif {[regexp {^-+debug$} $arg]} {
+ set flags(-debug) 1
+ } elseif {[regexp {^-+tclsh$} $arg]} {
+ tclsh
+ exit 0
+ } elseif {[regexp {^-+version$} $arg]} {
+ sqlite3 mem :memory:
+ puts [mem one {SELECT sqlite_version()||' '||sqlite_source_id()}]
+ mem close
+ exit 0
} elseif {[regexp {^-} $arg]} {
puts stderr "Unknown option: $arg"
usage
puts stderr "error trying to open $file_to_analyze: $msg"
exit 1
}
+if {$flags(-debug)} {
+ proc dbtrace {txt} {puts $txt; flush stdout;}
+ db trace ::dbtrace
+}
db eval {SELECT count(*) FROM sqlite_master}
set pageSize [expr {wide([db one {PRAGMA page_size}])}]
exit 0
}
+
# In-memory database for collecting statistics. This script loops through
# the tables and indices in the database being analyzed, adding a row for each
# to an in-memory database (for which the schema is shown below). It then
# queries the in-memory db to produce the space-analysis report.
#
sqlite3 mem :memory:
+if {$flags(-debug)} {
+ proc dbtrace {txt} {puts $txt; flush stdout;}
+ mem trace ::dbtrace
+}
set tabledef {CREATE TABLE space_used(
name clob, -- Name of a table or index in the database file
tblname clob, -- Name of associated table