public interface WebRowSet extends CachedRowSet
WebRowSet のすべての実装が実装しなければならない標準インタフェースです。
 
WebRowSetImpl は、必要に応じて拡張可能な標準リファレンス実装を提供します。
 標準 WebRowSet XML スキーマ定義は、次の URI で確認できます。
http://java.sun.com/xml/ns/jdbc/webrowset.xsdこのスキーマ定義は、XML で
RowSet を記述するときに必要な標準 XML ドキュメント形式について記述したものです。相互運用性を得るためには、WebRowSet インタフェースのすべての標準実装で、このスキーマ定義を使用する必要があります。WebRowSet スキーマは固有の SQL/XML スキーマ注釈を使用するので、プラットフォーム間の相互運用性がさらに向上します。なお、このスキーマ定義は、ISO 内で現在開発中です。SQL/XML 定義は、次の URI で確認できます。
 http://standards.iso.org/iso/9075/2002/12/sqlxmlこのスキーマ定義は、
RowSet オブジェクトの内部データを次の 3 つの領域から記述します。
 RowSet プロパティーに加えて、標準同期プロバイダのプロパティーを記述する。
 
WebRowSet オブジェクトの管理下にある表構造に関連付けられたメタデータについて記述する。記述されるメタデータは、配下の java.sql.ResultSet インタフェース内でアクセス可能なメタデータと密接に連携している。
 
WebRowSet オブジェクトを生成または同期してからのデータの状態) と現在のデータについて記述する。元のデータと現在のデータのデルタを追跡することにより、WebRowSet を元のデータソースと同期させることができる。
 
WebRowSet 実装で、XML スキーマを使用して、更新、挿入、または削除操作を記述し、XML での WebRowSet オブジェクトの状態を記述する方法について具体的に説明します。
 
WebRowSet オブジェクトの XML での出力
この例では、WebRowSet オブジェクトが、データソースから、2 列 × 5 行の単純な表形式で生成されます。WebRowSet オブジェクトに 5 行あるため、それらを XML で記述できます。RowSet インタフェースに定義されたさまざまな標準 JavaBeans プロパティーと、CachedRowSetTM インタフェースに定義された標準プロパティーとを記述するメタデータにより、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>
 
プロパティーとメタデータの記述内容を確認したところで、次に WebRowSet オブジェクトのコンテンツを XML で記述する方法について見ていきます。次に、インスタンスを生成してから一切変更されていない WebRowSet オブジェクトを説明します。currentRow タグは、WebRowSet オブジェクトの表構造の各行に対応しています。columnValue タグには、XML 値のマップ先の SQL 型によって、stringData または binaryData タグが入ります。binaryData タグは、通常、BLOB または CLOB 型データ用です。ここには、Base64 エンコード方式のデータが入ります。
 
 <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 オブジェクトの行の削除では、ほかの RowSet オブジェクトと同様に、単に削除する行に移動し、deleteRow メソッドを呼び出すだけです。次の 2 行のコード (この中では wrs が WebRowSet オブジェクト) で 3 行目を削除します。
 
     wrs.absolute(3);
     wrs.deleteRow();
 
XML の記述では、3 行目に deleteRow というマークが付き WebRowSet オブジェクトの 3 行目が排除されます。
 
 <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 オブジェクトは、挿入行に移動して、行の各列に対して適切な更新メソッドを呼び出し、insertRow メソッドを呼び出すことによって、新しい行を挿入できます。
 wrs.moveToInsertRow(); wrs.updateString(1, "fifththrow"); wrs.updateString(2, "5"); wrs.insertRow();次のコードの抜粋では、挿入したばかりの行の 2 列目の値を変更しています。このコードは、現在の行の直後に新しい行が挿入された場合に適用されます。このため、
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>
 | 修飾子と型 | フィールドと説明 | 
