On Fri, 10 Feb 2017 10:46:24 +0100
Dominique Devienne <ddevie...@gmail.com> wrote:

> PS: In this context, I don't want to use a host-program provided UDF.
> This is data meant to be viewed with any SQLite client, so kind of
> "report".

https://github.com/jklowden/sqlrpt

While Clemens was parsimonously adding 14 lines to support a thousands
separator in the SQL interpreter, I was extravagantly adding 225 to
create a new utility.  

sqlrpt processes a query and prepares the output to be rendered in
groff with the tbl preprocessor.  By using tbl, we get:

0.  intelligent table rendering, based on the data
1.  boldface column headings
2.  numeric columns aligned on the decimal point 
    and centered under the heading
3.  word-wrapped columns & headings for comfortable viewing
4.  data never truncated in display 

In honor of Dominique, sqlrpt honors the locale and renders numeric
data with a thousands separator.  Separators can be suppressed by
setting the locale to "C".  

I wrote sqlrpt partly as an experiment, provoked by Dominique saying he
wants a "report".  Although intended for interactive use at the command
line, it could be used to facilitate very nice printed reports, should
anyone wish to do so.  Of course groff can paginate, and tbl can
produce column headings at the top of each page.  

In my limited use so far, I find the output more compact and easier to
read than "sqlite3 -column -header".  

BSD license.  Enjoy. 

--jkl




_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to