|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
public interface WebRowSet
���� 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
������ڲ����ݣ�
RowSet
����֮�⣬��Щ���Ի�������ͬ���ṩ�����ԡ�
WebRowSet
��������ı���ṹ������Ԫ���ݡ�������Ԫ�������ڵײ� java.sql.ResultSet
�ӿ��пɷ��ʵ�Ԫ�����ǽ�����ϵ��һ��ġ�
WebRowSet
�������һ��������һ��ͬ������������״̬���͵�ǰ���ݡ�ͨ������ԭʼ���ݺ͵�ǰ����֮��� delta��WebRowSet
ά���������еĸ�����ԭʼ����Դͬ����������
WebRowSet
ʵ��Ӧ�����ʹ�� XML ģʽ���������¡������ɾ���������Լ����� XML �� WebRowSet
�����״̬��
WebRowSet
�������Ϊ XMLWebRowSet
����ʹ��ȡ������Դ��һ���� 2 �С�5 �б�������䡣���� WebRowSet
�����е� 5 ����ʹ�� XML �������dz�Ϊ���ܡ������� RowSet �ӿ��ж���ĸ��ֱ� JavaBeans ���Ժ��� CachedRowSet
TM �ӿ��ж���ı����Ե�Ԫ���ݣ��ṩ���� 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>Sun Microsystems</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
�������ṩ�ı��ṹ��ÿһ���С�columnValue
��ǿ��ܰ��� stringData
�� binaryData
��ǣ���ȡ���ڽ� XML ֵӳ��ص� SQL ���͡�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
����һ�����������������У����� wrs Ϊ 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
����������еķ�ʽ�ǣ��ƶ��������У�Ϊ�����е�ÿһ�е����ʵ��ĸ��·�����Ȼ����� 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
�ֶ�ժҪ | |
---|---|
static String |
PUBLIC_XML_SCHEMA
Ϊ WebRowSet ʵ�ֶ��� XML ��Ǽ�����Чֵ�� XML ģʽ����Ĺ�����ʶ���� |
static String |
SCHEMA_SYSTEM_ID
Ϊ WebRowSet ʵ�ֶ��� XML ��Ǽ�����Чֵ�� XML ģʽ����� URL�� |
�ӽӿ� javax.sql.rowset.CachedRowSet �̳е��ֶ� |
---|
COMMIT_ON_ACCEPT_CHANGES |
����ժҪ | |
---|---|
void |
readXml(InputStream iStream)
��ȡ�������� XML ���룬������ WebRowSet ���� |
void |
readXml(Reader reader)
�Ӹ����� Reader �������� XML ��ʽ��ȡ WebRowSet ���� |
void |
writeXml(OutputStream oStream)
�� XML ��ʽ���� WebRowSet ��������ݡ����Ժ�Ԫ����д������� 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)
�� XML ��ʽ���� WebRowSet ��������ݡ����Ժ�Ԫ����д������� Writer ���� |
�ӽӿ� java.sql.Wrapper �̳еķ��� |
---|
isWrapperFor, unwrap |
�ӽӿ� javax.sql.rowset.Joinable �̳еķ��� |
---|
getMatchColumnIndexes, getMatchColumnNames, setMatchColumn, setMatchColumn, setMatchColumn, setMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn |
�ֶ���ϸ��Ϣ |
---|
static final String PUBLIC_XML_SCHEMA
WebRowSet
ʵ�ֶ��� XML ��Ǽ�����Чֵ�� XML ģʽ����Ĺ�����ʶ����
static final String SCHEMA_SYSTEM_ID
WebRowSet
ʵ�ֶ��� XML ��Ǽ�����Чֵ�� XML ģʽ����� URL��
������ϸ��Ϣ |
---|
void readXml(Reader reader) throws SQLException
Reader
�������� XML ��ʽ��ȡ WebRowSet
����
reader
- �������� WebRowSet
����� java.io.Reader
����
SQLException
- ����������ݿ���ʴ���void readXml(InputStream iStream) throws SQLException, IOException
WebRowSet
����
iStream
- �������� WebRowSet
����� java.io.InputStream
SQLException
- �����������Դ���ʴ���
IOException
- ������� IO �쳣void writeXml(ResultSet rs, Writer writer) throws SQLException
ResultSet
������������� WebRowSet
������ XML ��ʽ�������ݡ����Ժ�Ԫ����д������� Writer
����
ע�������ƶ� WebRowSet
ָ�뽫����д���� XML ����Դ�С���������ַ�ʽʵ�֣����ڵ��� writeXml()
֮ǰָ�������ȷ�����λ�á�
rs
- �������� WebRowSet
����� ResultSet
����writer
- Ҫд��� java.io.Writer
����
SQLException
- ������� XML ��ʽд�� rowset ����ʱ��������void writeXml(ResultSet rs, OutputStream oStream) throws SQLException, IOException
ResultSet
������������� WebRowSet
������ XML ��ʽ�������ݡ����Ժ�Ԫ����д������� OutputStream
����
ע�������ƶ� WebRowSet
ָ�뽫����д���� XML ����Դ�С���������ַ�ʽʵ�֣����ڵ��� writeXml()
֮ǰ�����Ƚ�ָ�뷵����λ�á�
rs
- �������� WebRowSet
����� ResultSet
����oStream
- Ҫд��� java.io.OutputStream
SQLException
- �����������Դ���ʴ���
IOException
- ������� IO �쳣void writeXml(Writer writer) throws SQLException
WebRowSet
��������ݡ����Ժ�Ԫ����д������� Writer
����
writer
- Ҫд��� java.io.Writer
��
SQLException
- ����ڽ� rowset ����д���� XML ʱ����void writeXml(OutputStream oStream) throws SQLException, IOException
WebRowSet
��������ݡ����Ժ�Ԫ����д������� OutputStream
����
oStream
- Ҫд��� java.io.OutputStream
��
SQLException
- �����������Դ���ʴ���
IOException
- ������� IO �쳣
|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
��Ȩ���� 2007 Sun Microsystems, Inc. ��������Ȩ���� ����������֤��������������ĵ����·ַ�������