To open a FluidShell window you click on the FluidShell button in the Server application menu or application toolbar with a key binding of Ctrl-Shift-F.  When opening a FluidShell, the shell will attempt to establish a default database connection to any registered server the user may have selected in the schema browser.  If no server is selected then no default database connection will be established in the newly open shell.

Once the new FluidShell is open, it will execute any initialization script.  If a FluidShell is open on a specific registered server it will execute the initialization script defined in the server registration in the FluidShell tab.  If a FluidShell is open without a registered server it will execute the global initialization script defined in the File > Options > FluidShell > Script. Users may configure their shells environment per registered server or at a global level by issuing any specific shell commands.

FluidShell
Application Toolbar Button
FluidShell
Right-click Menu
Server Properties
FluidShell tab


In the FluidShell command, prompt users may execute commands by typing the command name and hitting enter.  Adding a "\" to the beginning of the command will give the shell an explicit request to execute the command line as a shell command. The first command to test is the help command which will give you a list of commands available in the shell.

:$ \help

You can also get more detailed help for a specific command by typing \help and the command name :

:$ \help go

The shell interprets command lines based on the Command Line Interpreters (CLI) configurable options indicated by the shell variables.  To see a list of the shell variables that control the CLI you may type:

:$ export | grep CLI
declare -x CLI_SHELL_LINE_INTERPRETER_ERROR_ON_EXPLICIT_CMD_NOT_FOUND="true"
declare -x CLI_SHELL_LINE_INTERPRETER_EVAL_COMMENT="sql"
declare -x CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_CMD="true"
declare -x CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_SQL="false"
declare -x CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY="true"
declare -x CLI_SHELL_LINE_INTERPRETER_EVAL_IMPLICIT_CMD="true"
declare -x CLI_SHELL_LINE_INTERPRETER_EXPLICIT_CMD_CHAR="\\"
declare -x CLI_SHELL_LINE_INTERPRETER_EXPLICIT_SQL_CHAR=";"
declare -x CLI_SHELL_LINE_INTERPRETER_IMPLICIT_BEHAVIOR="sql"
declare -x CLI_SHELL_LINE_INTERPRETER_IS_AT_SIGN_GO="true"
declare -x CLI_SHELL_LINE_INTERPRETER_IS_FORWARDSLASH_GO="true"
declare -x CLI_SHELL_LINE_INTERPRETER_IS_SEMICOLON_GO="false"
declare -x CLI_SHELL_LINE_INTERPRETER_PERFORM_ALIAS_EXPANSION="true"

To learn more about each CLI shell variables visit the Shell Variable documentation: Shell Variable
The shell provides a command called cli that makes it easier to control the behavior of the CLI.  You can learn more about the command with:

\help cli

A user can change the behavior of the CLI to 3 predefined profiles: fluid, shell & SQL.  The default behavior is fluid.  The fluid behavior tells the CLI to interpret all command lines as shell commands unless there is no matching command, in which case it falls back to an SQL buffer command which places the command line into the SQL buffer.  As an example, the following command line:

:$ ls

is interpreted as a shell command because there is a matching command called "ls".  While the following command line:

:$ select * from orders

is interpreted as a SQL buffer command because there is no matching command called "select".  This behavior provides a user a fluid command line that allows the user to type and enter commands just like any other Unix and SQL shell without having to alternate between different interfaces.
The shell also provides alias commands similar to Unix shells.  Use the alias command to list or create aliases :

List aliases :

:$ alias
alias go='\go'
alias GO='\go'
alias ls='ls -l'
alias man='help'
alias set='declare'


Create new alias:

:$ alias ls='ls -lh'                                                               
:$ ls
drwx- 4.0K 2012-08-06 12:45 directory1
drwx- 4.0K 2012-08-06 12:45 directory2
drwx- 4.0K 2012-07-18 13:13 directory3
-rw-- 5.7M 2012-08-04 07:37 orders.csv

To view the contents of the SQL buffer you may click on the toolbars SQL buffer button which includes the line number the buffer is at to the right.  This will pop up an editor where you may modify the SQL buffer.  You can also use the sqlbuffer command to view or clear the buffer. Below is an example of how to enter, print, and clear the SQL buffer.

:$ sqlbuffer -p    
                                                                
:$ select * from orders
:$ limit 5
:$ sqlbuffer -p
select * from orders
limit 5

:$ sqlbuffer -c
:$ sqlbuffer -p	

:$

Once the SQL buffer contains the SQL you want to execute, you can use the <go> command. Below is an example of how to enter an SQL statement into the SQL buffer and then execute it.

:$ select order_id, product_name, quantity
:$ from orders
:$ limit 5
:$ go

order_id    product_name    quantity   
----------- --------------- -----------
01012007-72207-847 Aqua Data Studio v6.0 [w/ One Year Subscription] 1          
01012007-72207-ROWBOAT Aqua Data Studio v6.0 [w/ One Year Subscription] 1          
01012008-72207-14343   Aqua Data Studio v6.5 [w/ One Year Subscription] 1          
01012008-72207-1529    Aqua Data Studio v6.5 [w/ One Year Subscription] 1          
01012008-72207-BLACKDUCK Aqua Data Studio v6.5 [w/ One Year Subscription] 1          

5 record(s) selected [Fetch MetaData: 1ms] [Fetch Data: 0ms]

[Executed: 9/11/2012 8:45:15 AM] [Execution: 1ms

FluidShell
Query Executed
FluidShell
Multiline Query

As you work in the shell you may want to execute previously execute shell commands or SQL commands.  The shell maintains a list of previously executed shell commands.  The history behavior is controlled by the shell variables HIST* which can be viewed as follows:

:$ export | grep HIST
declare -x CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY="true"
declare -x HISTCONTROL="ignoredups:ignorespace"
declare -x HISTFILE="/home/dbuser/.datastudio/.datastudio/connections/MySQL-Server.history"
declare -x HISTFILESIZE="500"
declare -x HISTSIZE="500"

These variables may be configured to control the behavior of the history.
You may view a list of your history with the <history> command. You may use history expansion with an "!" just as in any Unix shell. And the UP and DOWN arrow allow you to cycle the current command line to any command in history. Below is an example of how to list your history and execute a previous command with history expansion.

:$ history

...

  58  export
  59  clear
  60  export | grep HIST
  61  history
  62  export | grep history
  63  clear
  64  history
:$ !60
export | grep HIST
declare -x CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY="true"
declare -x HISTCONTROL="ignoredups:ignorespace"
declare -x HISTFILE="/home/dbuser/.datastudio/.datastudio/connections/MySQL-Server.history"
declare -x HISTFILESIZE="500"
declare -x HISTSIZE="500"
:$



  • No labels