java.sql
Interface SQLXML


public interface SQLXML

The mapping in JavaTM for the SQL XML type. SQL XML is a built-in type that stores XML as a column value in a row of a database table. An SQLXML object is valid for the duration of the transaction in which it was created.The SQLXML interface provides methods for getting a string representation of the SQL XML value and for generating a StAX stream representation of the XML value. Methods in the interfaces ResultSet, CallableStatement, and PreparedStatement, such as getXml and setXml allow a programmer to access an SQL XML value. In addition, this interface also includes methods for updating an XML value.

Since:
1.6

Method Summary
 javax.xml.stream.XMLStreamReader createXMLStreamReader()
          Returns a reader that will produce the events corresponding to the XML returned by the data
 javax.xml.stream.XMLStreamWriter createXMLStreamWriter()
          Returns a writer that will populate the stream with XML events.
 void free()
          This method closes the SQLXML object and releases the resources that it held.
 String getString()
          Retrieves a string representation of the XML value designated by this SQLXML object.
 boolean isEmpty()
          Denotes whether the SQLXML object is empty.
 int setString(String str)
          Writes the given Java String to the XML value that this SQLXML object designates.
 

Method Detail

free

void free()
          throws SQLException
This method closes the SQLXML object and releases the resources that it held. The object is invalid once the free method is called. If free is called multiple times, the subsequent calls to free are treated as a no-op.

Throws:
SQLException - if an error occurs in releasing the SQLXML resources
Since:
1.6

createXMLStreamReader

javax.xml.stream.XMLStreamReader createXMLStreamReader()
                                                       throws SQLException
Returns a reader that will produce the events corresponding to the XML returned by the data

Returns:
a javax.xml.stream.XMLStreamReader object containing the XML
Throws:
SQLException - if there is an error accessing the XML value
Since:
1.6

createXMLStreamWriter

javax.xml.stream.XMLStreamWriter createXMLStreamWriter()
                                                       throws SQLException
Returns a writer that will populate the stream with XML events. This is empty until the returned writer's close method is called.

Returns:
a javax.xml.stream.XMLStreamWriter object
Throws:
SQLException - if the receiver is not empty
Since:
1.6

getString

String getString()
                 throws SQLException
Retrieves a string representation of the XML value designated by this SQLXML object.

Returns:
a String that is the string representation of the XML value
Throws:
SQLException - if there is an error accessing the XML value
Since:
1.6

setString

int setString(String str)
              throws SQLException
Writes the given Java String to the XML value that this SQLXML object designates.

Parameters:
str - the string to be written to the XML value that this SQLXML designates
Returns:
the number of characters written
Throws:
SQLException - if there is an error accessing the XML value
Since:
1.6

isEmpty

boolean isEmpty()
                throws SQLException
Denotes whether the SQLXML object is empty.

Returns:
true if the object is empty; false otherwise
Throws:
SQLException - if there is an error accessing the XML value
Since:
1.6