|---|---|
static String | 
PUBLIC_XML_SCHEMA
XML タグと、これらの XML タグの  
WebRowSet 実装での有効値を定義する、XML スキーマ定義の公開識別子です。 | 
static String | 
SCHEMA_SYSTEM_ID
XML タグと、これらの XML タグの  
WebRowSet 実装での有効値を定義する、XML スキーマ定義の URL です。 | 
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| 修飾子と型 | メソッドと説明 | 
|---|---|
void | 
readXml(InputStream iStream)
ストリームベースの XML 入力を読み込み、この  
WebRowSet オブジェクトを生成します。 | 
void | 
readXml(Reader reader)
指定された  
Reader オブジェクトから、XML 形式で WebRowSet オブジェクトを読み取ります。 | 
void | 
writeXml(OutputStream oStream)
この  
WebRowSet オブジェクトのデータ、プロパティー、メタデータを指定された OutputStream オブジェクトに XML 形式で書き込みます。 | 
void | 
writeXml(ResultSet rs,         OutputStream oStream)
指定された  
ResultSet オブジェクトの内容からこの WebRowSet オブジェクトを生成し、そのデータ、プロパティー、およびメタデータを指定された OutputStream オブジェクトに XML 形式で書き込みます。 | 
void | 
writeXml(ResultSet rs,         Writer writer)
指定された  
ResultSet オブジェクトの内容からこの WebRowSet オブジェクトを生成し、そのデータ、プロパティー、およびメタデータを指定された Writer オブジェクトに XML 形式で書き込みます。 | 
void | 
writeXml(Writer writer)
この  
WebRowSet オブジェクトのデータ、プロパティー、メタデータを指定された Writer オブジェクトに XML 形式で書き込みます。 | 
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, 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 実装での有効値を定義する、XML スキーマ定義の公開識別子です。void readXml(Reader reader) throws SQLException
Reader オブジェクトから、XML 形式で WebRowSet オブジェクトを読み取ります。reader - java.io.Reader ストリーム。ここから WebRowSet オブジェクトが生成されるSQLException - データベースアクセスエラーが発生した場合void readXml(InputStream iStream) throws SQLException, IOException
WebRowSet オブジェクトを生成します。iStream - java.io.InputStream ストリーム。ここから WebRowSet オブジェクトが生成されるSQLException - データソースアクセスエラーが発生した場合IOException - IO 例外が発生した場合void writeXml(ResultSet rs, Writer writer) throws SQLException
ResultSet オブジェクトの内容からこの WebRowSet オブジェクトを生成し、そのデータ、プロパティー、およびメタデータを指定された Writer オブジェクトに XML 形式で書き込みます。
 
注: WebRowSet カーソルは、XML データソースへコンテンツを書き出すために移動するかもしれません。このように実装されている場合、カーソルを、writeXml() 呼び出しの直前の位置に戻す必要があります。
rs - この WebRowSet オブジェクトを生成する ResultSet オブジェクトwriter - 書き込む java.io.Writer オブジェクト。SQLException - 行セットのコンテンツを XML 形式で書き出すときにエラーが発生した場合void writeXml(ResultSet rs, OutputStream oStream) throws SQLException, IOException
ResultSet オブジェクトの内容からこの WebRowSet オブジェクトを生成し、そのデータ、プロパティー、およびメタデータを指定された OutputStream オブジェクトに XML 形式で書き込みます。
 
注: WebRowSet カーソルは、XML データソースへコンテンツを書き出すために移動するかもしれません。このように実装されている場合、カーソルを、writeXml() 呼び出しの直前の位置に戻す必要があります。
rs - この WebRowSet オブジェクトを生成する ResultSet オブジェクトoStream - 書き込み先の java.io.OutputStreamSQLException - データソースアクセスエラーが発生した場合IOException - IO 例外が発生した場合void writeXml(Writer writer) throws SQLException
WebRowSet オブジェクトのデータ、プロパティー、メタデータを指定された Writer オブジェクトに XML 形式で書き込みます。writer - 書き込み先の java.io.Writer ストリームSQLException - 行セットのコンテンツを XML へ書き出すときにエラーが発生した場合void writeXml(OutputStream oStream) throws SQLException, IOException
WebRowSet オブジェクトのデータ、プロパティー、メタデータを指定された OutputStream オブジェクトに XML 形式で書き込みます。oStream - 書き込み先の java.io.OutputStream ストリームSQLException - データソースアクセスエラーが発生した場合IOException - IO 例外が発生した場合 バグまたは機能を送信 
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.