-
- All Superinterfaces:
-
AutoCloseable,CachedRowSet,Joinable,ResultSet,RowSet,WebRowSet,Wrapper
public interface FilteredRowSet extends WebRowSet
FilteredRowSet所有标准实现必须实现的标准接口。FilteredRowSetImpl类提供了参考实现,如果需要可以扩展。 或者,供应商可以通过实现此接口自由实现其自己的版本。1.0背景
有时,RowSet对象需要对其内容提供一定程度的过滤。 一种可能的解决方案是为所有标准RowSet实现提供查询语言; 但是,对于轻量级组件,例如断开连接的RowSet对象,这是一种不切实际的方法。FilteredRowSet接口旨在满足此需求,而无需提供重量级查询语言以及此类查询语言所需的处理。JDBC
FilteredRowSet标准实现实现了RowSet接口并扩展了CachedRowSet¢类。CachedRowSet类提供了一组受保护的游标操作方法,FilteredRowSet实现可以覆盖这些方法以提供过滤支持。2.0谓词共享
如果在父接口中使用继承的createShared方法共享FilteredRowSet实现,则应共享Predicate而不进行所有FilteredRowSet实例克隆的修改。3.0用法
通过实现
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 returnedPredicate接口的Range对象。 此对象表示以下约束:从此FilteredRowSet对象输出或修改的所有行必须位于“columnName”列中的值“Alpha”和“Bravo”两个值之间。 如果过滤器应用于不包含在过滤器范围内的数据的FilteredRowSet对象,则不返回任何行。该框架允许实现谓词的多个类组合使用以实现所需的过滤结果,而不需要查询语言处理。
4.0更新
一个上设置的谓词FilteredRowSet对象FilteredRowSet对象适用于在所有行的标准RowSet对象的管理行的一个子集RowSet对象。 此标准管理可见行的子集,还定义可以修改,删除或插入哪些行。因此,必须将
FilteredRowSet对象上设置的谓词视为双向,并将设置标准视为所有视图和更新FilteredRowSet对象的选通机制。 任何更新违反标准的FilteredRowSet尝试都将导致抛出SQLException对象。可以通过随时将新的
Predicate对象应用于FilteredRowSet实例来修改FilteredRowSet范围标准。 如果未检测到对FilteredRowSet对象的其他引用,则可以执行此操作。 新过滤器会立即影响FilteredRowSet对象中的标准强制执行,并且所有后续视图和更新都将受到类似的强制执行。5.0过滤器外部行的行为
在删除过滤器或应用新过滤器之前,无法修改FilteredRowSet对象上的过滤器集之外的行。此外,只有属于过滤器范围的行才会与数据源同步。
- 从以下版本开始:
- 1.5
-
-
字段汇总
-
Fields declared in interface javax.sql.rowset.CachedRowSet
COMMIT_ON_ACCEPT_CHANGES
-
Fields declared in interface java.sql.ResultSet
CLOSE_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
-
Fields declared in interface javax.sql.rowset.WebRowSet
PUBLIC_XML_SCHEMA, SCHEMA_SYSTEM_ID
-
-
方法摘要
所有方法 实例方法 抽象方法 变量和类型 方法 描述 PredicategetFilter()检索此FilteredRowSet对象的活动过滤器。voidsetFilter(Predicate p)将给定的Predicate对象应用于此FilteredRowSet对象。-
声明方法的接口 javax.sql.rowset.CachedRowSet
acceptChanges, 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, undoUpdate
-
声明方法的接口 javax.sql.rowset.Joinable
getMatchColumnIndexes, getMatchColumnNames, setMatchColumn, setMatchColumn, setMatchColumn, setMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn
-
声明方法的接口 java.sql.ResultSet
absolute, 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, wasNull
-
声明方法的接口 javax.sql.RowSet
addRowSetListener, 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, setUsername
-
声明方法的接口 java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
方法详细信息
-
setFilter
void setFilter(Predicate p) throws SQLException
将给定的Predicate对象应用于此FilteredRowSet对象。 过滤器将控制应用于入站和出站视图,约束哪些行可见以及哪些行可以操作。可以随时设置新的
Predicate对象。 这具有更改RowSet对象数据的约束的效果。 此外,在运行时修改所述滤波器呈现由此多个组件可以在一个进行操作的问题FilteredRowSet对象。 应用程序开发人员必须负责在FilteredRowSetPredicate对象更改时管理FilteredRowSet对象的多个句柄。- 参数
-
p-一个Predicate对象限定过滤器用于此FilteredRowSet对象。 设置空值将清除谓词,允许所有行变为可见。 - 异常
-
SQLException- 如果在设置Predicate对象时发生错误
-
getFilter
Predicate getFilter()
检索此FilteredRowSet对象的活动过滤器。- 结果
-
p中
Predicate此FilteredRowSet对象;null如果未设置过滤器。
-
-