org.objectweb.cjdbc.console.text.module
Class VirtualDatabaseConsole

java.lang.Object
  extended byorg.objectweb.cjdbc.console.text.module.AbstractConsoleModule
      extended byorg.objectweb.cjdbc.console.text.module.VirtualDatabaseConsole

public class VirtualDatabaseConsole
extends AbstractConsoleModule

C-JDBC Controller Virtual Database Console module.

Version:
1.0
Author:
Emmanuel Cecchet , Mathieu Peltier , Nicolas Modrzyk

Nested Class Summary
 
Nested classes inherited from class org.objectweb.cjdbc.console.text.module.AbstractConsoleModule
AbstractConsoleModule.CommandDelimiter
 
Field Summary
private  java.sql.Connection connection
           
private  int fetchsize
           
private  java.lang.String login
           
private  int maxrows
           
private  java.util.Hashtable savePoints
          contains a hash of to handle savepoints (used by SetSavePoint and Rollback commands)
private  int timeout
          Default query timeout.
private  java.lang.String url
           
 
Fields inherited from class org.objectweb.cjdbc.console.text.module.AbstractConsoleModule
commands, console, consoleCompletor, history, quit
 
Constructor Summary
VirtualDatabaseConsole(Console console)
          Creates a new VirtualDatabaseAdmin instance.
 
Method Summary
 void addSavePoint(java.sql.Savepoint savePoint)
          add a SavePoint
 java.sql.Connection createConnection(java.lang.String url, java.lang.String login, java.lang.String password)
          Create a new connection from the driver.
 void execSQL(java.lang.String request, boolean displayResult)
          Executes a SQL statement.
 java.sql.Connection getConnection()
          Get the JDBC connection used by the sql console.
 java.lang.String getDescriptionString()
          Text description of this module
 int getFetchsize()
          Get the fetchsize value
 java.lang.String getPromptString()
          Get the prompt string for this module
 java.sql.Savepoint getSavePoint(java.lang.String name)
          Get a SavePoint identified by its name
 int getTimeout()
          Get the timeout value (in seconds)
 void handlePrompt()
          Connects to a virtual database.
 void help()
          Display help for this module
protected  void loadCommands()
          Loads the commands for this module
 void login(java.lang.String[] params)
          Handles login in this module
 void quit()
          Quit this module
 void setFetchsize(int fetchsize)
          Set the fetchsize
 void setMaxrows(int maxrows)
          Set the maxrows
 void setTimeout(int timeout)
          Set the timeout value (in seconds)
 
Methods inherited from class org.objectweb.cjdbc.console.text.module.AbstractConsoleModule
findConsoleCommand, getCommands, getCompletor, getConsole, getHashCommands, getHistory, handleCommandLine, loadCompletor, loadHistory, manageHistory, reloadCompletor, storeHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

private java.sql.Connection connection

savePoints

private java.util.Hashtable savePoints
contains a hash of to handle savepoints (used by SetSavePoint and Rollback commands)


timeout

private int timeout
Default query timeout.


fetchsize

private int fetchsize

maxrows

private int maxrows

login

private java.lang.String login

url

private java.lang.String url
Constructor Detail

VirtualDatabaseConsole

public VirtualDatabaseConsole(Console console)
Creates a new VirtualDatabaseAdmin instance. Loads the driver

Parameters:
console - console console
Method Detail

getConnection

public java.sql.Connection getConnection()
Get the JDBC connection used by the sql console.

Returns:
a JDBC connection

createConnection

public java.sql.Connection createConnection(java.lang.String url,
                                            java.lang.String login,
                                            java.lang.String password)
                                     throws ConsoleException
Create a new connection from the driver.

Parameters:
url - the C-JDBC url
login - the login to use to open the connection
password - the password to use to open the connection
Returns:
a new connection
Throws:
ConsoleException - if login failed

execSQL

public void execSQL(java.lang.String request,
                    boolean displayResult)
Executes a SQL statement.

Parameters:
request - the SQL request to execute
displayResult - true if the result must be printed on the standard output

handlePrompt

public void handlePrompt()
Connects to a virtual database.

Overrides:
handlePrompt in class AbstractConsoleModule

getDescriptionString

public java.lang.String getDescriptionString()
Description copied from class: AbstractConsoleModule
Text description of this module

Specified by:
getDescriptionString in class AbstractConsoleModule
Returns:
String description to display
See Also:
AbstractConsoleModule.getDescriptionString()

getPromptString

public java.lang.String getPromptString()
Description copied from class: AbstractConsoleModule
Get the prompt string for this module

Specified by:
getPromptString in class AbstractConsoleModule
Returns:
String to place before prompt
See Also:
AbstractConsoleModule.getPromptString()

getSavePoint

public java.sql.Savepoint getSavePoint(java.lang.String name)
Get a SavePoint identified by its name

Parameters:
name - name fo the SavePoint
Returns:
a SavePoint or null if no SavePoint with such a name has been previously added

addSavePoint

public void addSavePoint(java.sql.Savepoint savePoint)
                  throws java.sql.SQLException
add a SavePoint

Parameters:
savePoint - the SavePoint to add
Throws:
java.sql.SQLException - if the savePoint is unnamed

getTimeout

public int getTimeout()
Get the timeout value (in seconds)

Returns:
the timeout value (in seconds)

setTimeout

public void setTimeout(int timeout)
Set the timeout value (in seconds)

Parameters:
timeout - new timeout value (in seconds)

getFetchsize

public int getFetchsize()
Get the fetchsize value

Returns:
the fetchsize value

setFetchsize

public void setFetchsize(int fetchsize)
Set the fetchsize

Parameters:
fetchsize - new fetchsize value

setMaxrows

public void setMaxrows(int maxrows)
Set the maxrows

Parameters:
maxrows - new maxrows value

loadCommands

protected void loadCommands()
Description copied from class: AbstractConsoleModule
Loads the commands for this module

Specified by:
loadCommands in class AbstractConsoleModule
See Also:
AbstractConsoleModule.loadCommands()

login

public void login(java.lang.String[] params)
           throws java.lang.Exception
Description copied from class: AbstractConsoleModule
Handles login in this module

Specified by:
login in class AbstractConsoleModule
Parameters:
params - parameters to use to login in this module
Throws:
java.lang.Exception - if fails
See Also:
AbstractConsoleModule.login(java.lang.String[])

quit

public void quit()
Description copied from class: AbstractConsoleModule
Quit this module

Overrides:
quit in class AbstractConsoleModule
See Also:
AbstractConsoleModule.quit()

help

public void help()
Description copied from class: AbstractConsoleModule
Display help for this module

Overrides:
help in class AbstractConsoleModule
See Also:
AbstractConsoleModule.help()


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.