public interface WebRowSet extends CachedRowSet
WebRowSet必须实现的标准接口。
WebRowSetImpl提供了标准参考实现,如果需要可以扩展。
以下URI可以使用标准的WebRowSet XML Schema定义:
它描述描述时所要求的标准的XML文档格式RowSet在XML对象,并且必须在所有标准实现中使用WebRowSet界面以确保互操作性。
此外, WebRowSet架构使用特定的SQL / XML模式注释,从而确保更好的跨平台互操作性。
这正是ISO组织目前正在进行的一项工作。
以下URI可以使用SQL / XML定义:
模式定义描述了三个不同区域的RowSet对象的内部数据:
RowSet属性之外,这些属性描述了标准同步提供程序属性。 WebRowSet对象管理的表格结构相关联的元数据。 描述的元数据与在底层可访问元数据密切对准java.sql.ResultSet接口。 WebRowSet对象的最后一次填充或上一次同步以来的数据状态)和当前数据。 通过跟踪原始数据和当前数据之间的增量, WebRowSet保持将其数据中的更改同步回原始数据源的能力。 WebRowSet实现如何使用XML模式来描述更新,插入和删除操作以及描述XML中WebRowSet对象的状态。
WebRowSet对象到XML WebRowSet对象,并从数据源中创建一个简单的2列,5行表。
在WebRowSet对象中拥有5行可以用XML描述它们。
描述在RowSet接口定义加在所定义的标准属性的各种标准JavaBeans属性元数据CachedRowSet A“¢接口提供描述的WebRowSet属性键的信息。
使用标准的writeXml方法将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_UNCOMMITED</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>
描述WebRowSet组成的元数据在XML中描述,如下所述。
注意这两个列描述在column-definition标签之间。
<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>
详细描述了属性和元数据的描述,以下详细介绍了如何以XML描述WebRowSet对象的内容。
请注意,这描述了一个WebRowSet对象,自从实例化以来没有进行任何修改。
currentRow标签映射到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>
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>
WebRowSet对象可以通过移动到插入行来插入新行,为行中的每一列调用适当的updater方法,然后调用方法insertRow 。
wrs.moveToInsertRow(); wrs.updateString(1, "fifththrow"); wrs.updateString(2, "5"); wrs.insertRow();
以下代码片段更改刚插入的行中的第二列值。
请注意,当新行在当前行之后插入时,此代码适用,这就是为什么方法next将光标移动到正确的行。
调用方法acceptChanges将更改写入数据源。
wrs.moveToCurrentRow(); wrs.next(); wrs.updateString(2, "V"); wrs.acceptChanges();
在XML中描述这一点,演示了Java代码插入新行的位置,然后对单个字段上新插入的行执行更新。
<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>
wrs.absolute(5); wrs.updateString(1, "new4thRow"); wrs.updateString(2, "IV"); wrs.updateRow();
在XML中,这是由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>
JdbcRowSet , CachedRowSet , FilteredRowSet , JoinRowSet
| Modifier and Type | Field and Description |
|---|---|
static String |
PUBLIC_XML_SCHEMA
用于定义XML标签的XML模式定义的公共标识符及其对
WebRowSet实现的有效值。
|
static String |
SCHEMA_SYSTEM_ID
定义XML标签的XML Schema定义文件的URL及其对
WebRowSet实现的有效值。
|
COMMIT_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 |
|---|---|
void |
readXml(InputStream iStream)
读取基于流的XML输入来填充此
WebRowSet对象。
|
void |
readXml(Reader reader)
读取
WebRowSet在从给定的XML格式对象
Reader对象。
|
void |
writeXml(OutputStream oStream)
将此
WebRowSet对象的数据,属性和元数据以XML格式写入给定的
OutputStream对象。
|
void |
writeXml(ResultSet rs, OutputStream oStream)
使用给定的
ResultSet对象的内容填充此
WebRowSet对象,并将其数据,属性和元数据以XML格式写入给定的
OutputStream对象。
|
void |
writeXml(ResultSet rs, Writer writer)
使用给定的
ResultSet对象的内容填充此
WebRowSet对象,并将其数据,属性和元数据以XML格式写入给定的
Writer对象。
|
void |
writeXml(Writer writer)
将此
WebRowSet对象的数据,属性和元数据以XML格式写入给定的
Writer对象。
|
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, 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, unsetMatchColumnstatic final String PUBLIC_XML_SCHEMA
WebRowSet实现的有效值。
static final String SCHEMA_SYSTEM_ID
WebRowSet实现的有效值。
void readXml(Reader reader) throws SQLException
WebRowSet在从给定的XML格式对象
Reader对象。
reader - 将
java.io.Reader此
WebRowSet对象的
java.io.Reader流
SQLException - 如果发生数据库访问错误
void readXml(InputStream iStream) throws SQLException, IOException
WebRowSet对象。
iStream - 将
java.io.InputStream此
WebRowSet对象的java.io.InputStream
SQLException - 如果发生数据源访问错误
IOException - 如果发生IO异常
void writeXml(ResultSet rs, Writer writer) throws SQLException
ResultSet对象的内容填充此WebRowSet对象,并将其数据,属性和元数据以XML格式写入给定的Writer对象。
注意:可以移动WebRowSet游标将内容写入XML数据源。 如果以这种方式实现,光标必须在writeXml()调用之前返回到它的位置。
rs -在
ResultSet对象与填充此
WebRowSet对象
writer -
java.io.Writer对象。
SQLException - 如果发生错误,以XML格式写入行集内容
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异常
void writeXml(Writer writer) throws SQLException
WebRowSet对象的数据,属性和元数据以XML格式写入给定的
Writer对象。
writer -
java.io.Writer流
SQLException - 如果发生错误,将行集内容写入XML
void writeXml(OutputStream oStream) throws SQLException, IOException
WebRowSet对象的数据,属性和元数据以XML格式写入给定的
OutputStream对象。
oStream - 要写入的
java.io.OutputStream流
SQLException - 如果发生数据源访问错误
IOException - 如果发生IO异常
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.