-
- All Superinterfaces:
-
AutoCloseable,CachedRowSet,Joinable,ResultSet,RowSet,Wrapper
- All Known Subinterfaces:
-
FilteredRowSet,JoinRowSet
public interface WebRowSet extends CachedRowSet
WebRowSet所有实现必须实现的标准接口。1.0概述
WebRowSetImpl提供了标准参考实现,如果需要可以扩展。以下URI可以使用标准的WebRowSet XML Schema定义:
它描述了在XML中描述RowSet对象时所需的标准XML文档格式,并且必须使用WebRowSet接口的所有标准实现来确保互操作性。 此外,WebRowSet架构使用特定的SQL / XML模式注释,从而确保更高的跨平台互操作性。 这正是ISO组织目前正在进行的一项工作。 以下URI可以使用SQL / XML定义: 模式定义描述了三个不同区域中的RowSet对象的内部数据:- 属性 - 除了更一般的
RowSet属性之外,这些属性描述了标准同步提供程序属性。 - 元数据 - 这描述了与由
WebRowSet对象管理的表格结构相关联的元数据。 所描述的元数据与底层的java.sql.ResultSet接口中可访问的元数据密切对齐。 - 数据 - 这描述了原始数据(自
WebRowSet对象的最后一次填充或最后同步以来的数据状态)和当前数据。 通过跟踪原始数据和当前数据之间的增量,WebRowSet维护将其数据中的更改同步回原始数据源的能力。
2.0 WebRowSet状态
以下部分演示了WebRowSet实现应如何使用XML模式来描述更新,插入和删除操作以及描述XML中的WebRowSet对象的状态。2.1状态1 - 输出一个
在此示例中,将创建一个WebRowSet对象到XMLWebRowSet对象,并从数据源中创建一个简单的2列5行表。 在WebRowSet对象中拥有5行可以用XML描述它们。 描述RowSet接口中定义的各种标准JavaBean属性的元数据加上CachedRowSet界面中定义的标准属性,提供了描述WebRowSet属性的关键详细信息。 使用标准的writeXml方法将WebRowSet对象输出到XML将描述内部属性,如下所示:描述WebRowSet组成的元数据在XML中描述,如下所述。 注意这两个列描述在<properties> <command>select co1, col2 from test_table</command> <concurrency>1</concurrency> <datasource/> <escape-processing>true</escape-processing> <fetch-direction>0</fetch-direction> <fetch-size>0</fetch-size> <isolation-level>1</isolation-level> <key-columns/> <map/> <max-field-size>0</max-field-size> <max-rows>0</max-rows> <query-timeout>0</query-timeout> <read-only>false</read-only> <rowset-type>TRANSACTION_READ_UNCOMMITTED</rowset-type> <show-deleted>false</show-deleted> <table-name/> <url>jdbc:thin:oracle</url> <sync-provider> <sync-provider-name>.com.rowset.provider.RIOptimisticProvider</sync-provider-name> <sync-provider-vendor>Oracle Corporation</sync-provider-vendor> <sync-provider-version>1.0</sync-provider-name> <sync-provider-grade>LOW</sync-provider-grade> <data-source-lock>NONE</data-source-lock> </sync-provider> </properties>column-definition标签之间。详细描述了属性和元数据的描述,以下详细介绍了如何以XML描述<metadata> <column-count>2</column-count> <column-definition> <column-index>1</column-index> <auto-increment>false</auto-increment> <case-sensitive>true</case-sensitive> <currency>false</currency> <nullable>1</nullable> <signed>false</signed> <searchable>true</searchable> <column-display-size>10</column-display-size> <column-label>COL1</column-label> <column-name>COL1</column-name> <schema-name/> <column-precision>10</column-precision> <column-scale>0</column-scale> <table-name/> <catalog-name/> <column-type>1</column-type> <column-type-name>CHAR</column-type-name> </column-definition> <column-definition> <column-index>2</column-index> <auto-increment>false</auto-increment> <case-sensitive>false</case-sensitive> <currency>false</currency> <nullable>1</nullable> <signed>true</signed> <searchable>true</searchable> <column-display-size>39</column-display-size> <column-label>COL2</column-label> <column-name>COL2</column-name> <schema-name/> <column-precision>38</column-precision> <column-scale>0</column-scale> <table-name/> <catalog-name/> <column-type>3</column-type> <column-type-name>NUMBER</column-type-name> </column-definition> </metadata>WebRowSet对象的内容。 请注意,这描述了一个WebRowSet对象,自从实例化以来没有进行任何修改。 AcurrentRow标签映射到WebRowSet对象提供的表结构的每一行。 根据XML值映射回的SQL类型,columnValue标记可能包含stringData或binaryData标记。binaryData标记包含Base64编码中的数据,通常用于BLOB和CLOB类型数据。<data> <currentRow> <columnValue> firstrow </columnValue> <columnValue> 1 </columnValue> </currentRow> <currentRow> <columnValue> secondrow </columnValue> <columnValue> 2 </columnValue> </currentRow> <currentRow> <columnValue> thirdrow </columnValue> <columnValue> 3 </columnValue> </currentRow> <currentRow> <columnValue> fourthrow </columnValue> <columnValue> 4 </columnValue> </currentRow> </data>2.2状态2 - 删除行
删除WebRowSet对象中的一行只需移动到要删除的行,然后调用方法deleteRow,如同任何其他RowSet对象一样。 以下两行代码,其中wr是一个WebRowSet对象,删除第三行。wrs.absolute(3); wrs.deleteRow();XML描述显示第三行被标记为deleteRow,它消除了WebRowSet对象中的第三行。<data> <currentRow> <columnValue> firstrow </columnValue> <columnValue> 1 </columnValue> </currentRow> <currentRow> <columnValue> secondrow </columnValue> <columnValue> 2 </columnValue> </currentRow> <deleteRow> <columnValue> thirdrow </columnValue> <columnValue> 3 </columnValue> </deleteRow> <currentRow> <columnValue> fourthrow </columnValue> <columnValue> 4 </columnValue> </currentRow> </data>2.3状态3 - 插入行
一个WebRowSet对象可以通过移动到插入行来插入一个新行,为行中的每一列调用适当的updater方法,然后调用方法insertRow。以下代码片段更改刚插入的行中的第二列值。 请注意,当新行在当前行之后插入时,此代码适用,这就是为什么方法wrs.moveToInsertRow(); wrs.updateString(1, "fifththrow"); wrs.updateString(2, "5"); wrs.insertRow();next将光标移动到正确的行。 调用方法acceptChanges将更改写入数据源。在XML中描述这一点,演示了Java代码插入新行的位置,然后对单个字段上新插入的行执行更新。wrs.moveToCurrentRow(); wrs.next(); wrs.updateString(2, "V"); wrs.acceptChanges();<data> <currentRow> <columnValue> firstrow </columnValue> <columnValue> 1 </columnValue> </currentRow> <currentRow> <columnValue> secondrow </columnValue> <columnValue> 2 </columnValue> </currentRow> <currentRow> <columnValue> newthirdrow </columnValue> <columnValue> III </columnValue> </currentRow> <insertRow> <columnValue> fifthrow </columnValue> <columnValue> 5 </columnValue> <updateValue> V </updateValue> </insertRow> <currentRow> <columnValue> fourthrow </columnValue> <columnValue> 4 </columnValue> </currentRow> </date>2.4状态4 - 修改行
修改行会生成特定的XML,记录新值和被替换的值。 被替换的值变为原始值,新值将变为当前值。 以下代码将光标移动到特定行,执行一些修改,并在完成后更新行。在XML中,这是由wrs.absolute(5); wrs.updateString(1, "new4thRow"); wrs.updateString(2, "IV"); wrs.updateRow();modifyRow标签描述的。 原始值和新值都包含在标签内,用于原始行跟踪。<data> <currentRow> <columnValue> firstrow </columnValue> <columnValue> 1 </columnValue> </currentRow> <currentRow> <columnValue> secondrow </columnValue> <columnValue> 2 </columnValue> </currentRow> <currentRow> <columnValue> newthirdrow </columnValue> <columnValue> III </columnValue> </currentRow> <currentRow> <columnValue> fifthrow </columnValue> <columnValue> 5 </columnValue> </currentRow> <modifyRow> <columnValue> fourthrow </columnValue> <updateValue> new4thRow </updateValue> <columnValue> 4 </columnValue> <updateValue> IV </updateValue> </modifyRow> </data>- 从以下版本开始:
- 1.5
- 另请参见:
-
JdbcRowSet,CachedRowSet,FilteredRowSet,JoinRowSet
-
-
Field Summary
Fields Modifier and Type Field 描述 static StringPUBLIC_XML_SCHEMA用于定义XML标签的XML模式定义的公共标识符及其对于WebRowSet实现的WebRowSet。static StringSCHEMA_SYSTEM_ID定义XML标签的XML模式定义文件的URL及其对WebRowSet实现的WebRowSet。-
Fields inherited from interface javax.sql.rowset.CachedRowSet
COMMIT_ON_ACCEPT_CHANGES
-
Fields inherited from 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
-
-
方法摘要
所有方法 接口方法 抽象方法 Modifier and Type 方法 描述 voidreadXml(InputStream iStream)读取基于流的XML输入来填充此WebRowSet对象。voidreadXml(Reader reader)从给定的WebRowSet对象中读取其XML格式的Reader对象。voidwriteXml(OutputStream oStream)将此WebRowSet对象的数据,属性和元数据以XML格式写入给定的OutputStream对象。voidwriteXml(Writer writer)将此WebRowSet对象的数据,属性和元数据以XML格式写入给定的Writer对象。voidwriteXml(ResultSet rs, OutputStream oStream)使用给定的ResultSet对象的内容填充此WebRowSet对象,并将其数据,属性和元数据以XML格式写入给定的OutputStream对象。voidwriteXml(ResultSet rs, Writer writer)使用给定的ResultSet对象的内容填充此WebRowSet对象,并将其数据,属性和元数据以XML格式写入给定的Writer对象。-
Methods inherited from interface 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
-
Methods inherited from interface javax.sql.rowset.Joinable
getMatchColumnIndexes, getMatchColumnNames, setMatchColumn, setMatchColumn, setMatchColumn, setMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn
-
Methods inherited from interface 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
-
Methods inherited from interface 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
-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
字段详细信息
-
PUBLIC_XML_SCHEMA
static final String PUBLIC_XML_SCHEMA
用于定义XML标签的XML模式定义的公共标识符及其对于WebRowSet实现的WebRowSet。- 另请参见:
- Constant Field Values
-
SCHEMA_SYSTEM_ID
static final String SCHEMA_SYSTEM_ID
定义XML标签的XML模式定义文件的URL及其对于WebRowSet实现的WebRowSet。- 另请参见:
- Constant Field Values
-
-
方法详细信息
-
readXml
void readXml(Reader reader) throws SQLException
读取WebRowSet在从给定的XML格式对象Reader对象。- 参数
-
reader- 要填充此WebRowSet对象的java.io.Reader流 - 异常
-
SQLException- 如果发生数据库访问错误
-
readXml
void readXml(InputStream iStream) throws SQLException, IOException
读取基于流的XML输入来填充此WebRowSet对象。- 参数
-
iStream-所述java.io.InputStream从中此WebRowSet对象将被填充 - 异常
-
SQLException- 如果发生数据源访问错误 -
IOException- 如果发生IO异常
-
writeXml
void writeXml(ResultSet rs, Writer writer) throws SQLException
使用给定的ResultSet对象的内容填充此WebRowSet对象,并将其数据,属性和元数据以XML格式写入给定的Writer对象。注意:可能会移动
WebRowSet游标将内容写入XML数据源。 如果以这种方式实现,光标必须返回到writeXml()调用之前的位置。- 参数
-
rs-在ResultSet对象与填充此WebRowSet对象 -
writer- 要写入的java.io.Writer对象。 - 异常
-
SQLException- 如果发生错误,以XML格式写出行集内容
-
writeXml
void writeXml(ResultSet rs, OutputStream oStream) throws SQLException, IOException
使用给定的ResultSet对象的内容填充此WebRowSet对象,并将其数据,属性和元数据以XML格式写入给定的OutputStream对象。注意:可以移动
WebRowSet游标将内容写入XML数据源。 如果以这种方式实现,光标必须返回到writeXml()调用之前的位置。- 参数
-
rs-在ResultSet对象与填充此WebRowSet对象 -
oStream- 要写的java.io.OutputStream - 异常
-
SQLException- 如果发生数据源访问错误 -
IOException- 如果发生IO异常
-
writeXml
void writeXml(Writer writer) throws SQLException
将此WebRowSet对象的数据,属性和元数据以XML格式写入给定的Writer对象。- 参数
-
writer-java.io.Writer流 - 异常
-
SQLException- 如果发生错误,将行集内容写入XML
-
writeXml
void writeXml(OutputStream oStream) throws SQLException, IOException
将此WebRowSet对象的数据,属性和元数据以XML格式写入给定的OutputStream对象。- 参数
-
oStream- 要写入的java.io.OutputStream流 - 异常
-
SQLException- 如果发生数据源访问错误 -
IOException- 如果发生IO异常
-
-