Top Description Inners Fields Constructors Methods
org.apache.derby.impl.tools.ij

pack-priv Class ij

extends Object
implements ijConstants
Class Inheritance
All Implemented Interfaces
org.apache.derby.impl.tools.ij.ijConstants
Imports
org.apache.derby.tools.JDBCDisplayUtil, org.apache.derby.iapi.tools.i18n.LocalizedInput, .LocalizedResource, org.apache.derby.shared.common.info.JVMInfo, java.lang.reflect.*, java.security.AccessController, .PrivilegedAction, java.sql.Connection, .DatabaseMetaData, .DriverManager, .Statement, .PreparedStatement, .ResultSet, .ResultSetMetaData, .SQLException, .SQLWarning, java.util.Hashtable, .Properties, .StringTokenizer, .Vector, .Enumeration, .Locale, .List, .ArrayList, java.io.IOException, javax.transaction.xa.XAResource

This parser works on a statement-at-a-time basis. It maintains a connection environment that is set by the caller and contains a list of connections for the current thread/ij session. Multi-user frameworks that use this parser tend to maintain multiple connectionEnv's and pass in the current one to set ij up. A connectionEnv has a default connection in use, and the ij connect/set connection/disconnect commands are used to change the current connection. Each connection has associated with it a list of prepared statements and cursors, created by the ij prepare and get cursor statements and manipulated by additional ij statements. To enable multiple display modes, this parser will not output anything, but will return objects that the caller can then display. This means the caller is responsible for displaying thrown exceptions and also SQLWarnings. So, our return value is the JDBC object upon which warnings will be hung, i.e. the one manipulated by the statement, if any. If there is no object to display, then a null is returned.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static class

Field Summary

Modifier and TypeField and Description
pack-priv ConnectionEnv
pack-priv boolean
pack-priv boolean
pack-priv static final String
pack-priv Hashtable<K, V>
private final ij.JJCalls[]
private int
private Vector<int[]>
private int[]
private int
private int
private int
private int
private final int[]
private static int[]
private static int[]
private static int[]
private static int[]
private static int[]
private Token
private int[]
private final ij.LookaheadSuccess
public Token
private boolean
private Token
private boolean
public boolean
pack-priv Hashtable<String, String>
pack-priv static final String
pack-priv String
pack-priv static final String
pack-priv Connection
public Token
public ijTokenManager
pack-priv String
pack-priv static final String
pack-priv static final String
pack-priv utilMain
pack-priv xaAbstractHelper

Constructor Summary

AccessConstructor and Description
pack-priv
ij(ijTokenManager
The token manager to use
tm
,
utilMain
The util to use
utilInstance
)

A constructor that understands the local state that needs to be initialized.

public
ij(CharStream stream)

public

Method Summary

Modifier and TypeMethod and Description
public final ijResult
private ijResult
addSession(Connection newConnection, String name)

public final ijResult
pack-priv SQLWarning
appendWarnings(SQLWarning wHead, SQLWarning wTail)

Add the warnings of wTail to the end of those of wHead.

public final ijResult
AsyncStatement()

Async: like execute immediate, without using, but runs the statement in a separate thread, against the current connection.

public final void
public final ijResult
AutocommitStatement()

Autocommit lets you control this aspect of the connection.

public final ijResult
Bang()

Bang lets you issue a system command using System.exec.

public final ijResult
public final String
caIdentifier()

A case/connection respectful identifier.

public final String
public final String
public final ijResult
public final ijResult
CommitStatement()

CommitStatement is simply COMMIT.

public final ijResult
public final ijResult
CP_ConnectStatement()

CP_ConnectStatement is <CP_CONNECT> [ <USER> 'user' ] [ <PASSWORD> 'password' ] [ <AS> cpconnid ] make a PooledConnection using the current CPDataSource and make that PooledConnection the current PooledConnection.

public final ijResult
CP_DataSourceStatement()

CP_DataSourceStatement is CP_DataSource 'dbname' [ <PROTOCOL> 'protocol' ] - get a connection pool data source whose database name is dbname and make that DataSource the current CPDataSource.

public final ijResult
CP_DisconnectStatement()

CP_DisconnectStatement is <CP_DISCONNECT> [ cpconnid = identifier() ] disconnect a PooledConnection.

public final ijResult
CP_GetConnectionStatement()

CP_GetConnectionStatement is <CP_GETCONNECTION> [ <AS> connid ] get a Connection object from the current PooledConnection.

public final ijResult
DataSourceStatement()

