/ Check-in [0abd6529]
Login

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

Overview
Comment:Remove three obsolete and unused files from tool/
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0abd65294e6e8db68e7ce6724f02f17ba1cb3422
User & Date: drh 2015-10-07 00:35:18
Context
2015-10-07
03:07
When running tests on Tcl 8.6 under Windows, skip tests 'uri-1.12.*' due to a change in Tcl behavior related to NTFS ADS (alternate data streams). check-in: 8a0a2aa5 user: mistachkin tags: trunk
02:52
Change mkopcodeh.awk into tool/mkopcodeh.tcl. check-in: ed0ebc46 user: drh tags: omit-awk
00:35
Remove three obsolete and unused files from tool/ check-in: 0abd6529 user: drh tags: trunk
2015-10-06
21:49
Fix typo in comments. No changes to code. check-in: a05f903c user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Deleted tool/diffdb.c.

     1         -/*
     2         -** A utility for printing the differences between two SQLite database files.
     3         -*/
     4         -#include <stdio.h>
     5         -#include <ctype.h>
     6         -#include <sys/types.h>
     7         -#include <sys/stat.h>
     8         -#include <fcntl.h>
     9         -#include <unistd.h>
    10         -#include <stdlib.h>
    11         -
    12         -
    13         -#define PAGESIZE 1024
    14         -static int db1 = -1;
    15         -static int db2 = -1;
    16         -
    17         -int main(int argc, char **argv){
    18         -  int iPg;
    19         -  unsigned char a1[PAGESIZE], a2[PAGESIZE];
    20         -  if( argc!=3 ){
    21         -    fprintf(stderr,"Usage: %s FILENAME FILENAME\n", argv[0]);
    22         -    exit(1);
    23         -  }
    24         -  db1 = open(argv[1], O_RDONLY);
    25         -  if( db1<0 ){
    26         -    fprintf(stderr,"%s: can't open %s\n", argv[0], argv[1]);
    27         -    exit(1);
    28         -  }
    29         -  db2 = open(argv[2], O_RDONLY);
    30         -  if( db2<0 ){
    31         -    fprintf(stderr,"%s: can't open %s\n", argv[0], argv[2]);
    32         -    exit(1);
    33         -  }
    34         -  iPg = 1;
    35         -  while( read(db1, a1, PAGESIZE)==PAGESIZE && read(db2,a2,PAGESIZE)==PAGESIZE ){
    36         -    if( memcmp(a1,a2,PAGESIZE) ){
    37         -      printf("Page %d\n", iPg);
    38         -    }
    39         -    iPg++;
    40         -  }
    41         -  printf("%d pages checked\n", iPg-1);
    42         -  close(db1);
    43         -  close(db2);
    44         -}

Deleted tool/opcodeDoc.awk.

     1         -#
     2         -# Extract opcode documentation for sqliteVdbe.c and generate HTML
     3         -#
     4         -BEGIN {
     5         -  print "<html><body bgcolor=white>"
     6         -  print "<h1>SQLite Virtual Database Engine Opcodes</h1>"
     7         -  print "<table>"
     8         -}
     9         -/ Opcode: /,/\*\// {
    10         -  if( $2=="Opcode:" ){
    11         -    printf "<tr><td>%s&nbsp;%s&nbsp;%s&nbsp;%s</td>\n<td>\n", $3, $4, $5, $6
    12         -  }else if( $1=="*/" ){
    13         -    printf "</td></tr>\n"
    14         -  }else if( NF>1 ){
    15         -    sub(/^ *\*\* /,"")
    16         -    gsub(/</,"&lt;")
    17         -    gsub(/&/,"&amp;")
    18         -    print
    19         -  }
    20         -}
    21         -END {
    22         -  print "</table></body></html>"
    23         -}

