sqlsc(1)SqLay Suitesqlsc(1)

NAME

sqlsc - a tiny suite of tools for relational database schema visualization on console, X or WWW.

SYNOPSIS

sqlsca [options] datasource

sqlsch [options] datasource

sqlsc.cgi [options] datasource

sqlscc [options] datasource

sqlscq [options] datasource

DESCRIPTION

sqlsc is made of 3 tools allowing to display a database physical data model: sqlsca (or sqlsch or sqlsc.cgi), non-interactive, generating plain text output on raw consoles either in Ascii art or in HTML or a Web page if running in a Web server, sqlscc a ncurses based viewer for console and sqlscq a Qt based viewer for windowing environnment.

They all interprete a datasource feeded either in the form either of an SQL DDL file, typically generated by a RDBMS dump utility like pg_dump or mysqldump (this datasource can also be piped into the executable through standard input) or in the form of an URL allowing to connect to a server through a driver.

They currently come with several drivers allowing DML: a MySQL driver, a PostgreSQL driver, a FreeTDS driver, an SQLite driver, an MDBTools driver, a basic CSV file driver, a basic SQL file driver, a dummy (random) driver and ODBC drivers.

They are part of the SqLay suite and share most of the options and connection facilities with other sqlay tools.

sqlsc could be a symlink to one of those programs, and sqlay, sqlaya, sqlayh, sqlayc, sqlayq symlinks to their respective sqlsc program.

OPTIONS

COMMANDS

Here is a list of key bindings available in sqlscc and sqlscq. Most should be available in both programs, so the right column indicates where they differ in sqlscq.

OUTPUT

Symbols are used in the output, some of them being rather self-explanatory, some other being not, so here comes a small legend for them.

On the top of the table is displayed the table name or comment. If it is truncated to fit the width of the displayed table, a '.' at the end of this name indicates it. If data have been detected for this table, the number of rows is indicated on the right side of the title. If this table is actually a view, it's name or comment is displayed, if possible, in italic (sqlscq, sqlsch) or underline (sqlscc), if not (sqlsca), normally.

In the fields section when not in permissions view mode, on the left side of the table, the key indicators are by default displayed like this on the first column:

The second column could optionally reveal that the field is member of at least one index, with the following indicators:

In the center of the table, the field names or comments accept, in the same fashion as the table name, the symbol '.' to indicate that part of their name had been truncated to fit in the width of the displayed table.

On the right side of the field name, the presence of a not null flag or a default value could optionally be revealed by the following indicators:

On the right side of the table, the datatypes are by default displayed on maximum 2 letters, using the following convention: the main datatype (character, integer, numeric, date, time, boolean) is shown as the first letter, and the detailed datatype is shown as the second letter (i.e. big integer, datetime, ...).

Here comes a non-exhaustive list of those abbreviated datatypes:

Note that it is a generic list, not extremely accurate, not bound to the backends, so exotic datatypes are marked as unknown.

At last, the bottom line of the table could display '...' to indicate that more fields exist in the table than those visible.

When in permissions view mode, the center of the table shows the permissions on the table with the following symbols on the left side:

The right side shows the name of the user or group to whom the permission is granted or revoked. This name can also be truncated in which case a '.' indicates it as for field or table names or comments.

FILES

The following files are checked in this order for user preferences:

A preference found in the last file will override the value found in the first one.

The files format is the following:

HTML templates can be used to customize the beginning and the end of generated HTML. They can be created in user's home directory with the following file names:

If not found, those two files will also be searched in system wide directory defined at compile time as SQLAY_SHAREDIR/templates/html.

<template_name> can then be used as parameter for the -ot option.

The default template name is 'default'.

The special template name 'null' means 'don't use any template'.

ENVIRONMENT

Besides from HOME, sqlscc may use the variables SQLAYCXCMD or SQLAYCCCMD to build the command to spawn a datasheet for the selected table, respectively in xterm or console (actually other, following the value of TERM variable) environment.

Their default values are normally fixed at compile time to respectively "xterm -e" and "openvt -lsw".

EXAMPLES

pg_dump -s test | sqlsca -th12

could display:

   +---------------+   +---------------+   +---------------+
   | master        |   | detail        |   | pkfk          |
   |---------------|   |---------------|   |---------------|
   |+ colm_pk    I |   |+ cold_pk    I |   |+ colpf_pk   I |
   |  colm_vc    CV|   |+ cold_pkc   I |   |± colm_pk    I |
   |  colm_dt    DT|   |- colm_pk    I |   |  cold_vc    CV|
   |               |   |  cold_vc    CV|   |               |
   |               |   |               |   |               |
   |               |   |               |   |               |
   |               |   |               |   |               |
   |               |   |               |   |               |
   |               |   |               |   |               |
   +---------------+   +---------------+   +---------------+

NOTES

sqlsc.cgi is currently non-interactive, even if compiled with debug.

Spaces in two letters options having an argument, like -th and -tw are interpreted differently in sqlsca and sqlscc/sqlscq: both accept all characters glued together, but sqlscc/sqlscq will (silently) reject the form -tw 20 and sqlsca will reject the form -t w20.

The debug level uses bitwise operators (16, 32, 64) and'ed but is unfortunately not very accurate.

BUGS

Very probably a lot (see the files BUGS and TODO included in the source).

Also, pls understand that this is an alpha release and none of the executables is securized against buffer overflows, and so on.

The drivers also are not thread safe. Not even the connections are safe.

The API has really been designed until now for use on trusted developpement machines, accessed only by trusted users, so:

YOU ARE STRONGLY ENCOURAGED NOT TO RUN THE CGI VERSION ON A PUBLICLY ACCESSIBLE WEB SERVER.

AUTHOR

E. Lurquin <sqlay@hitud.net>

CREDITS

We want to thank Openweb <http://www.openweb.be/> for having given the opportunity to start this small developpement effort and having sponsored part of it.

SEE ALSO

sqlay(1), sqlds(1), sqlayin(1), sqlayindummy(1), sqlayinfiles(1), sqlayinfilet(1), sqlayinslite(1), sqlayinmdbtl(1), sqlayinpgsql(1), sqlayinmysql(1), sqlayinfrtds(1), sqlayinodbc3(1)




sqlsc 0.8Dec 2008sqlsc(1)