DataSourceStatement is DataSource 'dbname' [ <PROTCOL> 'protocol'] [ <USER> 'user' ] [ <PASSWORD> 'password' ] [ <AS> n=identifier() ] We new'ed an instance of DataSource as the current DataSource and set its database name to dbname.

public ijResult
describeTable(String schema, String table)

Outputs the names of all fields of given table.

public final ijResult
DescTableStatement()

Handles DESCRIBE table

public final void
public final ijResult
DisconnectStatement()

DisconnectStatement is simply DISCONNECT [ ALL | CURRENT | connectionName ] it ends the specified connection(s) and releases its statement resource.

public final ijResult
DriverStatement()

DriverStatement is DRIVER 'class' where class is the name of a class that is a JDBC driver.

public final ijResult
dynamicConnection(boolean simplifiedPath)

ConnectStatement is CONNECT 'url' [ PROTOCOL proto ] [ USER String PASSWORD String ] [ATTRIBUTES attributeName = value [, attributeName = value]* ] [ AS ident ], where url is the url for the database, i.e. jdbc:protocol:dbname etc. Attributes are connection attributes to

There can only be one connection at a time; if there is already one, it is put on hold and this one takes its place.

public final ijResult
ElapsedTimeStatement()

Elapsedtime on causes ij to dump out the elapsed time it takes to run a user statement at the end of that statement.

public final void
private static Process
execProcess(String command)

Create a Process to run a command.

pack-priv ijResult
executeAsync(String stmt, QualifiedIdentifier qi)

Async execution wants to return results off-cycle.

pack-priv ijResult
executeImmediate(String
the statement
stmt
)

We do not reuse statement objects at all, because some systems require you to close the object to release resources (JBMS), while others will not let you reuse the statement object once it is closed (WebLogic).

public final ijResult
ExecuteStatement()

Two forms of execute: immediate, with a string and prepared, with the id of a prepared statement.

public final ijResult
pack-priv ResultSet
findCursor(QualifiedIdentifier qi)

Find a cursor.

pack-priv PreparedStatement
findPreparedStatement(QualifiedIdentifier qi)

Find a prepared statement.

pack-priv Session
findSession(String name)

Find a session by its name.

public final ijResult
public ParseException
private int[]
getColumnWidthsForIndex(String schema)

Used by showIndexes to get correct column widths

public final ijResult
public final ijResult
private int[]
getDisplayColumnsForIndex(String schema, ResultSet rs)

Used by showIndexes to get columns in correct order

pack-priv boolean
getElapsedTimeState()

Get the "elapsedTime state".

private ResultSet
getIndexInfoForTable(String
schema to find indexes for
schema
,
String
the exact name of the table to find indexes for
table
)

Return a resultset of indexes for the given table or schema

public final Token
public final Token
getToken(int index)

pack-priv void
public final ijResult
HelpStatement()

Haven't included: ASYNC, !, EXPECT Don't include: XA_*

public final ijResult
HoldForConnectionStatement()

By default, holdability is set to true for Connection objects.

public final int
public final String
public final ijResult
pack-priv void
initFromEnvironment()

Initialize this parser from the environment (system properties).

pack-priv void
public static int[]
intArraySubset(final int[]
The input integer array
input
,
int
Starting index, inclusive
start
,
int
Ending index, exclusive
end
)

Returns a subset of the input integer array

public final int
public final int
private static boolean

Returns:

true if JDBC 2.0 (and greater) extension classes can be loaded
JDBC20X
()

Return whether or not JDBC 2.0 (and greater) extension classes can be loaded

private final boolean
jj_2_1(int xla)

private final boolean
jj_2_2(int xla)

private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private void
jj_add_error_token(int kind, int pos)

private final Token
jj_consume_token(int kind)

private static void
private static void
private static void
private static void
private static void
private final void
private final void
jj_save(int index, int xla)

private final boolean
jj_scan_token(int kind)

public static boolean

Returns:

true if JNDI extension classes can be loaded
JNDI
()

Return whether or not JNDI extension classes can be loaded

private static boolean

Returns:

true if JTA classes can be loaded
JTA
()

Return whether or not JTA classes can be loaded

public final String
public final ijResult
public final ijResult
LocalizedDisplay()

Localizeddisplay controls locale sensitive data representayion

Syntax: LOCALIZEDDISPLAY [ ON | OFF ] ;

private Object
makeXid(int xid)

public final ijResult
MaximumDisplayWidthStatement()

MaximumDisplayWidth EXACT_NUMERIC changes the maximum display width for java.lang.String to the specified EXACT_NUMERIC.

public final void
public final ijResult
public final ijResult
NoHoldForConnectionStatement()

By default, holdability is set to true for Connection objects.