Deleted tool/space_used.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
     3         -# versus how much space is unused.
     4         -#
     5         -
     6         -# Get the name of the database to analyze
     7         -#
     8         -if {[llength $argv]!=1} {
     9         -  puts stderr "Usage: $argv0 database-name"
    10         -  exit 1
    11         -}
    12         -set file_to_analyze [lindex $argv 0]
    13         -
    14         -# Open the database
    15         -#
    16         -sqlite db [lindex $argv 0]
    17         -set DB [btree_open [lindex $argv 0]]
    18         -
    19         -# Output the schema for the generated report
    20         -#
    21         -puts \
    22         -{BEGIN;
    23         -CREATE TABLE space_used(
    24         -   name clob,        -- Name of a table or index in the database file
    25         -   is_index boolean, -- TRUE if it is an index, false for a table
    26         -   payload int,      -- Total amount of data stored in this table or index
    27         -   pri_pages int,    -- Number of primary pages used
    28         -   ovfl_pages int,   -- Number of overflow pages used
    29         -   pri_unused int,   -- Number of unused bytes on primary pages
    30         -   ovfl_unused int   -- Number of unused bytes on overflow pages
    31         -);}
    32         -
    33         -# This query will be used to find the root page number for every index and
    34         -# table in the database.
    35         -#
    36         -set sql {
    37         -  SELECT name, type, rootpage FROM sqlite_master
    38         -  UNION ALL
    39         -  SELECT 'sqlite_master', 'table', 2
    40         -  ORDER BY 1
    41         -}
    42         -
    43         -# Initialize variables used for summary statistics.
    44         -#
    45         -set total_size 0
    46         -set total_primary 0
    47         -set total_overflow 0
    48         -set total_unused_primary 0
    49         -set total_unused_ovfl 0
    50         -
    51         -# Analyze every table in the database, one at a time.
    52         -#
    53         -foreach {name type rootpage} [db eval $sql] {
    54         -  set cursor [btree_cursor $DB $rootpage 0]
    55         -  set go [btree_first $cursor]
    56         -  set size 0
    57         -  catch {unset pg_used}
    58         -  set unused_ovfl 0
    59         -  set n_overflow 0
    60         -  while {$go==0} {
    61         -    set payload [btree_payload_size $cursor]
    62         -    incr size $payload
    63         -    set stat [btree_cursor_dump $cursor]
    64         -    set pgno [lindex $stat 0]
    65         -    set freebytes [lindex $stat 4]
    66         -    set pg_used($pgno) $freebytes
    67         -    if {$payload>238} {
    68         -      set n [expr {($payload-238+1019)/1020}]
    69         -      incr n_overflow $n
    70         -      incr unused_ovfl [expr {$n*1020+238-$payload}]
    71         -    }
    72         -    set go [btree_next $cursor]
    73         -  }
    74         -  btree_close_cursor $cursor
    75         -  set n_primary [llength [array names pg_used]]
    76         -  set unused_primary 0
    77         -  foreach x [array names pg_used] {incr unused_primary $pg_used($x)}
    78         -  regsub -all ' $name '' name
    79         -  puts -nonewline "INSERT INTO space_used VALUES('$name'"
    80         -  puts -nonewline ",[expr {$type=="index"}]"
    81         -  puts ",$size,$n_primary,$n_overflow,$unused_primary,$unused_ovfl);"
    82         -  incr total_size $size
    83         -  incr total_primary $n_primary
    84         -  incr total_overflow $n_overflow
    85         -  incr total_unused_primary $unused_primary
    86         -  incr total_unused_ovfl $unused_ovfl
    87         -}
    88         -
    89         -# Output summary statistics:
    90         -#
    91         -puts "-- Total payload size: $total_size"
    92         -puts "-- Total pages used: $total_primary primary and $total_overflow overflow"
    93         -set file_pgcnt [expr {[file size [lindex $argv 0]]/1024}]
    94         -puts -nonewline "-- Total unused bytes on primary pages: $total_unused_primary"
    95         -if {$total_primary>0} {
    96         -  set upp [expr {$total_unused_primary/$total_primary}]
    97         -  puts " (avg $upp bytes/page)"
    98         -} else {
    99         -  puts ""
   100         -}
   101         -puts -nonewline "-- Total unused bytes on overflow pages: $total_unused_ovfl"
   102         -if {$total_overflow>0} {
   103         -  set upp [expr {$total_unused_ovfl/$total_overflow}]
   104         -  puts " (avg $upp bytes/page)"
   105         -} else {
   106         -  puts ""
   107         -}
   108         -set n_free [expr {$file_pgcnt-$total_primary-$total_overflow}]
   109         -if {$n_free>0} {incr n_free -1}
   110         -puts "-- Total pages on freelist: $n_free"
   111         -puts "COMMIT;"