lv-client

LiveView Client — A client for querying a LiveView Server from the system command prompt.

SYNOPSIS

lv-client [-u uri][-c][-w waitTimeMS] "command" [help]

lv-client --version

lv-client help

LV> command [--help];

DESCRIPTION

lv-client is the command-line client for creating simple queries against a running LiveView server. You can use lv-client commands in scripts, or directly from a system command prompt. Commands that are supported for use at the command prompt are noted with (command-line support).

Without arguments, lv-client enters an interactive shell mode, showing the prompt LV>. All commands entered in the interactive client must end with a semicolon (;).

OPTIONS

-u uri

Specifies the LiveView URI for the LiveView Server instance to communicate with, using the lv:// or lvs:// protocols. If a URI is provided with , lv-client connects to this server immediately upon startup, or quits if unsuccessful.

-p TCP-port

Specifies the port number on localhost of the LiveView server instance to communicate with. This is a shortcut alternative to specifying the full URI with -u in cases where the server is running on localhost but on a port other than the default 10080.

-c

Returns query output in comma-separated value (CSV) format.

-w waitTimeMS

Specifies a wait time waitTimeMS in milliseconds for the command to continually attempt to connect to LiveView Server before abandoning the connect attempt.

--version

Shows the installed version of the LiveView Java Client library used to build lv-client.

COMMANDS

addalertaction ruleID

Adds an alert action to the ruleID provided. The available actions are:

  • delete

  • publish

  • email

addalertrule tableName predicate --message "messageText" --name "alertName"

Adds an alert rule with no actions.

close queryid

Closes the specified query.

connect [uri]

Closes any existing connection and connect to a LiveView Server instance. The connect command with no arguments will connect to the default LiveView Server URI, lv://localhost:10080.

connstat

Retrieves information about the current LiveView Server connection (command-line support).

delete [from] TableName [predicate-clause]

Deletes rows that match a query predicate that begins with WHERE or WHEN. With no predicate clause specified, this command deletes all rows from the specified table.

Caution

Deleted data cannot be recovered, so use this command with care.

disablerules [ruleid]

Disables all or a specified of alert rules. To specify a rule, use the rule ID number (command-line support).

enablerules [ruleid]

Enables all or a specified set of alert rules. To specify a rule, use it rule ID number (command-line support).

help

Displays available commands (command-line support). The --help option also provides command-level help for every option of the command argument.

listen queryid

Listens to a running live query. Press x+enter to stop listening.

listrules [ruleid]

Lists all or specified alert rules. To specify a rule, use the rule id number (command-line support).

listtable [TableName], listtables [TableName]

Lists tables available for querying. If you give the command a table name as a argument, it will return the field names and associated data types of the specified table (command-line support).

live

Creates a live query (command-line support).

livestat

Lists status of current live queries.

print queryid

Prints current results of a live query.

publish TableName [--delete [bufferSize [flushIntervalMS]]]

Reads CSV data from stdin and publishes to the specified table (command-line support).

quit

Quits the interactive client.

select

Runs a snapshot query. The select command uses the syntax of the SQL SELECT statement (command-line support).

shutdown

Shuts down LiveView Server (command-line support).

version

Displays the version of the connected LiveView Server (command-line support).

EXAMPLES

This example runs simple queries against the Hello LiveView sample project that was loaded into the StreamBase Studio workspace in the project folder sample_lv-helloliveview. All commands are run from the StreamBase Command Prompt

  1. To run the Hello LiveView sample for the Windows username sbuser, use the following command. (This single command is shown on two lines for clarity.)

    lv-server run "C:\Users\sbuser\Documents\
      StreamBase Studio 7.5 Workspace\sample_lv-helloliveview"
    
  2. Use the command line to list the tables in the running LiveView application:

    lv-client listtables
    
  3. connect to the default URI and start the lv-client interactive shell:

    lv-client -u lv://localhost:10080
    
  4. Create a snapshot query that returns all rows from the ItemsSales table where lastSoldPrice is greater than 10 and quantityRemaining is less than 20:

    SELECT * FROM ItemsSales WHERE lastSoldPrice > 10 AND quantityRemaining < 20;
    
  5. Exit the interactive client and run the same query from the system command line:

    quit;
    lv-client -u lv://localhost:10080 "SELECT * FROM ItemsSales 
       WHERE lastSoldPrice > 10 AND quantityRemaining < 20;"
    
  6. The next two lines start the LiveView server running the Hello LiveView sample, waits three minutes for the server to come up (180,000 milliseconds), then checks the connection status.

    start /min lv-server run "C:\Users\sbuser\Documents\
      StreamBase Studio 7.5 Workspace\sample_lv-helloliveview"
    lv-client -w 180000 connstat
    

SEE ALSO

sbc
lv-server