henplus.commands
Class SQLCommand

java.lang.Object
  extended by henplus.AbstractCommand
      extended by henplus.commands.SQLCommand
All Implemented Interfaces:
Command

public class SQLCommand
extends AbstractCommand

document me.


Field Summary
 
Fields inherited from interface henplus.Command
EXEC_FAILED, SUCCESS, SYNTAX_ERROR
 
Constructor Summary
protected SQLCommand(ListUserObjectsCommand tc)
           
  SQLCommand(ListUserObjectsCommand tc, PropertyRegistry registry)
           
 
Method Summary
 Iterator complete(CommandDispatcher disp, String partialCommand, String lastWord)
          Returns a list of strings that are possible at this stage.
 int execute(SQLSession session, String cmd, String param)
          execute the command given.
 String getColumnDelimiter()
           
 String[] getCommandList()
          returns the command-strings this command can handle.
 String getLongDescription(String cmd)
          returns a longer string describing this action.
 int getRowLimit()
           
 String getSynopsis(String cmd)
          retuns a synopsis-string.
 boolean isComplete(String command)
          complicated SQL statements are only complete with semicolon.
 boolean isShowFooter()
           
 boolean isShowHeader()
           
 boolean participateInCommandCompletion()
          don't show the commands available in the toplevel command completion list ..
 void setColumnDelimiter(String value)
           
 void setRowLimit(int rowLimit)
           
 void setShowFooter(boolean b)
           
 void setShowHeader(boolean b)
           
 void shutdown()
          shutdown this command.
 
Methods inherited from class henplus.AbstractCommand
argumentCount, getOption, getOptions, getShortDescription, handleCommandline, registerOptions, requiresValidSession, setOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLCommand

protected SQLCommand(ListUserObjectsCommand tc)

SQLCommand

public SQLCommand(ListUserObjectsCommand tc,
                  PropertyRegistry registry)
Method Detail

getCommandList

public String[] getCommandList()
returns the command-strings this command can handle.


participateInCommandCompletion

public boolean participateInCommandCompletion()
don't show the commands available in the toplevel command completion list ..

Specified by:
participateInCommandCompletion in interface Command
Overrides:
participateInCommandCompletion in class AbstractCommand

isComplete

public boolean isComplete(String command)
complicated SQL statements are only complete with semicolon. Simple commands may have no semicolon (like 'commit' and 'rollback'). Yet others are not complete even if we ecounter a semicolon (like triggers and stored procedures). We support the SQL*PLUS syntax in that we consider these kind of statements complete with a single slash ('/') at the beginning of a line.

Specified by:
isComplete in interface Command
Overrides:
isComplete in class AbstractCommand
Parameters:
command - the partial command read so far given to decide by the command whether it is complete or not.

setColumnDelimiter

public void setColumnDelimiter(String value)

getColumnDelimiter

public String getColumnDelimiter()

setRowLimit

public void setRowLimit(int rowLimit)

getRowLimit

public int getRowLimit()

setShowHeader

public void setShowHeader(boolean b)

isShowHeader

public boolean isShowHeader()

setShowFooter

public void setShowFooter(boolean b)

isShowFooter

public boolean isShowFooter()

execute

public int execute(SQLSession session,
                   String cmd,
                   String param)
execute the command given.

Parameters:
session - the SQLsession this command is executed from.
cmd - the command as string.
param - the rest parameters following the command.
Returns:
one of SUCCESS, SYNTAX_ERROR, EXEC_FAILED to indicate the exit status of this command. On SYNTAX_ERROR, the CommandDispatcher displays a synopsis if available.

complete

public Iterator complete(CommandDispatcher disp,
                         String partialCommand,
                         String lastWord)
Description copied from interface: Command
Returns a list of strings that are possible at this stage. Used for the readline-completion in interactive mode. Based on the partial command and the lastWord you have to determine the words that are available at this stage. Return 'null', if you don't know a possible completion.

Specified by:
complete in interface Command
Overrides:
complete in class AbstractCommand
Parameters:
disp - the CommandDispatcher - you might want to access other values through it.
partialCommand - The command typed so far
lastWord - the last word returned by readline.

shutdown

public void shutdown()
Description copied from interface: Command
shutdown this command. This is called on exit of the CommandDispatcher and allows you to do some cleanup (close connections, flush files..)

Specified by:
shutdown in interface Command
Overrides:
shutdown in class AbstractCommand

getSynopsis

public String getSynopsis(String cmd)
Description copied from interface: Command
retuns a synopsis-string. The synopsis string returned should follow the following conventions:

Should contain no newline, no leading spaces. This synopsis is printed in the detailed help of a command or if the execute()-method returned a SYNTAX_ERROR.

Specified by:
getSynopsis in interface Command
Overrides:
getSynopsis in class AbstractCommand
Parameters:
cmd - the command the synopsis is for. This is one of the possible commands returned by Command.getCommandList().

getLongDescription

public String getLongDescription(String cmd)
Description copied from interface: Command
returns a longer string describing this action. This should return a String describing details of the given command. This String should start with a TAB-character in each new line (the first line is a new line). The last line should not end with newline.

Specified by:
getLongDescription in interface Command
Overrides:
getLongDescription in class AbstractCommand
Parameters:
cmd - The command the long description is asked for. This is one of the possible commands returned by Command.getCommandList().


? 1997..2006 Henner Zeller