| java.lang.Object org.apache.derby.impl.tools.ij.ij
ij | class ij implements ijConstants(Code) | | 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.
author: ames |
Inner Class :final static class JJCalls | |
Method Summary | |
final public ijResult | AbsoluteStatement() | final public ijResult | AfterLastStatement() | final public ijResult | AsyncStatement() Async: like execute immediate, without using,
but runs the statement in a separate thread, against
the current connection. | final public ijResult | AutocommitStatement() Autocommit lets you control this aspect of the connection. | final public ijResult | Bang() Bang lets you issue a system command using System.exec. | final public ijResult | BeforeFirstStatement() | final public 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.
If cpconnid is given, then associate cpconnid with the
PooledConnection. | final public 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. | final public ijResult | CP_DisconnectStatement() CP_DisconnectStatement is
<CP_DISCONNECT> [ cpconnid = identifier() ]
disconnect a PooledConnection. | final public ijResult | CP_GetConnectionStatement() CP_GetConnectionStatement is
<CP_GETCONNECTION> [ <AS> connid ]
get a Connection object from the current PooledConnection. | final public ijResult | CloseStatement() | final public ijResult | CommitStatement() CommitStatement is simply COMMIT. | final public ijResult | ConnectStatement() | final public 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. | final public ijResult | DescTableStatement() | final public ijResult | DisconnectStatement() DisconnectStatement is simply DISCONNECT [ ALL | CURRENT | connectionName ]
it ends the specified connection(s) and
releases its statement resource. | final public ijResult | DriverStatement() DriverStatement is DRIVER 'class' where class is the
name of a class that is a JDBC driver. | final public 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. | final public ijResult | ExecuteStatement() Two forms of execute: immediate, with a string
and prepared, with the id of a prepared statement. | final public ijResult | ExitStatement() | final public ijResult | ExpectStatement() ExpectStatement is EXPECT [ FAIL ] {'String'}* END EXPECT
Will eventually detect the lines that the strings are without
special literals, but for now this is expedient (except for the
doubling of quotes...)
Used to test the previous statement's output. | final public ijResult | F2KExecuteProcedure() Hack to get the grammar to leave a
EXECUTE PROCEDURE <procSpec> alone. | final public ijResult | FirstStatement() | final public ijResult | GetCurrentRowNumber() | final public ijResult | GetCursorStatement() | final public ijResult | HelpStatement() | final public ijResult | IllegalStatementName() | final public ijResult | JBMSPreparedStatementExec() Hack to get the grammar to leave a
EXECUTE STATEMENT <stmt> alone. | final public ijResult | LastStatement() | final public ijResult | LocalizedDisplay() | final public ijResult | MaximumDisplayWidthStatement() MaximumDisplayWidth EXACT_NUMERIC changes the maximum display width for
java.lang.String to the specified EXACT_NUMERIC. | final public ijResult | NextStatement() | final public ijResult | NoHoldForConnectionStatement() By default, holdability is set to true for Connection objects. | final public ijResult | PrepareStatement() | final public ijResult | PreviousStatement() | final public ijResult | ProtocolStatement() ProtocolStatement is PROTOCOL 'JDBC protocol' where
the protocol is used to prefix any connect request that
cannot find a driver. | public void | ReInit(CharStream stream) | public void | ReInit(ijTokenManager tm) | final public ijResult | ReadOnlyStatement() ReadOnly lets you control this aspect of the connection. | final public ijResult | RelativeStatement() | final public ijResult | RemoveStatement() RemoveStatement is REMOVE identifier. | final public ijResult | RollbackStatement() RollbackStatement is simply ROLLBACK. | final public ijResult | RunStatement() | final public ijResult | SetConnectionStatement() SetConnectionStatement is SET CONNECTION ident
Moves to the named session, if it exists. | final public ijResult | ShowStatement() Handles showing current connections for the current environment, and
SHOW TABLES/VIEWS/... | final public void | StringItem(Vector v) | final public void | StringList(Vector v) | final public ijResult | WaitForStatement() Wait for: the second half of Async, waits for completion
if needed and then supplies the result. | final public ijResult | XA_CommitStatement() | final public ijResult | XA_ConnectStatement() XA_ConnectStatement is XA_CONNECT (<AS> connid)
make a XAConnection using the currentXADataSource and make that XAConnection
the current XAConnection. | final public 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. | final public 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). | final public ijResult | XA_EndStatement() | final public ijResult | XA_ForgetStatement() | final public ijResult | XA_GetConnectionStatement() | final public ijResult | XA_PrepareStatement() | final public ijResult | XA_RecoverStatement() | final public ijResult | XA_RollbackStatement() | final public ijResult | XA_StartStatement() | SQLWarning | appendWarnings(SQLWarning wHead, SQLWarning wTail) Add the warnings of wTail to the end of those of wHead. | final public Properties | attributeList() | final public String | caseSensitiveIdentifier() | final public String | caseSensitiveIdentifierOrKeyword() | public ijResult | describeTable(String schema, String table) Outputs the names of all fields of given table. | final public void | disable_tracing() | final public 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. | final public void | enable_tracing() | ijResult | executeAsync(String stmt, String name) Async execution wants to return results off-cycle.
We want to control their output, and so will hold it
up until it is requested with a WAIT FOR asyncName
statement. | ijResult | executeImmediate(String 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 ParseException | generateParseException() | boolean | getElapsedTimeState() Get the "elapsedTime state". | final public Token | getNextToken() | final public Token | getToken(int index) | void | haveConnection() | final public int | holdType() | final public String | identifier() | final public ijResult | ijStatement() | void | initFromEnvironment() Initialize this parser from the environment
(system properties). | void | installProtocol(String name, String value) | public static int[] | intArraySubset(int[] input, int start, int end) | final public int | intLiteral() | final public int | intValue() | final public String | keyword() | final public void | methodLeg(Vector list) | final public void | oneStaticArg(Vector list) | final public void | property(Properties properties) | ijResult | quit() | final public int | scrollType() | void | setConnection(ConnectionEnv connEnv, boolean multipleEnvironments) | 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.
Following also gets executed when user types show connections command
in ij. | public ijResult | showIndexes(String schema, String table) | public ijResult | showProcedures(String schema) | public ijResult | showSchemas() | public ijResult | showTables(String schema, String[] tableType) Return a resultset of tables (or views, procs...) in the given schema. | final public String | sign() | final public ijResult | staticConnection() Handles CONNECT yadda.yadda.foo( stringArg, ... | final public String[] | staticMethodArgs() | final public Vector | staticMethodName() | String | stringValue(String s) this removes the outside quotes from the string. | public void | verifyTableExists(String schema, String table) Verify that a table exists within a schema. | final public int | xatmflag() |
FRAMEWORK_PROPERTY | final static String FRAMEWORK_PROPERTY(Code) | | |
PASSWORD_PROPERTY | final static String PASSWORD_PROPERTY(Code) | | |
PROTOCOL_PROPERTY | final static String PROTOCOL_PROPERTY(Code) | | |
elapsedTime | boolean elapsedTime(Code) | | |
lookingAhead | public boolean lookingAhead(Code) | | |
numExpectnumPassnumFailnumUnx | int numExpectnumPassnumFailnumUnx(Code) | | Note the Expect Result in the output and in the stats.
FIXME
|
ij | ij(ijTokenManager tm, utilMain utilInstance)(Code) | | A constructor that understands the local state that needs to be
initialized.
Parameters: tm - The token manager to use Parameters: utilInstance - The util to use |
AsyncStatement | final public ijResult AsyncStatement() throws ParseException, SQLException(Code) | | Async: like execute immediate, without using,
but runs the statement in a separate thread, against
the current connection.
Syntax:
ASYNC asyncName statementSource
statementSource is a string containing SQL-J text.
|
AutocommitStatement | final public ijResult AutocommitStatement() throws ParseException, SQLException(Code) | | Autocommit lets you control this aspect of the connection.
REMIND: should have a general way to set all connection attributes,
this is a shortcut for immediate needs.
Syntax:
AUTOCOMMIT [ ON | OFF ] ;
|
Bang | final public ijResult Bang() throws ParseException(Code) | | Bang lets you issue a system command using System.exec.
Syntax:
! 'command to issue' ;
|
CP_ConnectStatement | final public ijResult CP_ConnectStatement() throws ParseException, SQLException(Code) | | 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.
If cpconnid is given, then associate cpconnid with the
PooledConnection. (cpconnid not implemented).
|
CP_DataSourceStatement | final public ijResult CP_DataSourceStatement() throws ParseException, SQLException(Code) | | 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.
If <PROTOCOL> is specified, the DataSource may be
remote.
|
CP_DisconnectStatement | final public ijResult CP_DisconnectStatement() throws ParseException, SQLException(Code) | | CP_DisconnectStatement is
<CP_DISCONNECT> [ cpconnid = identifier() ]
disconnect a PooledConnection. If cpconnid is given, then
disconnect the PooledConnection with the given cpconnid.
(cpconnid not implemented)
|
CP_GetConnectionStatement | final public ijResult CP_GetConnectionStatement() throws ParseException, SQLException(Code) | | CP_GetConnectionStatement is
<CP_GETCONNECTION> [ <AS> connid ]
get a Connection object from the current PooledConnection.
If connid is given, the associate connid with the connection.
(connid not implemented)
|
DataSourceStatement | final public ijResult DataSourceStatement() throws ParseException, SQLException(Code) | | 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. Also get a connection
|
DisconnectStatement | final public ijResult DisconnectStatement() throws ParseException, SQLException(Code) | | DisconnectStatement is simply DISCONNECT [ ALL | CURRENT | connectionName ]
it ends the specified connection(s) and
releases its statement resource.
If ALL is specified, it disconnects all available sessions
in the current environment.
|
DriverStatement | final public ijResult DriverStatement() throws ParseException, SQLException(Code) | | DriverStatement is DRIVER 'class' where class is the
name of a class that is a JDBC driver. It is loaded
into the DriverManager with a Class.forName call.
You can load as many drivers as you want, the idea is
to load up the appropriate one(s) for the connect(s)
that you will be issuing.
|
ElapsedTimeStatement | final public ijResult ElapsedTimeStatement() throws ParseException(Code) | | Elapsedtime on causes ij to dump out the elapsed time it takes
to run a user statement at the end of that statement.
Syntax:
ELAPSEDTIME [ ON | OFF ] ;
|
ExecuteStatement | final public ijResult ExecuteStatement() throws ParseException, SQLException(Code) | | Two forms of execute: immediate, with a string
and prepared, with the id of a prepared statement.
We expect the latter form will
eventually support a USING clause to supply
parameter values (that will be constants).
No parameters yet, however.
Syntax:
EXECUTE statementSource [ USING statementSource] ;
statementSource is an identifier of a previously prepared statement
or a string containing SQL-J text.
|
ExpectStatement | final public ijResult ExpectStatement() throws ParseException(Code) | | ExpectStatement is EXPECT [ FAIL ] {'String'}* END EXPECT
Will eventually detect the lines that the strings are without
special literals, but for now this is expedient (except for the
doubling of quotes...)
Used to test the previous statement's output. Note that ij must be
in "expect" mode to use this statement, otherwise it is just
ignored. This is due to the overhead of tracking the prior statement's
output.
|
F2KExecuteProcedure | final public ijResult F2KExecuteProcedure() throws ParseException, SQLException(Code) | | Hack to get the grammar to leave a
EXECUTE PROCEDURE <procSpec> alone. Short
circuit the ij EXECUTE built in so that
we can deploy ij against Foundation2000.
|
JBMSPreparedStatementExec | final public ijResult JBMSPreparedStatementExec() throws ParseException, SQLException(Code) | | Hack to get the grammar to leave a
EXECUTE STATEMENT <stmt> alone. Short
circuit the ij EXECUTE built in.
|
LocalizedDisplay | final public ijResult LocalizedDisplay() throws ParseException(Code) | | Localizeddisplay controls locale sensitive data representayion
Syntax:
LOCALIZEDDISPLAY [ ON | OFF ] ;
|
MaximumDisplayWidthStatement | final public ijResult MaximumDisplayWidthStatement() throws ParseException(Code) | | MaximumDisplayWidth EXACT_NUMERIC changes the maximum display width for
java.lang.String to the specified EXACT_NUMERIC.
This is only used by the console view.
Syntax:
MAXIMUMDISPLAYWIDTH INTEGER ;
|
NoHoldForConnectionStatement | final public ijResult NoHoldForConnectionStatement() throws ParseException, SQLException(Code) | | By default, holdability is set to true for Connection objects. This syntax NOHOLDFORCONNECTION lets you set it to close cursors at commit.
Syntax:
NOHOLDFORCONNECTION ;
|
ProtocolStatement | final public ijResult ProtocolStatement() throws ParseException, SQLException(Code) | | ProtocolStatement is PROTOCOL 'JDBC protocol' where
the protocol is used to prefix any connect request that
cannot find a driver. We will take a stab at loading
a driver as each protocol comes in -- we only know about
two.
|
ReadOnlyStatement | final public ijResult ReadOnlyStatement() throws ParseException, SQLException(Code) | | ReadOnly lets you control this aspect of the connection.
REMIND: should have a general way to set all connection attributes,
this is a shortcut for immediate needs.
Syntax:
READONLY [ ON | OFF ] ;
|
RemoveStatement | final public ijResult RemoveStatement() throws ParseException, SQLException(Code) | | RemoveStatement is REMOVE identifier. It identifies
a previously prepared statement. We would prefer a DROP
syntax, but SQL-J is using that word and I want to point out
that special processing will be needed to give that parser
this parser's input for unrecognized text.
|
SetConnectionStatement | final public ijResult SetConnectionStatement() throws ParseException, SQLException(Code) | | SetConnectionStatement is SET CONNECTION ident
Moves to the named session, if it exists. If it doesn't
exist, remains on the current session and returns an error.
|
WaitForStatement | final public ijResult WaitForStatement() throws ParseException, SQLException(Code) | | Wait for: the second half of Async, waits for completion
if needed and then supplies the result. Only execute is done,
not row fetching.
Syntax:
WAIT FOR asyncName
asyncName is a name used in an ASYNC statement previously
|
XA_ConnectStatement | final public ijResult XA_ConnectStatement() throws ParseException, SQLException(Code) | | XA_ConnectStatement is XA_CONNECT (<AS> connid)
make a XAConnection using the currentXADataSource and make that XAConnection
the current XAConnection. If connid is given, then associate connid with
the XAConnection. This connid is not th xid.
|
XA_DataSourceStatement | final public ijResult XA_DataSourceStatement() throws ParseException, SQLException(Code) | | 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.
|
XA_DisconnectStatement | final public ijResult XA_DisconnectStatement() throws ParseException, SQLException(Code) | | XA_DisconnectStatement is XA_DISCONNECT [xaconnid = identifier()]
disconnect the current XAConnection
If xaconnid is given, then disconnect XAConnection with xaconnid (xaconnid
not implemented).
|
XA_EndStatement | final public ijResult XA_EndStatement() throws ParseException, SQLException(Code) | | 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
|
XA_GetConnectionStatement | final public ijResult XA_GetConnectionStatement() throws ParseException, SQLException(Code) | | XA_GetConnectionStatement is XA_GETCONNECTION
it gets a Connection from the currentXAConnection and uses that as the
current connection
|
XA_StartStatement | final public ijResult XA_StartStatement() throws ParseException, SQLException(Code) | | XA_StartStatement is XA_START [ XA_NOFLAGS | XA_JOIN | XA_RESUME ] xid
start or associates a transaction with the current XAConnection
|
disable_tracing | final public void disable_tracing()(Code) | | |
dynamicConnection | final public ijResult dynamicConnection(boolean simplifiedPath) throws ParseException, SQLException(Code) | | 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.
if a driver can't be found, the current protocol will
be added at the front.
the as ident part is used for set connection. If you don't
specify a name, we create one that is CONNECTION# for the #
of open connections that now exists. If the name duplicates,
an error results.
|
enable_tracing | final public void enable_tracing()(Code) | | |
executeAsync | ijResult executeAsync(String stmt, String name)(Code) | | Async execution wants to return results off-cycle.
We want to control their output, and so will hold it
up until it is requested with a WAIT FOR asyncName
statement. WAIT FOR will return the results of
the async statement once they are ready. Note that using
a select only waits for the execute to complete; the
logic to step through the result set is in the caller.
|
executeImmediate | ijResult executeImmediate(String stmt) throws SQLException(Code) | | 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).
If you want to reuse statement objects, you need to
use the ij PREPARE and EXECUTE statements.
Parameters: stmt - the statement |
getElapsedTimeState | boolean getElapsedTimeState()(Code) | | Get the "elapsedTime state".
|
haveConnection | void haveConnection()(Code) | | |
initFromEnvironment | void initFromEnvironment()(Code) | | Initialize this parser from the environment
(system properties). Used when ij is being run
as a command line program.
|
intArraySubset | public static int[] intArraySubset(int[] input, int start, int end)(Code) | | Returns a subset of the input integer array
Parameters: input - The input integer array Parameters: start - Starting index, inclusive Parameters: end - Ending index, exclusive |
showConnectionsMethod | public ijResult showConnectionsMethod(boolean ignore0Rows) throws SQLException(Code) | | 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.
Following also gets executed when user types show connections command
in ij. In the former case, ignore0Rows is set whereas in the later cas
it's set to false. The reason for this is, at ij startup time, if there
are no connections made so far, we don't want to show anything. Only if
there are connections made, we show the connections. Whereas in show
connection command case, we want to show the connection status either way
ie if there are no connections, we say no connections. Otherwise we list
all the connections made so far.
|
showIndexes | public ijResult showIndexes(String schema, String table) throws SQLException(Code) | | Return a resultset of indexes for the given table or schema
Parameters: schema - schema to find indexes for Parameters: table - table to find indexes for |
stringValue | String stringValue(String s)(Code) | | this removes the outside quotes from the string.
it will also swizzle the special characters
into their actual characters, like '' for ', etc.
|
verifyTableExists | public void verifyTableExists(String schema, String table) throws SQLException(Code) | | Verify that a table exists within a schema. Throws an exception
if table does not exist.
Parameters: schema - Schema for the table Parameters: table - Name of table to check for existence of |
|
|