📄 jdbcconnection.java
字号:
/** * <!-- start generic documentation --> * Retrieves this <code>Connection</code> * object's current transaction isolation level. <p> * * <!-- end generic documentation --> * <!-- start release-specific documentation --> * <span class="ReleaseSpecificDocumentation"> * <b>HSQLDB-Specific Information:</b> <p> * * HSQLDB always returns * <CODE>Connection.TRANSACTION_READ_UNCOMMITED</CODE>. <p> * * </span> <!-- 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 int getTransactionIsolation() throws SQLException { if (Trace.TRACE) { Trace.trace(); } checkClosed(); return Connection.TRANSACTION_READ_UNCOMMITTED; } /** * <!-- 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 --> * <span class="ReleaseSpecificDocumentation"> * <b>HSQLDB-Specific Information:</b> <p> * * Up to and including 1.7.1, HSQLDB never produces warnings, * always returns null.<p> * * </span> <!-- 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 SQLWarning getWarnings() throws SQLException { if (Trace.TRACE) { Trace.trace(); } checkClosed(); return null; } /** * An internal check for unsupported combinations of * <code>ResultSet</code> type and concurrency. <p> * * Up to and including HSQLDB 1.7.0, the only supported * combinations are type <code>TYPE_FORWARD_ONLY</code> or * <code>TYPE_SCROLL_INSENSITIVE</code>, combined with * concurrency <code>CONCUR_READ_ONLY</code>. * * @param type of <code>ResultSet</code>; one of * <code>ResultSet.TYPE_XXX</code> * @param concurrency of <code>ResultSet</code>; one of * <code>ResultSet.CONCUR_XXX</code> * @throws SQLException when the specified combination of type * and concurrency is not supported */ static void checkTypeConcurrency(int type, int concurrency) throws SQLException { if ((type != jdbcResultSet.TYPE_FORWARD_ONLY && type != jdbcResultSet .TYPE_SCROLL_INSENSITIVE) || concurrency != jdbcResultSet .CONCUR_READ_ONLY) { throw Trace.error(Trace.FUNCTION_NOT_SUPPORTED); } } /** * An internal check for closed connections. <p> * * @throws SQLException when the connection is closed */ void checkClosed() throws SQLException { if (bClosed) { throw Trace.error(Trace.CONNECTION_IS_CLOSED); } } /** * An internal method for removing a databas that has been shutdown * * @param database path/name of database to remove */ // bourcherb@users - 20020828 - patch 1.7.1 by boucherb@users static void removeDatabase(Database database) { if (database == null) { return; } tDatabase.remove(database.getName()); iUsageCount.remove(database); } /** * <!-- 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 --> * <span class="ReleaseSpecificDocumentation"> * <b>HSQLDB-Specific Information:</b> <p> * * Up to and including HSQLDB 1.7.0, <CODE>SQLWarning</CODE> is not * supported, and calls to this method are simply ignored. <p> * * </span> <!-- end release-specific documentation --> * * @exception SQLException if a database access error occurs <p> */ public void clearWarnings() throws SQLException { if (Trace.TRACE) { Trace.trace(); } checkClosed(); } //--------------------------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 --> * <span class="ReleaseSpecificDocumentation"> * <b>HSQLDB-Specific Information:</b> <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>. Specifying * any other values will throw a <CODE>SQLException</CODE>.<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> * * </span> <!-- 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 Statement createStatement(int type, int concurrency) throws SQLException { if (Trace.TRACE) { Trace.trace(); } checkClosed(); checkTypeConcurrency(type, 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 --> * <span class="ReleaseSpecificDocumentation"> * <b>HSQLDB-Specific Information:</b> <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>. Specifying * any other values will throw a SQLException.<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> * * </span> <!-- 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 PreparedStatement prepareStatement(String sql, int type, int concurrency) throws SQLException { if (Trace.TRACE) { Trace.trace(sql); } checkTypeConcurrency(type, concurrency); checkClosed(); return new jdbcPreparedStatement(this, sql, type); } /** * <!-- 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 --> * <span class="ReleaseSpecificDocumentation"> * <b>HSQLDB-Specific Information:</b> <p> * * Up to and including HSQLDB 1.7.0, support is provided only for * type <code>TYPE_FORWARD_ONLY</code> and concurrency * <code>CONCUR_READ_ONLY</code>. * Specifying any other values will throw a SQLException.<p> * * <B>Notes:</B> <p> * * Up to 1.6.1, calling this method returned null if the connection * was already closed and a supported combination of type and * concurrency was specified.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -