Enjoy some consoleshots.
Basic parametrized query:
Query with named parameters and types:
One SQL statement can return multiple result sets:
UPDATE statement executed with custom log level:
Use TAB & save your keyboard:
You can test the connectivity to your databases and get results in table or in some machine-readable format.
Configuration XML is validated against the schema 1 during editation in GNU Emacs.
SQL-DK allows you to print your current configuration and program's internals.
You can also specify --formatter
to get output in different format (e.g. XML).
List of available data types:
List of configured databases + custom log level:
Just use capabilities 2 of your GNU/Linux system to execute the SQL script each time you save it in your favourite text editor:
Or both in one window using GNU Screen:
$ while inotifywait -qq query.sql; do sql-dk --db "MyDatabase" --sql-in < "query.sql"; done
(use Ctrl+c when you have finished)
Machine-readable output for further processing (of course omit the --formatter-property color true
).
With some crazy prefix for named parameters:
Human-readable output for simple reporting and sharing. One file which contains XHTML + CSS.
XHTML reports can be also sent over SMTP to your e-mail box:
Note: Customized output can be achieved using your own XSLT and CSS styles.
$ ( \
echo "Subject: user quotas"; \
echo "Content-Type: text/html; charset=UTF-8"; \
echo; \
sql-dk \
--db "posta" \
--formatter xhtml \
--sql "
SELECT
kvota AS quota,
count(*) AS user_count
FROM uzivatel
GROUP BY kvota" \
) | sendmail "hacker@example.com"
See also sample XHTML output for PostgreSQL and MySQL driver configurable properties.
1.Relax NG in this case, XSD is also available
2.if this command is missing it might be installed by apt-get install inotify-tools
or alternative in other distributions
SQL-DK, free software © 2013-2020 GlobalCode