/ Check-in [d4e37767]
Login

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

Overview
Comment:Update the schemalint.tcl script so that the argument to a -select option may be either an SQL statement or the name of a file containing an SQL statement
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schemalint
Files: files | file ages | folders
SHA1: d4e37767671dc946b8a21d0158fc3044e36f0c7e
User & Date: dan 2016-01-22 14:32:20
Context
2016-01-22
14:44
Fix handling of transitive constraints in schemalint.tcl. check-in: 44edc1aa user: dan tags: schemalint
14:32
Update the schemalint.tcl script so that the argument to a -select option may be either an SQL statement or the name of a file containing an SQL statement check-in: d4e37767 user: dan tags: schemalint
2015-11-30
19:16
Add a rule to main.mk to build the schemalint.tcl script into an executable. Similar to the way the sqlite3_analyzer executable is built. check-in: b8251065 user: dan tags: schemalint
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/schemalint.tcl.

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
proc list_to_sql {L} {
  set ret [list]
  foreach l $L {
    lappend ret [quote $l]
  }
  join $ret ", "
}








proc process_cmdline_args {ctxvar argv} {
  upvar $ctxvar G
  set nArg [llength $argv]
  set G(database) [lindex $argv end]

  for {set i 0} {$i < [llength $argv]-1} {incr i} {
    set k [lindex $argv $i]
    switch -- $k {
      -select {
        incr i
        if {$i>=[llength $argv]-1} usage




        lappend G(lSelect) [lindex $argv $i]

      }
      -verbose {
        set ::VERBOSE 1
      }
      -test {
        sqlidx_internal_tests
      }







>
>
>
>
>
>
>












>
>
>
>
|
>







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
proc list_to_sql {L} {
  set ret [list]
  foreach l $L {
    lappend ret [quote $l]
  }
  join $ret ", "
}

proc readfile {zFile} {
  set fd [open $zFile]
  set data [read $fd]
  close $fd
  return $data
}

proc process_cmdline_args {ctxvar argv} {
  upvar $ctxvar G
  set nArg [llength $argv]
  set G(database) [lindex $argv end]

  for {set i 0} {$i < [llength $argv]-1} {incr i} {
    set k [lindex $argv $i]
    switch -- $k {
      -select {
        incr i
        if {$i>=[llength $argv]-1} usage
        set zSelect [lindex $argv $i]
        if {[file readable $zSelect]} {
          lappend G(lSelect) [readfile $zSelect]
        } else {
          lappend G(lSelect) $zSelect
        }
      }
      -verbose {
        set ::VERBOSE 1
      }
      -test {
        sqlidx_internal_tests
      }