org.objectweb.cjdbc.controller.console
Class VirtualDatabaseConsole

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.console.VirtualDatabaseConsole

public class VirtualDatabaseConsole
extends java.lang.Object

C-JDBC Controller Virtual Database Console module.

Version:
1.0
Author:
Emmanuel Cecchet , Mathieu Peltier

Field Summary
static CommandCompletorInterface COMPLETOR
          Command completor.
private  java.sql.Connection connection
           
private  ConsoleHelperInterface helper
          Interface to the console helper.
private static int MAX_COLUMN_DISPLAY_WIDTH
          Max column width when displaying a ResultSet.
private  int timeout
          Default query timeout.
 
Constructor Summary
VirtualDatabaseConsole(ConsoleHelperInterface helper)
          Creates a new VirtualDatabaseAdmin instance.
 
Method Summary
 void callStoredProcedure(java.lang.String proc, boolean displayResult)
          Call a store procedure.
private  void displayPad(java.lang.String text, int size)
           
 void displayResultSet(java.sql.ResultSet rs)
          Display the given ResultSet.
private  void displaySeparatorLine(int columnCount, java.sql.ResultSetMetaData meta)
           
 void execSQL(java.lang.String request, boolean displayResult)
          Executes a SQL statement.
 java.sql.Connection getConnection(java.lang.String url, java.lang.String login, java.lang.String password)
          Gets a new connection from the driver.
 void handlePrompt(java.lang.String url)
          Connects to a virtual database.
 void help()
          Displays help message.
 void load(java.lang.String fileName)
          Executes all the SQL requests contained in the specified file.
 void showtables()
          Display all tables of this virtual database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPLETOR

public static final CommandCompletorInterface COMPLETOR
Command completor.


MAX_COLUMN_DISPLAY_WIDTH

private static final int MAX_COLUMN_DISPLAY_WIDTH
Max column width when displaying a ResultSet.

See Also:
Constant Field Values

helper

private ConsoleHelperInterface helper
Interface to the console helper.


connection

private java.sql.Connection connection

timeout

private int timeout
Default query timeout.

Constructor Detail

VirtualDatabaseConsole

public VirtualDatabaseConsole(ConsoleHelperInterface helper)
Creates a new VirtualDatabaseAdmin instance.

Parameters:
helper - console helper
Method Detail

getConnection

public java.sql.Connection getConnection(java.lang.String url,
                                         java.lang.String login,
                                         java.lang.String password)
Gets 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

displaySeparatorLine

private void displaySeparatorLine(int columnCount,
                                  java.sql.ResultSetMetaData meta)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

displayPad

private void displayPad(java.lang.String text,
                        int size)

displayResultSet

public void displayResultSet(java.sql.ResultSet rs)
                      throws java.sql.SQLException
Display the given ResultSet.

Parameters:
rs - the ResultSet to display
Throws:
java.sql.SQLException - if an error occurs

callStoredProcedure

public void callStoredProcedure(java.lang.String proc,
                                boolean displayResult)
Call a store procedure.

Parameters:
proc - the stored procedure to call
displayResult - true if the result must be printed on the standard output

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

showtables

public void showtables()
Display all tables of this virtual database


load

public void load(java.lang.String fileName)
Executes all the SQL requests contained in the specified file.

Parameters:
fileName - the file name to open

help

public void help()
Displays help message.


handlePrompt

public void handlePrompt(java.lang.String url)
Connects to a virtual database.

Parameters:
url - URL to connect


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