/ Check-in [3a261f38]
Login

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

Overview
Comment:Minor tweaks to the TCL code for sqlite3_analyzer.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3a261f383f11d839d3a23d454b4422298bef9c88
User & Date: drh 2011-09-21 20:10:42
Context
2011-09-22
00:06
Integrate build changes for sqlite3_analyzer into the MSVC makefile. Also, more cleanup of build files, including sqlite3_analyzer, for all makefiles. check-in: af1c5718 user: mistachkin tags: trunk
2011-09-21
20:10
Minor tweaks to the TCL code for sqlite3_analyzer. check-in: 3a261f38 user: drh tags: trunk
18:29
Remove unnecessary dependencies from the sqlite3_analyzer targets in makefiles. check-in: 0bd8fd35 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/spaceanal.tcl.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
..
62
63
64
65
66
67
68
69
70
71

72
73
74
75
76
77
78
79
80

# Open the database
#
sqlite3 db $file_to_analyze
register_dbstat_vtab db

set pageSize [db one {PRAGMA page_size}]

#set DB [btree_open $file_to_analyze 1000 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:
................................................................................
   ovfl_unused int,  -- Number of unused bytes on overflow pages
   gap_cnt int       -- Number of gaps in the page layout
);}
mem eval $tabledef

# Create a temporary "dbstat" virtual table.
#
db eval { 
  CREATE VIRTUAL TABLE temp.stat USING dbstat;
  CREATE TEMP TABLE dbstat AS SELECT * FROM temp.stat ORDER BY name, path;

  DROP TABLE temp.stat;
}

proc isleaf {pagetype is_index} {
  return [expr {$pagetype == "leaf" || ($pagetype == "internal" && $is_index)}]
}
proc isoverflow {pagetype is_index} {
  return [expr {$pagetype == "overflow"}]
}







|
<







 







<
|
|
>
|
<







31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
..
61
62
63
64
65
66
67

68
69
70
71

72
73
74
75
76
77
78

# Open the database
#
sqlite3 db $file_to_analyze
register_dbstat_vtab db

set pageSize [db one {PRAGMA page_size}]
db eval {SELECT count(*) FROM sqlite_master}


# 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:
................................................................................
   ovfl_unused int,  -- Number of unused bytes on overflow pages
   gap_cnt int       -- Number of gaps in the page layout
);}
mem eval $tabledef

# Create a temporary "dbstat" virtual table.
#

db eval {CREATE VIRTUAL TABLE temp.stat USING dbstat}
db eval {CREATE TEMP TABLE dbstat AS SELECT * FROM temp.stat
         ORDER BY name, path}
db eval {DROP TABLE temp.stat}


proc isleaf {pagetype is_index} {
  return [expr {$pagetype == "leaf" || ($pagetype == "internal" && $is_index)}]
}
proc isoverflow {pagetype is_index} {
  return [expr {$pagetype == "overflow"}]
}