| java.lang.Object com.quadcap.jdbc.Connection
Connection | public class Connection implements java.sql.Connection(Code) | | This class implements the java.sql.Connection interface,
which provides facilities for executing SQL statements, performing
transaction commit and rollback, and obtaining information about
the database via DatabaseMetaData .
author: Stan Bailes |
Constructor Summary | |
public | Connection(Database db, String auth, String passwd) Construct a new connection object for the specified database
and userid. |
Method Summary | |
public void | clearWarnings() Clears all warnings that have been reported on calls to this
connection. | public void | close() Close this connection, which implicitly ends (i.e., commits) any
pending transactions for this connection, closes any
ResultSet s opened on this connection, and marks
the connection as closed. | public void | commit() Commit any pending changes for the current transaction. | public java.sql.Statement | createStatement() | public java.sql.Statement | createStatement(int resultType, int resultSetConcurrency) | public java.sql.Statement | createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) Creates a Statement object that will generate
ResultSet objects with the given type, concurrency,
and holdability. | public void | finalize() Make sure the connection closes on gc... | public boolean | getAutoCommit() Return the current value for the autoCommit variable. | public String | getCatalog() | final public com.quadcap.sql.Connection | getConnection() Return the connection's session. | public Database | getDatabase() Return the database to which this connection is bound. | public int | getHoldability() Retrieves the current holdability of ResultSet objects
created using this Connection object. | public java.sql.DatabaseMetaData | getMetaData() | public int | getTransactionIsolation() | public Map | getTypeMap() Return the current type map to be used for custom type mapping of UDTS. | public SQLWarning | getWarnings() | public boolean | isClosed() Return true if this connection has been closed. | public boolean | isReadOnly() Return true if this connection is read only. | public String | nativeSQL(String stmt) This function is supposed to translate the specified query into
the native query language of the underlying DBMS. | public CallableStatement | prepareCall(String sql) | public CallableStatement | prepareCall(String sql, int resultType, int resultSetConcurrency) | public CallableStatement | prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) Creates a CallableStatement object that will generate
ResultSet objects with the given type and concurrency. | public java.sql.PreparedStatement | prepareStatement(String sql) Returns a new PreparedStatement statement, which is
a pre-compiled representation of the statement sql, with
place holders for parameters specified using the '?'
character. | public java.sql.PreparedStatement | prepareStatement(String sql, int resultType, int resultSetConcurrency) Returns a new PreparedStatement statement, which is
a pre-compiled representation of the statement sql, with
place holders for parameters specified using the '?'
character. | public java.sql.PreparedStatement | prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) Creates a PreparedStatement object that will generate
ResultSet objects with the given type, concurrency,
and holdability. | public java.sql.PreparedStatement | prepareStatement(String sql, int autoGeneratedKeys) Creates a default PreparedStatement object that has
the capability to retrieve auto-generated keys. | public java.sql.PreparedStatement | prepareStatement(String sql, int columnIndexes) Creates a default PreparedStatement object capable
of returning the auto-generated keys designated by the given array.
This array contains the indexes of the columns in the target
table that contain the auto-generated keys that should be made
available. | public java.sql.PreparedStatement | prepareStatement(String sql, String columnNames) Creates a default PreparedStatement object capable
of returning the auto-generated keys designated by the given array.
This array contains the names of the columns in the target
table that contain the auto-generated keys that should be returned.
This array is ignored if the SQL
statement is not an INSERT statement.
An SQL statement with or without IN parameters can be
pre-compiled and stored in a PreparedStatement object. | public void | releaseSavepoint(Savepoint savepoint) Removes the given Savepoint object from the current
transaction. | public void | rollback() Roll back any pending changes for the current transaction. | public void | rollback(Savepoint savepoint) Undoes all changes made after the given Savepoint object
was set. | public void | setAutoCommit(boolean autoCommit) Set the state of the autoCommit flag. | public void | setCatalog(String catalog) | public void | setHoldability(int holdability) Changes the holdability of ResultSet objects
created using this Connection object to the given
holdability. | public void | setReadOnly(boolean readOnly) | public Savepoint | setSavepoint() Creates an unnamed savepoint in the current transaction and
returns the new Savepoint object that represents it. | public Savepoint | setSavepoint(String name) Creates a savepoint with the given name in the current transaction
and returns the new Savepoint object that represents it. | public void | setTransactionIsolation(int trans) QED only supports the TRANSACTION_SERIALIZABLE
isolation level, so this function will
throw a "not implemented" exception if it is called with
any other value. | public void | setTypeMap(Map map) Set the type map to be used for custom type mapping of UDTS. |
dbm | DatabaseMetaData dbm(Code) | | Return a DatabaseMetaData object that can be used
to get information about the features supported by QED.
a DatabaseMetaData |
Connection | public Connection(Database db, String auth, String passwd) throws SQLException(Code) | | Construct a new connection object for the specified database
and userid.
Parameters: db - the database Parameters: auth - the userid Parameters: passwd - the password |
clearWarnings | public void clearWarnings()(Code) | | Clears all warnings that have been reported on calls to this
connection. QED doesn't currently throw any SQLWarnings,
so this operation does nothing.
|
close | public void close() throws SQLException(Code) | | Close this connection, which implicitly ends (i.e., commits) any
pending transactions for this connection, closes any
ResultSet s opened on this connection, and marks
the connection as closed. It is an error to attempt to use
this connection after the close operation
exception: SQLException - may be thrown |
commit | public void commit() throws SQLException(Code) | | Commit any pending changes for the current transaction. This
ends the transaction; any further statements executed by this
connection will cause a new transaction to be started. This
method closes any ResultSet s opened on this connection.
exception: SQLException - may be thrown |
createStatement | public java.sql.Statement createStatement(int resultType, int resultSetConcurrency) throws SQLException(Code) | | Return a new Statement object that can be used to
execute SQL statements on this connection
Parameters: resultType - the desired ResultSet type Parameters: resultSetConcurrency - the desired ResultSet concurrency a new Statement object exception: SQLException - may be thrown |
createStatement | public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code) | | Creates a Statement object that will generate
ResultSet objects with the given type, concurrency,
and holdability.
This method is the same as the createStatement method
above, but it allows the default result set
type, concurrency, and holdability to be overridden.
Parameters: resultSetType - one of the following ResultSet constants:ResultSet.TYPE_FORWARD_ONLY , ResultSet.TYPE_SCROLL_INSENSITIVE , orResultSet.TYPE_SCROLL_SENSITIVE Parameters: resultSetConcurrency - one of the following ResultSet constants:ResultSet.CONCUR_READ_ONLY orResultSet.CONCUR_UPDATABLE Parameters: resultSetHoldability - one of the following ResultSet constants:ResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT a new Statement object that will generateResultSet objects with the given type,concurrency, and holdability exception: SQLException - if a database access error occursor the given parameters are not ResultSet constants indicating type, concurrency, and holdability See Also: ResultSet since: 1.4 |
finalize | public void finalize() throws Throwable(Code) | | Make sure the connection closes on gc...
|
getAutoCommit | public boolean getAutoCommit() throws SQLException(Code) | | Return the current value for the autoCommit variable.
By default, connections are created with autoCommit
equal to true
the current autoCommit state |
getCatalog | public String getCatalog()(Code) | | QED doesn't support catalogs, so this function returns
null
null |
getDatabase | public Database getDatabase()(Code) | | Return the database to which this connection is bound.
the connection's database |
getHoldability | public int getHoldability() throws SQLException(Code) | | Retrieves the current holdability of ResultSet objects
created using this Connection object.
QED: ResultSet s are always closed on commit.
the holdability, one ofResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT throws: SQLException - if a database access occurs See Also: Connection.setHoldability See Also: ResultSet since: 1.4 |
getTransactionIsolation | public int getTransactionIsolation()(Code) | | Return the current transaction isolation level -- QED currently
only supports TRANSACTION_SERIALIZABLE
TRANSACTION_SERIALIZABLE |
getTypeMap | public Map getTypeMap() throws SQLException(Code) | | Return the current type map to be used for custom type mapping of UDTS.
In this release of QED, this call will succeed, but type mapping
is not fully implemented in this release.
the curren type map |
getWarnings | public SQLWarning getWarnings()(Code) | | QED doesn't generate any SQLWarning s, so this function
always returns null
null |
isClosed | public boolean isClosed()(Code) | | Return true if this connection has been closed.
true if this connection has been closed. |
isReadOnly | public boolean isReadOnly()(Code) | | Return true if this connection is read only. QED doesn't currently
support read-only connections, so this always returns
false
false |
nativeSQL | public String nativeSQL(String stmt)(Code) | | This function is supposed to translate the specified query into
the native query language of the underlying DBMS. In QED, the
native query language is SQL-92, and JDBC escapes are directly
supported by the DBMS, so this translation is a no-op, and always
returns the original string
Parameters: stmt - an SQL statement the same SQL statement |
prepareCall | public CallableStatement prepareCall(String sql, int resultType, int resultSetConcurrency) throws SQLException(Code) | | QED doesn't support stored procedures, so this method returns
a "not implemented" exception
Parameters: sql - the SQL statement Parameters: resultType - the desired ResultSet type Parameters: resultSetConcurrency - the desired ResultSet concurrency never exception: SQLException - "not implemented" |
prepareCall | public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code) | | Creates a CallableStatement object that will generate
ResultSet objects with the given type and concurrency.
This method is the same as the prepareCall method
above, but it allows the default result set
type, result set concurrency type and holdability to be overridden.
Parameters: sql - a String object that is the SQL statement tobe sent to the database; may contain on or more ? parameters Parameters: resultSetType - one of the following ResultSet constants:ResultSet.TYPE_FORWARD_ONLY , ResultSet.TYPE_SCROLL_INSENSITIVE , orResultSet.TYPE_SCROLL_SENSITIVE Parameters: resultSetConcurrency - one of the following ResultSet constants:ResultSet.CONCUR_READ_ONLY orResultSet.CONCUR_UPDATABLE Parameters: resultSetHoldability - one of the following ResultSet constants:ResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT a new CallableStatement object, containing thepre-compiled SQL statement, that will generateResultSet objects with the given type,concurrency, and holdability exception: SQLException - if a database access error occursor the given parameters are not ResultSet constants indicating type, concurrency, and holdability See Also: ResultSet since: 1.4 |
prepareStatement | public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException(Code) | | Returns a new PreparedStatement statement, which is
a pre-compiled representation of the statement sql, with
place holders for parameters specified using the '?'
character.
Parameters: sql - the SQL statement the PreparedStatement statement that can beused to invoke the SQL statement, after the parametersrepresented by the '?' characters aresupplied exception: SQLException - may be thrown |
prepareStatement | public java.sql.PreparedStatement prepareStatement(String sql, int resultType, int resultSetConcurrency) throws SQLException(Code) | | Returns a new PreparedStatement statement, which is
a pre-compiled representation of the statement sql, with
place holders for parameters specified using the '?'
character.
Parameters: sql - the SQL statement Parameters: resultType - the desired ResultSet type Parameters: resultSetConcurrency - the desired ResultSet concurrency the PreparedStatement statement that can beused to invoke the SQL statement, after the parametersrepresented by the '?' characters aresupplied exception: SQLException - may be thrown |
prepareStatement | public java.sql.PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code) | | Creates a PreparedStatement object that will generate
ResultSet objects with the given type, concurrency,
and holdability.
This method is the same as the prepareStatement method
above, but it allows the default result set
type, concurrency, and holdability to be overridden.
Parameters: sql - a String object that is the SQL statement tobe sent to the database; may contain one or more ? INparameters Parameters: resultSetType - one of the following ResultSet constants:ResultSet.TYPE_FORWARD_ONLY , ResultSet.TYPE_SCROLL_INSENSITIVE , orResultSet.TYPE_SCROLL_SENSITIVE Parameters: resultSetConcurrency - one of the following ResultSet constants:ResultSet.CONCUR_READ_ONLY orResultSet.CONCUR_UPDATABLE Parameters: resultSetHoldability - one of the following ResultSet constants:ResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT a new PreparedStatement object, containing thepre-compiled SQL statement, that will generateResultSet objects with the given type,concurrency, and holdability exception: SQLException - if a database access error occursor the given parameters are not ResultSet constants indicating type, concurrency, and holdability See Also: ResultSet since: 1.4 |
prepareStatement | public java.sql.PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException(Code) | | Creates a default PreparedStatement object that has
the capability to retrieve auto-generated keys. The given constant
tells the driver whether it should make auto-generated keys
available for retrieval. This parameter is ignored if the SQL
statement is not an INSERT statement.
Note: This method is optimized for handling
parametric SQL statements that benefit from precompilation. If
the driver supports precompilation,
the method prepareStatement will send
the statement to the database for precompilation. Some drivers
may not support precompilation. In this case, the statement may
not be sent to the database until the PreparedStatement
object is executed. This has no direct effect on users; however, it does
affect which methods throw certain SQLExceptions.
Result sets created using the returned PreparedStatement
object will by default be type TYPE_FORWARD_ONLY
and have a concurrency level of CONCUR_READ_ONLY .
Parameters: sql - an SQL statement that may contain one or more '?' INparameter placeholders Parameters: autoGeneratedKeys - a flag indicating whether auto-generated keys should be returned; one of the following Statement constants: Parameters: autoGeneratedKeys - a flag indicating that auto-generated keysshould be returned, one ofStatement.RETURN_GENERATED_KEYS orStatement.NO_GENERATED_KEYS . a new PreparedStatement object, containing thepre-compiled SQL statement, that will have the capability ofreturning auto-generated keys exception: SQLException - if a database access error occursor the given parameter is not a Statement constant indicating whether auto-generated keys should bereturned since: 1.4 |
prepareStatement | public java.sql.PreparedStatement prepareStatement(String sql, int columnIndexes) throws SQLException(Code) | | Creates a default PreparedStatement object capable
of returning the auto-generated keys designated by the given array.
This array contains the indexes of the columns in the target
table that contain the auto-generated keys that should be made
available. This array is ignored if the SQL
statement is not an INSERT statement.
An SQL statement with or without IN parameters can be
pre-compiled and stored in a PreparedStatement object. This
object can then be used to efficiently execute this statement
multiple times.
Note: This method is optimized for handling
parametric SQL statements that benefit from precompilation. If
the driver supports precompilation,
the method prepareStatement will send
the statement to the database for precompilation. Some drivers
may not support precompilation. In this case, the statement may
not be sent to the database until the PreparedStatement
object is executed. This has no direct effect on users; however, it does
affect which methods throw certain SQLExceptions.
Result sets created using the returned PreparedStatement
object will by default be type TYPE_FORWARD_ONLY
and have a concurrency level of CONCUR_READ_ONLY .
Parameters: sql - an SQL statement that may contain one or more '?' INparameter placeholders Parameters: columnIndexes - an array of column indexes indicating the columnsthat should be returned from the inserted row or rows a new PreparedStatement object, containing thepre-compiled statement, that is capable of returning theauto-generated keys designated by the given array of columnindexes exception: SQLException - if a database access error occurs since: 1.4 |
prepareStatement | public java.sql.PreparedStatement prepareStatement(String sql, String columnNames) throws SQLException(Code) | | Creates a default PreparedStatement object capable
of returning the auto-generated keys designated by the given array.
This array contains the names of the columns in the target
table that contain the auto-generated keys that should be returned.
This array is ignored if the SQL
statement is not an INSERT statement.
An SQL statement with or without IN parameters can be
pre-compiled and stored in a PreparedStatement object. This
object can then be used to efficiently execute this statement
multiple times.
Note: This method is optimized for handling
parametric SQL statements that benefit from precompilation. If
the driver supports precompilation,
the method prepareStatement will send
the statement to the database for precompilation. Some drivers
may not support precompilation. In this case, the statement may
not be sent to the database until the PreparedStatement
object is executed. This has no direct effect on users; however, it does
affect which methods throw certain SQLExceptions.
Result sets created using the returned PreparedStatement
object will by default be type TYPE_FORWARD_ONLY
and have a concurrency level of CONCUR_READ_ONLY .
Parameters: sql - an SQL statement that may contain one or more '?' INparameter placeholders Parameters: columnNames - an array of column names indicating the columnsthat should be returned from the inserted row or rows a new PreparedStatement object, containing thepre-compiled statement, that is capable of returning theauto-generated keys designated by the given array of columnnames exception: SQLException - if a database access error occurs since: 1.4 |
releaseSavepoint | public void releaseSavepoint(Savepoint savepoint) throws SQLException(Code) | | Removes the given Savepoint object from the current
transaction. Any reference to the savepoint after it have been removed
will cause an SQLException to be thrown.
QED: Savepoint s not supported.
Parameters: savepoint - the Savepoint object to be removed exception: SQLException - if a database access error occurs orthe given Savepoint object is not a valid savepoint in the current transaction since: 1.4 |
rollback | public void rollback() throws SQLException(Code) | | Roll back any pending changes for the current transaction. This
ends the transaction; any further statements executed by this
connection will cause a new transaction to be started. This
method closes any ResultSet s opened on this connection.
exception: SQLException - may be thrown |
rollback | public void rollback(Savepoint savepoint) throws SQLException(Code) | | Undoes all changes made after the given Savepoint object
was set.
This method should be used only when auto-commit has been disabled.
QED: Savepoint s not supported.
Parameters: savepoint - the Savepoint object to roll back to exception: SQLException - if a database access error occurs,the Savepoint object is no longer valid,or this Connection object is currently inauto-commit mode See Also: Savepoint See Also: Connection.rollback since: 1.4 |
setAutoCommit | public void setAutoCommit(boolean autoCommit) throws SQLException(Code) | | Set the state of the autoCommit flag.
Parameters: autoCommit - the new autoCommit state. |
setCatalog | public void setCatalog(String catalog) throws SQLException(Code) | | QED doesn't support catalogs, so this function throws
a "not implemented" exception
exception: SQLException - "not implemented" |
setHoldability | public void setHoldability(int holdability) throws SQLException(Code) | | Changes the holdability of ResultSet objects
created using this Connection object to the given
holdability.
QED: ResultSet s are always closed on commit.
Parameters: holdability - a ResultSet holdability constant; one ofResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT throws: SQLException - if a database access occurs, the given parameteris not a ResultSet constant indicating holdability,or the given holdability is not supported See Also: Connection.getHoldability See Also: ResultSet since: 1.4 |
setReadOnly | public void setReadOnly(boolean readOnly) throws SQLException(Code) | | QED doesn't support read-only connections, so this function will
throw a "not implemented" exception if it is called with
readOnly == true
Parameters: readOnly - had better be false exception: SQLException - if it's not |
setSavepoint | public Savepoint setSavepoint() throws SQLException(Code) | | Creates an unnamed savepoint in the current transaction and
returns the new Savepoint object that represents it.
QED: Savepoint s not supported.
the new Savepoint object exception: SQLException - if a database access error occursor this Connection object is currently inauto-commit mode See Also: Savepoint since: 1.4 |
setSavepoint | public Savepoint setSavepoint(String name) throws SQLException(Code) | | Creates a savepoint with the given name in the current transaction
and returns the new Savepoint object that represents it.
QED: Savepoint s not supported.
Parameters: name - a String containing the name of the savepoint the new Savepoint object exception: SQLException - if a database access error occursor this Connection object is currently inauto-commit mode See Also: Savepoint since: 1.4 |
setTransactionIsolation | public void setTransactionIsolation(int trans) throws SQLException(Code) | | QED only supports the TRANSACTION_SERIALIZABLE
isolation level, so this function will
throw a "not implemented" exception if it is called with
any other value.
Parameters: readOnly - had better be TRANSACTION_SERIALIZABLE exception: SQLException - if it's not |
setTypeMap | public void setTypeMap(Map map) throws SQLException(Code) | | Set the type map to be used for custom type mapping of UDTS.
In this release of QED, this call will succeed, but type mapping
is not fully implemented in this release.
Parameters: map - the new map |
|
|