📄 jdbcconnection.java
字号:
* the given parameter is not one of the <code>Connection</code>
* constants <p>
* @see jdbcDatabaseMetaData#supportsTransactionIsolationLevel
* @see #getTransactionIsolation
*/
public synchronized void setTransactionIsolation(int level)
throws SQLException {
checkClosed();
boolean ok = level == Connection.TRANSACTION_READ_UNCOMMITTED
|| level == Connection.TRANSACTION_READ_COMMITTED
|| level == Connection.TRANSACTION_REPEATABLE_READ
|| level == Connection.TRANSACTION_SERIALIZABLE;
if (!ok) {
throw Util.notSupported;
}
try {
sessionProxy.setIsolation(level);
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
/**
* <!-- start generic documentation -->
* Retrieves this <code>Connection</code>
* object's current transaction isolation level. <p>
*
* <!-- end generic documentation -->
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB always returns
* <code>Connection.TRANSACTION_READ_UNCOMMITED</code>. <p>
*
* </div> <!-- end release-specific documentation -->
*
* @return the current transaction isolation level, which will be
* one of the following constants:
* <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>
* , <code>Connection.TRANSACTION_READ_COMMITTED</code>,
* <code>Connection.TRANSACTION_REPEATABLE_READ</code>,
* <code>Connection.TRANSACTION_SERIALIZABLE</code>, or
* <code>Connection.TRANSACTION_NONE</code> <p>
*
* Up to and including 1.7.1, TRANSACTION_READ_UNCOMMITTED is
* always returned
* @exception SQLException if a database access error occurs <p>
* @see jdbcDatabaseMetaData#supportsTransactionIsolationLevel
* @see #setTransactionIsolation setTransactionIsolation
*/
public synchronized int getTransactionIsolation() throws SQLException {
checkClosed();
try {
return sessionProxy.getIsolation();
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
/**
* <!-- start generic documentation -->
* Retrieves the first warning reported by calls on this
* <code>Connection</code> object. If there is more than one
* warning, subsequent warnings will be chained to the first
* one and can be retrieved by calling the method
* <code>SQLWarning.getNextWarning</code> on the warning
* that was retrieved previously. <p>
*
* This method may not be called on a closed connection; doing so
* will cause an <code>SQLException</code> to be thrown. <p>
*
* <B>Note:</B> Subsequent warnings will be chained to this
* SQLWarning. <p>
*
* <!-- end generic documentation -->
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Starting with 1.7.2, HSQLDB produces warnings whenever a createStatement(),
* prepareStatement() or prepareCall() invocation requests an unsupported
* but defined combination of result set type, concurrency and holdability,
* such that another set is substituted.
*
* </div> <!-- end release-specific documentation -->
* @return the first <code>SQLWarning</code> object or <code>null</code>
* if there are none<p>
* @exception SQLException if a database access error occurs or
* this method is called on a closed connection <p>
* @see SQLWarning
*/
public synchronized SQLWarning getWarnings() throws SQLException {
checkClosed();
synchronized (rootWarning_mutex) {
return rootWarning;
}
}
/**
* <!-- start generic documentation -->
* Clears all warnings reported for this <code>Connection</code>
* object. After a call to this method, the method
* <code>getWarnings</code> returns null until
* a new warning is reported for this Connection. <p>
*
* <!-- end generic documentation -->
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Before HSQLDB 1.7.2, <code>SQLWarning</code> was not
* supported, and calls to this method are simply ignored. <p>
*
* Starting with HSQLDB 1.7.2, the standard behaviour is implemented. <p>
*
* </div> <!-- end release-specific documentation -->
*
* @exception SQLException if a database access error occurs <p>
*/
public synchronized void clearWarnings() throws SQLException {
checkClosed();
synchronized (rootWarning_mutex) {
rootWarning = null;
}
}
//--------------------------JDBC 2.0-----------------------------
/**
* <!-- start generic documentation -->
* Creates a <code>Statement</code> object that will generate
* <code>ResultSet</code> objects with the given type and
* concurrency. This method is the same as the
* <code>createStatement</code> method above, but it allows the
* default result set type and result set concurrency type to be
* overridden. <p>
*
* <!-- end generic documentation -->
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Up to HSQLDB 1.6.1, support was provided only for type
* <code>TYPE_FORWARD_ONLY</code>
* and concurrency <code>CONCUR_READ_ONLY</code>. <p>
*
* Starting with HSQLDB 1.7.0, support is now provided for types
* <code>TYPE_FORWARD_ONLY</code>, <I>and</I>
* <code>TYPE_SCROLL_INSENSITIVE</code>,
* with concurrency <code>CONCUR_READ_ONLY</code>.
*
* Starting with HSQLDB 1.7.2, the behaviour regarding the type and
* concurrency values has changed to more closely conform to the
* specification. That is, if an unsupported combination is requested,
* a SQLWarning is issued on this Connection and the closest supported
* combination is used instead. <p>
*
* <B>Notes:</B> <p>
*
* Up to 1.6.1, calling this method returned <code>null</code> if the
* connection was already closed and a supported combination of type and
* concurrency was specified. This was possibly counter-intuitive
* to the expectation that an exception would be thrown for
* closed connections. Starting with 1.7.0. the behaviour is to throw a
* <code>SQLException</code> if the connection is closed.<p>
*
* </div> <!-- end release-specific documentation -->
*
* @param type a result set type; one of
* <code>ResultSet.TYPE_FORWARD_ONLY</code>,
* <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
* <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> (not
* supported)
* @param concurrency a concurrency type; one of
* <code>ResultSet.CONCUR_READ_ONLY</code>
* or <code>ResultSet.CONCUR_UPDATABLE</code> (not supported)
* @return a new <code>Statement</code> object that will, within
* the release-specific documented limitations of support,
* generate <code>ResultSet</code> objects with the given
* type and concurrency
* @exception SQLException if a database access error occurs or
* the given parameters are not ResultSet constants
* indicating a supported type and concurrency
* @since JDK 1.2 (JDK 1.1.x developers: read the new overview
* for jdbcConnection)
*/
public synchronized Statement createStatement(int type,
int concurrency) throws SQLException {
checkClosed();
type = xlateRSType(type);
concurrency = xlateRSConcurrency(concurrency);
return new jdbcStatement(this, type);
}
/**
* <!-- start generic documentation -->
* Creates a <code>PreparedStatement</code> object that will
* generate <code>ResultSet</code> objects with the given type
* and concurrency. This method is the same as the
* <code>prepareStatement</code> method above, but it allows the
* default result set type and result set concurrency type to be
* overridden. <p>
*
* <!-- end generic documentation -->
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Starting with HSQLDB 1.7.2, the behaviour regarding the type and
* concurrency values has changed to more closely conform to the
* specification. That is, if an unsupported combination is requested,
* a SQLWarning is issued on this Connection and the closest supported
* combination is used instead. <p>
*
* Also starting with 1.7.2, the support for and behaviour of
* PreparedStatment has changed. Please read the introductory section
* of the documentation for org.hsqldb.jdbc.jdbcPreparedStatement.
*
* </div> <!-- end release-specific documentation -->
*
* @param sql a String object that is the SQL statement to be
* sent to the database; may contain one or more ? IN
* parameters
* @param type a result set type; one of
* <code>ResultSet.TYPE_FORWARD_ONLY</code>,
* <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
* <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> (not
* supported)
* @param concurrency a concurrency type; one of
* <code>ResultSet.CONCUR_READ_ONLY</code>
* or <code>ResultSet.CONCUR_UPDATABLE</code> (not supported)
* @return a new PreparedStatement object containing the
* pre-compiled SQL statement that will produce
* <code>ResultSet</code>
* objects with the given type and concurrency
* @exception SQLException if a database access error occurs or
* the given parameters are not ResultSet constants
* indicating a supported type and concurrency
* @since JDK 1.2 (JDK 1.1.x developers: read the new overview
* for jdbcConnection)
*/
public synchronized PreparedStatement prepareStatement(String sql,
int type, int concurrency) throws SQLException {
checkClosed();
type = xlateRSType(type);
concurrency = xlateRSConcurrency(concurrency);
try {
return new jdbcPreparedStatement(this, sql, type);
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
/**
* <!-- start generic documentation -->
* Creates a <code>CallableStatement</code>
* object that will generate <code>ResultSet</code> objects with
* the given type and concurrency. This method is the same as the
* <code>prepareCall</code> method above, but it allows the
* default result set type and result set concurrency type to be
* overridden. <p>
*
* <!-- end generic documentation -->
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Starting with HSQLDB 1.7.2, the behaviour regarding the type,
* concurrency and holdability values has changed to more closely
* conform to the specification. That is, if an unsupported
* combination is requrested, a SQLWarning is issued on this Connection
* and the closest supported combination is used instead. <p>
*
* Also starting with 1.7.2, the support for and behaviour of
* CallableStatement has changed. Please read the introdutory section
* of the documentation for org.hsqldb.jdbc.jdbcCallableStatement.
*
* </div> <!-- end release-specific documentation -->
*
* @param sql a String object that is the SQL statement to be
* sent to the database; may contain one or more ? parameters
* @param resultSetType a result set type; one of
* <code>ResultSet.TYPE_FORWARD_ONLY</code>,
* <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, (not
* supported) or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
* (not supported)
* @param resultSetConcurrency a concurrency type; one of
* <code>ResultSet.CONCUR_READ_ONLY</code>
* or <code>ResultSet.CONCUR_UPDATABLE</code> (not supported)
* @return a new CallableStatement object containing the
* pre-compiled SQL statement
* @exception SQLException if a database access error occurs or
* the given parameters are not <code>ResultSet</code>
* constants indicating a supported type and concurrency
* @since JDK 1.2 (JDK 1.1.x developers: read the new overview
* for jdbcConnection)
*/
public synchronize
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -