public interface FilteredRowSet extends WebRowSet
FilteredRowSet必须实现的标准接口。
FilteredRowSetImpl类提供了参考实现,如果需要可以扩展。
或者,供应商可以通过实现此接口来自由实现自己的版本。
RowSet对象需要为其内容提供一定程度的过滤。
一个可能的解决方案是为所有标准的RowSet实现提供查询语言;
然而,对于诸如断开RowSet对象的轻量级组件,这是一种不切实际的方法。
FilteredRowSet接口旨在满足这种需求,而不提供重量级查询语言以及这种查询语言将需要的处理。
一个JDBC FilteredRowSet标准实现实现RowSet接口,并扩展了CachedRowSet ¢类。 CachedRowSet类提供了一组受保护的游标操作方法, FilteredRowSet实现可以覆盖以提供过滤支持。
FilteredRowSet接口中使用继承的createShared方法共享一个FilteredRowSet实现,则Predicate应该由所有FilteredRowSet实例克隆共享,而无需修改。
通过实施Predicate (参见实施例在Predicate类的JavaDoc),一个FilteredRowSet如下所述然后可以使用。
FilteredRowSet frs = new FilteredRowSetImpl(); frs.populate(rs); Range name = new Range("Alpha", "Bravo", "columnName"); frs.setFilter(name); frs.next() // only names from "Alpha" to "Bravo" will be returned
在上面的例子中,我们初始化Range对象它实现了Predicate接口。
此对象表示以下约束:从此FilteredRowSet对象输出或修改的所有行都必须位于“columnName”列之间的值“Alpha”和“Bravo”两个值之间。
如果过滤器应用于不包含在过滤器范围内的数据的FilteredRowSet对象,则不返回任何行。
该框架允许多个实现谓词的类被组合使用以实现所需的过滤结果,而不需要查询语言处理。
FilteredRowSet对象 FilteredRowSet对象适用于在所有行的标准RowSet对象的管理行的一个子集RowSet对象。
此标准管理可见的行的子集,并且还定义可以修改,删除或插入哪些行。
因此,在FilteredRowSet对象上设置的FilteredRowSet必须被视为双向的,并且设置的标准作为所有视图和FilteredRowSet对象更新的选通机制。 更新任何试图FilteredRowSet违反该标准将导致SQLException物体被抛出。
可以随时通过将Predicate对象应用于FilteredRowSet实例来修改FilteredRowSet范围标准。 如果没有检测到对FilteredRowSet对象的FilteredRowSet引用,这是可能的。 新的过滤器对FilteredRowSet对象中的标准执行产生了立即的影响,所有后续视图和更新都将受到类似的强制执行。
FilteredRowSet对象上设置的过滤器之外的行。
此外,只有落在过滤器范围内的行才能与数据源同步。
PUBLIC_XML_SCHEMA, SCHEMA_SYSTEM_IDCOMMIT_ON_ACCEPT_CHANGESCLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE| Modifier and Type | Method and Description |
|---|---|
Predicate |
getFilter()
检索此
FilteredRowSet对象的活动过滤器。
|
void |
setFilter(Predicate p)
将给定的
Predicate对象应用于此
FilteredRowSet对象。
|
readXml, readXml, writeXml, writeXml, writeXml, writeXmlacceptChanges, acceptChanges, columnUpdated, columnUpdated, commit, createCopy, createCopyNoConstraints, createCopySchema, createShared, execute, getKeyColumns, getOriginal, getOriginalRow, getPageSize, getRowSetWarnings, getShowDeleted, getSyncProvider, getTableName, nextPage, populate, populate, previousPage, release, restoreOriginal, rollback, rollback, rowSetPopulated, setKeyColumns, setMetaData, setOriginalRow, setPageSize, setShowDeleted, setSyncProvider, setTableName, size, toCollection, toCollection, toCollection, undoDelete, undoInsert, undoUpdateaddRowSetListener, clearParameters, execute, getCommand, getDataSourceName, getEscapeProcessing, getMaxFieldSize, getMaxRows, getPassword, getQueryTimeout, getTransactionIsolation, getTypeMap, getUrl, getUsername, isReadOnly, removeRowSetListener, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBlob, setBlob, setBlob, setBoolean, setBoolean, setByte, setByte, setBytes, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setClob, setClob, setClob, setCommand, setConcurrency, setDataSourceName, setDate, setDate, setDate, setDate, setDouble, setDouble, setEscapeProcessing, setFloat, setFloat, setInt, setInt, setLong, setLong, setMaxFieldSize, setMaxRows, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNClob, setNClob, setNClob, setNString, setNString, setNull, setNull, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setObject, setPassword, setQueryTimeout, setReadOnly, setRef, setRowId, setRowId, setShort, setShort, setSQLXML, setSQLXML, setString, setString, setTime, setTime, setTime, setTime, setTimestamp, setTimestamp, setTimestamp, setTimestamp, setTransactionIsolation, setType, setTypeMap, setURL, setUrl, setUsernameabsolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getMetaData, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNullisWrapperFor, unwrapgetMatchColumnIndexes, getMatchColumnNames, setMatchColumn, setMatchColumn, setMatchColumn, setMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumnvoid setFilter(Predicate p) throws SQLException
Predicate对象应用于此FilteredRowSet对象。
过滤器对入站和出站视图都应用控件,约束哪些行是可见的,哪些行可以被操纵。
可以随时设置新的Predicate对象。 这具有改变RowSet对象数据的RowSet的作用。 此外,在运行时修改过滤器会提出一些问题,即多个组件可能在一个FilteredRowSet对象上运行。 应用程序开发人员必须负责管理FilteredRowSet对象在Predicate对象变化时的多个句柄。
p - 一个Predicate对象定义此FilteredRowSet对象的过滤器。
设置空值将清除谓词,允许所有行变为可见。
SQLException - 如果在设置
Predicate对象时发生错误
Predicate getFilter()
FilteredRowSet对象的活动过滤器。
Predicate为这个FilteredRowSet对象;
如果没有设置过滤器, null 。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.