public final void
public final ijResult
public final ijResult
public final void
property(Properties properties)

public final ijResult
ProtocolStatement()

ProtocolStatement is PROTOCOL 'JDBC protocol' where the protocol is used to prefix any connect request that cannot find a driver.

public final QualifiedIdentifier
qualifiedIdentifier()

A qualified identifier is localName [ <at> sessionName ]

pack-priv ijResult
quit()

public final ijResult
ReadOnlyStatement()

ReadOnly lets you control this aspect of the connection.

public void
public void
public final ijResult
public final ijResult
RemoveStatement()

RemoveStatement is REMOVE identifier.

public final ijResult
RollbackStatement()

RollbackStatement is simply ROLLBACK.

public final ijResult
public final int
pack-priv void
setConnection(ConnectionEnv connEnv, boolean multipleEnvironments)

public final ijResult
SetConnectionStatement()

SetConnectionStatement is SET CONNECTION ident

Moves to the named session, if it exists.

public ijResult
showConnectionsMethod(boolean ignore0Rows)

This is used at the ij startup time to see if there are already some connections made and if so, show connections made so far.

public ijResult
showEnabledRoles()

Return a resultset of enabled roles, sorted on ROLEID.

public ijResult
showFunctions(String schema)

Return a resultset of functions from database metadata.

public ijResult
showIndexes(String
the schema indices are shown from.
schema
,
String
the table name to show indices for. If null, all indices of the schema are returned.
table
)

Used to show all indices.

public ijResult
showProcedures(String schema)

Return a resultset of procedures from database metadata

public ijResult
showRoles()

Return a resultset of roles.

public ijResult
showSchemas()

Return a resultset of schemas from database metadata

public ijResult
showSettableRoles()

Return a resultset of settable roles, sorted on ROLEID.

public final ijResult
ShowStatement()

Handles showing current connections for the current environment, and SHOW TABLES/VIEWS/...

public ijResult
showTables(String
Schema to get tables for, or null for search in all schemas.
schema
,
String[]
Types of tables to return, see java.sql.DatabaseMetaData#getTableTypes
tableType
)

Return a resultset of tables (or views, procs...) in the given schema.

public final String
sign()

private String[]
public final ijResult
staticConnection()

Handles CONNECT yadda.yadda.foo( stringArg, ...

public final String[]
public final Vector<String>
public final void
public final void
pack-priv String
stringValue(String s)

this removes the outside quotes from the string.

public void
verifyTableExists(String
Schema for the table
schema
,
String
Name of table to check for existence of
table
)

Verify that a table exists within a schema.

public final ijResult
WaitForStatement()

Wait for: the second half of Async, waits for completion if needed and then supplies the result.

public final ijResult
XA_CommitStatement()

XA_CommitStatement is XA_COMMIT [ XA_1PHASE | XA_2PHASE ] xid commits a global transaction xid

public final ijResult
XA_ConnectStatement()

XA_ConnectStatement is XA_CONNECT (<AS> connid) make a XAConnection using the currentXADataSource and make that XAConnection the current XAConnection.

public final ijResult
XA_DataSourceStatement()

XA_DataSourceStatement is XA_DataSource 'dbname' ( create | shutdown ) We new'ed an instance of XADataSource as the current DataSource and set its database name to dbname.

public final ijResult
XA_DisconnectStatement()

XA_DisconnectStatement is XA_DISCONNECT [xaconnid = identifier()] disconnect the current XAConnection If xaconnid is given, then disconnect XAConnection with xaconnid (xaconnid not implemented).

public final ijResult
XA_EndStatement()

XA_EndStatement is XA_END [ XA_SUSPEND | XA_SUCCESS | XA_FAIL] xid dissociates a transaction from the current XAConnection or end an already suspended one

public final ijResult
XA_ForgetStatement()

XA_ForgetStatement is XA_FORGET xid forgets about a heuristically completed transaction

public final ijResult
XA_GetConnectionStatement()

XA_GetConnectionStatement is XA_GETCONNECTION it gets a Connection from the currentXAConnection and uses that as the current connection

public final ijResult
XA_PrepareStatement()

XA_PrepareStatement is XA_PREPARE xid prepares a global transaction

public final ijResult
XA_RecoverStatement()

XA_RecoverStatement is XA_RECOVER flag displays the list of prepared transactions

public final ijResult
XA_RollbackStatement()

XA_RollbackStatement is XA_Rollback xid rolls back a global transaction

public final ijResult
XA_StartStatement()

XA_StartStatement is XA_START [ XA_NOFLAGS | XA_JOIN | XA_RESUME ] xid start or associates a transaction with the current XAConnection

public final int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait