Screenshots

Enjoy some consoleshots.

SQL queries

Basic parametrized query:

 Basic parametrized query

Query with named parameters and types:

 Query with named parameters and types

One SQL statement can return multiple result sets:

 One SQL statement can return multiple result sets

SQL updates

UPDATE statement executed with custom log level:

 UPDATE statement executed with custom log level

Bash completion

Use TAB & save your keyboard:

bash completion

Connection testing

You can test the connectivity to your databases and get results in table or in some machine-readable format.

output of --test-connection

Configuration editing

Configuration XML is validated against the schema 1 during editation in GNU Emacs.

sql-dk configuration XML in GNU Emacs

Configuration printing

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).

output of --list-formatters

List of available data types:

output of --list-types List of available data types

List of configured databases + custom log level:

ouptup of --list-databases List of configured databases + custom log level

Execute SQL automatically on every file save

Just use capabilities 2 of your GNU/Linux system to execute the SQL script each time you save it in your favourite text editor:

Execute SQL on each file save

Or both in one window using GNU Screen:

Execute SQL on each file save – with GNU Screen

$ while inotifywait -qq query.sql; do sql-dk --db "MyDatabase" --sql-in < "query.sql"; done

(use Ctrl+c when you have finished)

XML formatter

Machine-readable output for further processing (of course omit the --formatter-property color true).

SQL + XML = ♥

With some crazy prefix for named parameters:

 With some crazy prefix for named parameters

XHTML formatter

Human-readable output for simple reporting and sharing. One file which contains XHTML + CSS.

XHTML output in a web browser

XHTML reports can be also sent over SMTP to your e-mail box:

XHTML output in an e-mail client

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