⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 brokeredstatement.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*   Derby - Class org.apache.derby.iapi.jdbc.BrokeredStatement   Copyright 2003, 2004 The Apache Software Foundation or its licensors, as applicable.   Licensed under the Apache License, Version 2.0 (the "License");   you may not use this file except in compliance with the License.   You may obtain a copy of the License at      http://www.apache.org/licenses/LICENSE-2.0   Unless required by applicable law or agreed to in writing, software   distributed under the License is distributed on an "AS IS" BASIS,   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   See the License for the specific language governing permissions and   limitations under the License. */package org.apache.derby.iapi.jdbc;import org.apache.derby.iapi.reference.JDBC30Translation;import org.apache.derby.iapi.reference.SQLState;import org.apache.derby.iapi.error.StandardException;import org.apache.derby.iapi.error.PublicAPI;import org.apache.derby.iapi.services.info.JVMInfo;import org.apache.derby.impl.jdbc.Util;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.SQLWarning;import java.sql.Statement;import java.lang.reflect.*;/**	A Statement implementation that forwards all of its requests to an underlying Statement. */public class BrokeredStatement implements EngineStatement{	/**		My control. Use the controlCheck() method to obtain the control		when calling a check method. This will result in the correct exception		being thrown if the statement is already closed.	*/	final BrokeredStatementControl control;	final int jdbcLevel;	final int resultSetType;	final int resultSetConcurrency;	final int resultSetHoldability;	/**		My state	*/	private String cursorName;	private Boolean escapeProcessing;    BrokeredStatement(BrokeredStatementControl control, int jdbcLevel) throws SQLException    {		this.control = control;		this.jdbcLevel = jdbcLevel;		// save the state of the Statement while we are pretty much guaranteed the		// underlying statement is open.		resultSetType = getResultSetType();		resultSetConcurrency = getResultSetConcurrency();		resultSetHoldability = getResultSetHoldability();    }    public final void addBatch(String sql)              throws SQLException    {		getStatement().addBatch( sql);	}    public final void clearBatch()        throws SQLException    {           getStatement().clearBatch();	}    public final int[] executeBatch()        throws SQLException    {		return getStatement().executeBatch();	}    public final void cancel()        throws SQLException    {        getStatement().cancel();    }    public final boolean execute(String sql) throws SQLException	{		return getStatement().execute(sql);    }     public final ResultSet executeQuery(String sql) throws SQLException	{ 		return wrapResultSet(getStatement().executeQuery(sql));    }    public final int executeUpdate(String sql) throws SQLException	{		return getStatement().executeUpdate(sql);    }            /**     * In many cases, it is desirable to immediately release a     * Statements's database and JDBC resources instead of waiting for     * this to happen when it is automatically closed; the close     * method provides this immediate release.     *     * <P><B>Note:</B> A Statement is automatically closed when it is     * garbage collected. When a Statement is closed its current     * ResultSet, if one exists, is also closed.	 * @exception SQLException thrown on failure.     */	public final void close() throws SQLException    {		getStatement().close();    }    public final Connection getConnection()        throws SQLException    {		return getStatement().getConnection();	}    public final int getFetchDirection()        throws SQLException    {		return getStatement().getFetchDirection();	}    public final int getFetchSize()        throws SQLException    {		return getStatement().getFetchSize();	}    public final int getMaxFieldSize()        throws SQLException    {		return getStatement().getMaxFieldSize();	}    public final int getMaxRows()        throws SQLException    {		return getStatement().getMaxRows();	}    public final int getResultSetConcurrency()        throws SQLException    {		return getStatement().getResultSetConcurrency();	}    /**     * The maxFieldSize limit (in bytes) is set to limit the size of     * data that can be returned for any column value; it only applies     * to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and     * LONGVARCHAR fields.  If the limit is exceeded, the excess data     * is silently discarded.     *     * @param max the new max column size limit; zero means unlimited	 * @exception SQLException thrown on failure.     */	public final void setMaxFieldSize(int max) throws SQLException    {        getStatement().setMaxFieldSize(max);	}    /**     * The maxRows limit is set to limit the number of rows that any     * ResultSet can contain.  If the limit is exceeded, the excess     * rows are silently dropped.     *     * @param max the new max rows limit; zero means unlimited	 * @exception SQLException thrown on failure.     */	public final void setMaxRows(int max) throws SQLException		{        getStatement().setMaxRows( max);    }    /**     * If escape scanning is on (the default) the driver will do     * escape substitution before sending the SQL to the database.     *     * @param enable true to enable; false to disable	 * @exception SQLException thrown on failure.     */	public final void setEscapeProcessing(boolean enable) throws SQLException    {        getStatement().setEscapeProcessing( enable);		escapeProcessing = enable ? Boolean.TRUE : Boolean.FALSE;	}    /**     * The first warning reported by calls on this Statement is     * returned.  A Statment's execute methods clear its SQLWarning     * chain. Subsequent Statement warnings will be chained to this     * SQLWarning.     *     * <p>The warning chain is automatically cleared each time     * a statement is (re)executed.     *     * <P><B>Note:</B> If you are processing a ResultSet then any     * warnings associated with ResultSet reads will be chained on the     * ResultSet object.     *     * @return the first SQLWarning or null	 * @exception SQLException thrown on failure.     */	public final SQLWarning getWarnings() throws SQLException    {		return getStatement().getWarnings();	}    /**     * After this call getWarnings returns null until a new warning is     * reported for this Statement.	 * @exception SQLException thrown on failure.     */	public final void clearWarnings() throws SQLException    {		getStatement().clearWarnings();    }    /**     * setCursorName defines the SQL cursor name that will be used by     * subsequent Statement execute methods. This name can then be     * used in SQL positioned update/delete statements to identify the     * current row in the ResultSet generated by this getStatement().  If     * the database doesn't support positioned update/delete, this     * method is a noop.     *     * <P><B>Note:</B> By definition, positioned update/delete     * execution must be done by a different Statement than the one     * which generated the ResultSet being used for positioning. Also,     * cursor names must be unique within a Connection.     *     * @param name the new cursor name.     */	public final void setCursorName(String name) throws SQLException    {		getStatement().setCursorName( name);		cursorName = name;	}            /**     *  getResultSet returns the current result as a ResultSet.  It     *  should only be called once per result.     *     * @return the current result as a ResultSet; null if the result     * is an update count or there are no more results or the statement	 * was closed.     * @see #execute     */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -