Name

gql-shell — Interactive database terminal

Synopsis

gql-shell [option...] URI

Summary

GQL-Shell is a database terminal similar to PostgreSQL's psql. However, since it is based on GQL, the Generic SQL Library, it is database independent and can be used with any database GQL provides drivers for. This currently includes PostgreSQL, MySQL and SQLite.

Getting started

To start GQL-Shell, just type gql-shell followed by the database URI. GQL-Shell will then prompt you to enter SQL. Type in SQL statements (terminated by a semicolon), press Enter and the SQL will be executed.

For example, to connect to a PostgreSQL database named test on host foobar, and create a new table named tbl1 and then verify the results, you might do this:

$ gql-shell pg://foobar/test
Welcome to gql-shell, the interactive SQL terminal.

Type:  \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

test=> CREATE TABLE tbl1 (one int not null default 666, two varchar(80));
test=> \d
List of relations
 Name | Type
------+------
 tbl1 | TABLE
 
test=> \d tbl1
                 Table "tbl1"
 Column |    Type     |       Modifiers
--------+-------------+-----------------------
 one    | int         | default 666 not null
 two    | varchar(80) |
 
test=> \q
      

GQL-Shell meta-commands

Most of the time, GQL-Shell just reads lines of input and passes them on to the GQL library for execution. But if an input line begins with a backslash ("\"), then that line is intercepted and interpreted by GQL-Shell itself. These "slash commands" are typically used to change the output format of queries, or to execute certain prepackaged query statements.

For a listing of the available slash commands, you can enter "\?" at any time.

Options

The program has the following options:

-h, --help

Display usage information and exit.

-v, --version

Display version information.

-v, --verbose=verbosity

Increase/set verbosity.

-U user, --username user

Set database user name.

-W, --password

Prompt for database password.

Reporting bugs

Report bugs to

See also

The GQL homepage

Author

This manual page was written by Andreas Rottmann .