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

📄 jdbc4resultset.java

📁 mysql5.0 JDBC 驱动 放在glassfish或者tomcat的lib文件夹下就可以了
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	/**
	 * JDBC 4.0 Update a column with a character stream value. The updateXXX()
	 * methods are used to update column values in the current row, or the
	 * insert row. The updateXXX() methods do not update the underlying
	 * database, instead the updateRow() or insertRow() methods are called to
	 * update the database.
	 * 
	 * @param columnName
	 *            the name of the column
	 * @param reader
	 *            the stream to update the column with
	 * @param length
	 *            of the stream
	 * 
	 * @throws SQLException
	 *             if a database-access error occurs
	 */
	public void updateNCharacterStream(String columnName, Reader reader,
			int length) throws SQLException {
		updateNCharacterStream(findColumn(columnName), reader, length);
	}

	/**
	 * @see ResultSet#updateNClob(String, NClob)
	 */
	public void updateNClob(String columnName, NClob nClob) throws SQLException {
		updateNClob(findColumn(columnName), nClob);
	}
	
	public void updateRowId(int columnIndex, RowId x) throws SQLException {
		throw new NotUpdatable();
	}

	public void updateRowId(String columnName, RowId x) throws SQLException {
		updateRowId(findColumn(columnName), x);
	}

	public int getHoldability() throws SQLException {
		throw SQLError.notImplemented();
	}

	public RowId getRowId(int columnIndex) throws SQLException {
		throw SQLError.notImplemented();
	}

	public RowId getRowId(String columnLabel) throws SQLException {
		return getRowId(findColumn(columnLabel));
	}

	public SQLXML getSQLXML(int columnIndex) throws SQLException {
		checkColumnBounds(columnIndex);
		
		return new JDBC4MysqlSQLXML(this, columnIndex);
	}

	public SQLXML getSQLXML(String columnLabel) throws SQLException {
		return getSQLXML(findColumn(columnLabel));
	}

	public synchronized boolean isClosed() throws SQLException {
		return this.isClosed;
	}

	public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
		updateAsciiStream(findColumn(columnLabel), x);
		
	}

	public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
		updateAsciiStream(findColumn(columnLabel), x, length);
	}

	public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
		updateBinaryStream(findColumn(columnLabel), x);
	}

	public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
		updateBinaryStream(findColumn(columnLabel), x, length);
	}

	public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
		throw new NotUpdatable();
	}

	public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
		updateBlob(findColumn(columnLabel), inputStream);
	}

	public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
		updateBlob(findColumn(columnLabel), inputStream, length);
	}

	public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
		updateCharacterStream(findColumn(columnLabel), reader);
	}

	public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
		updateCharacterStream(findColumn(columnLabel), reader, length);
	}

	public void updateClob(int columnIndex, Reader reader) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateClob(String columnLabel, Reader reader) throws SQLException {
		updateClob(findColumn(columnLabel), reader);
	}

	public void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateClob(String columnLabel, Reader reader, long length) throws SQLException {
		updateClob(findColumn(columnLabel), reader, length);
	}

	public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
		updateNCharacterStream(findColumn(columnLabel), reader);
		
	}

	public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
		updateNCharacterStream(findColumn(columnLabel), reader, length);
	}

	public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateNClob(int columnIndex, Reader reader) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateNClob(String columnLabel, Reader reader) throws SQLException {
		updateNClob(findColumn(columnLabel), reader);
		
	}

	public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException {
		throw new NotUpdatable();
	}

	public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
		updateNClob(findColumn(columnLabel), reader, length);
	}

	public void updateNString(int columnIndex, String nString) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateNString(String columnLabel, String nString) throws SQLException {
		updateNString(findColumn(columnLabel), nString);
	}

	public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
		throw new NotUpdatable();
		
	}

	public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
		updateSQLXML(findColumn(columnLabel), xmlObject);
		
	}

	/**
     * Returns true if this either implements the interface argument or is directly or indirectly a wrapper
     * for an object that does. Returns false otherwise. If this implements the interface then return true,
     * else if this is a wrapper then return the result of recursively calling <code>isWrapperFor</code> on the wrapped
     * object. If this does not implement the interface and is not a wrapper, return false.
     * This method should be implemented as a low-cost operation compared to <code>unwrap</code> so that
     * callers can use this method to avoid expensive <code>unwrap</code> calls that may fail. If this method
     * returns true then calling <code>unwrap</code> with the same argument should succeed.
     *
     * @param interfaces a Class defining an interface.
     * @return true if this implements the interface or directly or indirectly wraps an object that does.
     * @throws java.sql.SQLException  if an error occurs while determining whether this is a wrapper
     * for an object with the given interface.
     * @since 1.6
     */
	public boolean isWrapperFor(Class<?> iface) throws SQLException {
		checkClosed();
		
		// This works for classes that aren't actually wrapping
		// anything
		return iface.isInstance(this);
	}

    /**
     * Returns an object that implements the given interface to allow access to non-standard methods,
     * or standard methods not exposed by the proxy.
     * The result may be either the object found to implement the interface or a proxy for that object.
     * If the receiver implements the interface then that is the object. If the receiver is a wrapper
     * and the wrapped object implements the interface then that is the object. Otherwise the object is
     *  the result of calling <code>unwrap</code> recursively on the wrapped object. If the receiver is not a
     * wrapper and does not implement the interface, then an <code>SQLException</code> is thrown.
     *
     * @param iface A Class defining an interface that the result must implement.
     * @return an object that implements the interface. May be a proxy for the actual implementing object.
     * @throws java.sql.SQLException If no object found that implements the interface 
     * @since 1.6
     */
    public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException {
    	try {
    		// This works for classes that aren't actually wrapping
    		// anything
            return iface.cast(this);
        } catch (ClassCastException cce) {
            throw SQLError.createSQLException("Unable to unwrap to " + iface.toString(), 
            		SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
        }
    }
}

⌨️ 快捷键说明

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