sqlite/ext/fts5/tool/showfts5.tcl
dan 3dbd2397f4 Reduce the number of calls to malloc() made by fts5.
FossilOrigin-Name: 898618ccf61d3ad166d9fc742e132d518338b5c3
2015-07-09 19:02:19 +00:00

37 lines
678 B
Tcl

#-------------------------------------------------------------------------
# Process command line arguments.
#
proc usage {} {
puts stderr "usage: $::argv0 database table"
puts stderr ""
exit 1
}
if {[llength $argv]!=2} usage
set database [lindex $argv 0]
set tbl [lindex $argv 1]
#-------------------------------------------------------------------------
# Start of main program.
#
sqlite3 db $database
catch { load_static_extension db fts5 }
db eval "SELECT fts5_decode(rowid, block) AS d FROM ${tbl}_data WHERE id=10" {
foreach lvl [lrange $d 1 end] {
puts [lrange $lvl 0 2]
foreach seg [lrange $lvl 3 end] {
puts " $seg"
}
}
}