Documentation — User's guide

Tools

The command line client

synsql -u USER [-p PASSWORD] [-s BROKER] [-b]
  • -u the user name. Mandatory.
  • -p the password. Without it the client asks for it, without displaying it.
  • -s the broker to connect first, as named in etc/synsql.conf. By default the first broker of the file that answers.
  • -b batch mode: no prompt, no welcome message, statements are read from the standard input.

In the interactive mode the prompt is the name of the broker you are connected to. A statement ends with ; and may span several lines: the prompt then shows the line number. The arrow keys recall the previous statements, kept in .synsql_history in your home directory.

dev-sql-broker-1 > describe gaia_source;

A line that starts with . cancels the statement being typed.

Commands of the client itself

  • source FILE; runs the statements of a file. If FILE does not exist and has no .sql extension, FILE.sql is tried.
  • history; lists the statements kept in the history.
  • debug; lists the brokers of the cluster.
  • exit;, quit; or bye; leave. shutdown; stops the broker (administrators only).

What is printed

A select prints one line per row, value | value |; a NULL prints as (NULL) |. In the interactive mode, the number of rows and the time are printed at the end. The other commands print the server's answer and, for most of them, Elapsed: n secs..

Batch mode

synsql -b -u USER -p PASSWORD < statements.sql

The exit code is 0 when all went well, 1 when the cluster could not be reached, and 3 when a statement that changes data was sent and the connection broke before the answer arrived: it may or may not have been executed, and the client does not send it again by itself. Check the table before you run it again.

When a broker stops

The client does not ping the server. If a broker does not answer, the client connects another broker and, for a select, describe or show, sends the statement again (3 attempts at most). A statement that changes data is never sent again automatically.

← Prerequisites  |  Manage objects →