preparedstatementwrapper.java

来自「MySql Java Connector」· Java 代码 · 共 720 行 · 第 1/2 页

JAVA
720
字号
                ((PreparedStatement) this.wrappedStmt).setNull(parameterIndex,                    sqlType);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setNull(int, int, java.lang.String)     */    public void setNull(int parameterIndex, int sqlType, String typeName)        throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setNull(parameterIndex,                    sqlType, typeName);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setObject(int, java.lang.Object)     */    public void setObject(int parameterIndex, Object x)        throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setObject(parameterIndex,                    x);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setObject(int, java.lang.Object, int)     */    public void setObject(int parameterIndex, Object x, int targetSqlType)        throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setObject(parameterIndex,                    x, targetSqlType);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setObject(int, java.lang.Object, int, int)     */    public void setObject(int parameterIndex, Object x, int targetSqlType,        int scale) throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setObject(parameterIndex,                    x, scale);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#getParameterMetaData()     */    public ParameterMetaData getParameterMetaData() throws SQLException {        try {            if (this.wrappedStmt != null) {                return ((PreparedStatement) this.wrappedStmt)                .getParameterMetaData();            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        return null;    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setRef(int, java.sql.Ref)     */    public void setRef(int parameterIndex, Ref x) throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setRef(parameterIndex, x);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setShort(int, short)     */    public void setShort(int parameterIndex, short x) throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setShort(parameterIndex,                    x);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setString(int, java.lang.String)     */    public void setString(int parameterIndex, String x)        throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setString(parameterIndex,                    x);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setTime(int, java.sql.Time)     */    public void setTime(int parameterIndex, Time x) throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setTime(parameterIndex, x);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setTime(int, java.sql.Time, java.util.Calendar)     */    public void setTime(int parameterIndex, Time x, Calendar cal)        throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setTime(parameterIndex,                    x, cal);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp)     */    public void setTimestamp(int parameterIndex, Timestamp x)        throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setTimestamp(parameterIndex,                    x);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp, java.util.Calendar)     */    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)        throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setTimestamp(parameterIndex,                    x, cal);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#setURL(int, java.net.URL)     */    public void setURL(int parameterIndex, URL x) throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setURL(parameterIndex, x);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /**     * DOCUMENT ME!     *     * @param parameterIndex DOCUMENT ME!     * @param x DOCUMENT ME!     * @param length DOCUMENT ME!     *     * @throws SQLException DOCUMENT ME!     *     * @see java.sql.PreparedStatement#setUnicodeStream(int,     *      java.io.InputStream, int)     * @deprecated     */    public void setUnicodeStream(int parameterIndex, InputStream x, int length)        throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).setUnicodeStream(parameterIndex,                    x, length);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#addBatch()     */    public void addBatch() throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).addBatch();            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#clearParameters()     */    public void clearParameters() throws SQLException {        try {            if (this.wrappedStmt != null) {                ((PreparedStatement) this.wrappedStmt).clearParameters();            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#execute()     */    public boolean execute() throws SQLException {        try {            if (this.wrappedStmt != null) {                return ((PreparedStatement) this.wrappedStmt).execute();            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        return false; // we actually never get here, but the compiler can't figure         // that out    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#executeQuery()     */    public ResultSet executeQuery() throws SQLException {        try {            if (this.wrappedStmt != null) {                return ((PreparedStatement) this.wrappedStmt).executeQuery();            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        return null; // we actually never get here, but the compiler can't figure         // that out    }    /* (non-Javadoc)     * @see java.sql.PreparedStatement#executeUpdate()     */    public int executeUpdate() throws SQLException {        try {            if (this.wrappedStmt != null) {                return ((PreparedStatement) this.wrappedStmt).executeUpdate();            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        return -1; // we actually never get here, but the compiler can't figure         // that out    }}

⌨️ 快捷键说明

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