Interface SqlXmlHandler
- All Known Implementing Classes:
Jdbc4SqlXmlHandler
JDBC 4.0 introduces the new data type java.sql.SQLXML
but most databases and their drivers currently rely on database-specific
data types and features.
Provides accessor methods for XML fields and acts as factory for
SqlXmlValue
instances.
- Since:
- 2.5.5
- Author:
- Thomas Risberg
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetXmlAsBinaryStream
(ResultSet rs, int columnIndex) Retrieve the given column as binary stream from the given ResultSet.getXmlAsBinaryStream
(ResultSet rs, String columnName) Retrieve the given column as binary stream from the given ResultSet.getXmlAsCharacterStream
(ResultSet rs, int columnIndex) Retrieve the given column as character stream from the given ResultSet.getXmlAsCharacterStream
(ResultSet rs, String columnName) Retrieve the given column as character stream from the given ResultSet.getXmlAsSource
(ResultSet rs, int columnIndex, Class<? extends Source> sourceClass) Retrieve the given column as Source implemented using the specified source class from the given ResultSet.getXmlAsSource
(ResultSet rs, String columnName, Class<? extends Source> sourceClass) Retrieve the given column as Source implemented using the specified source class from the given ResultSet.getXmlAsString
(ResultSet rs, int columnIndex) Retrieve the given column as String from the given ResultSet.getXmlAsString
(ResultSet rs, String columnName) Retrieve the given column as String from the given ResultSet.newSqlXmlValue
(Class<? extends Result> resultClass, XmlResultProvider provider) Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.newSqlXmlValue
(String value) Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.newSqlXmlValue
(XmlBinaryStreamProvider provider) Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.newSqlXmlValue
(XmlCharacterStreamProvider provider) Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.newSqlXmlValue
(Document doc) Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.
-
Method Details
-
getXmlAsString
Retrieve the given column as String from the given ResultSet.Might simply invoke
ResultSet.getString
or work withSQLXML
or database-specific classes depending on the database and driver.- Parameters:
rs
- the ResultSet to retrieve the content fromcolumnName
- the column name to use- Returns:
- the content as String, or
null
in case of SQL NULL - Throws:
SQLException
- if thrown by JDBC methods- See Also:
-
getXmlAsString
Retrieve the given column as String from the given ResultSet.Might simply invoke
ResultSet.getString
or work withSQLXML
or database-specific classes depending on the database and driver.- Parameters:
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to use- Returns:
- the content as String, or
null
in case of SQL NULL - Throws:
SQLException
- if thrown by JDBC methods- See Also:
-
getXmlAsBinaryStream
Retrieve the given column as binary stream from the given ResultSet.Might simply invoke
ResultSet.getAsciiStream
or work withSQLXML
or database-specific classes depending on the database and driver.- Parameters:
rs
- the ResultSet to retrieve the content fromcolumnName
- the column name to use- Returns:
- the content as a binary stream, or
null
in case of SQL NULL - Throws:
SQLException
- if thrown by JDBC methods- See Also:
-
getXmlAsBinaryStream
Retrieve the given column as binary stream from the given ResultSet.Might simply invoke
ResultSet.getAsciiStream
or work withSQLXML
or database-specific classes depending on the database and driver.- Parameters:
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to use- Returns:
- the content as binary stream, or
null
in case of SQL NULL - Throws:
SQLException
- if thrown by JDBC methods- See Also:
-
getXmlAsCharacterStream
Retrieve the given column as character stream from the given ResultSet.Might simply invoke
ResultSet.getCharacterStream
or work withSQLXML
or database-specific classes depending on the database and driver.- Parameters:
rs
- the ResultSet to retrieve the content fromcolumnName
- the column name to use- Returns:
- the content as character stream, or
null
in case of SQL NULL - Throws:
SQLException
- if thrown by JDBC methods- See Also:
-
getXmlAsCharacterStream
Retrieve the given column as character stream from the given ResultSet.Might simply invoke
ResultSet.getCharacterStream
or work withSQLXML
or database-specific classes depending on the database and driver.- Parameters:
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to use- Returns:
- the content as character stream, or
null
in case of SQL NULL - Throws:
SQLException
- if thrown by JDBC methods- See Also:
-
getXmlAsSource
@Nullable Source getXmlAsSource(ResultSet rs, String columnName, @Nullable Class<? extends Source> sourceClass) throws SQLException Retrieve the given column as Source implemented using the specified source class from the given ResultSet.Might work with
SQLXML
or database-specific classes depending on the database and driver.- Parameters:
rs
- the ResultSet to retrieve the content fromcolumnName
- the column name to usesourceClass
- the implementation class to be used- Returns:
- the content as character stream, or
null
in case of SQL NULL - Throws:
SQLException
- if thrown by JDBC methods- See Also:
-
getXmlAsSource
@Nullable Source getXmlAsSource(ResultSet rs, int columnIndex, @Nullable Class<? extends Source> sourceClass) throws SQLException Retrieve the given column as Source implemented using the specified source class from the given ResultSet.Might work with
SQLXML
or database-specific classes depending on the database and driver.- Parameters:
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to usesourceClass
- the implementation class to be used- Returns:
- the content as character stream, or
null
in case of SQL NULL - Throws:
SQLException
- if thrown by JDBC methods- See Also:
-
newSqlXmlValue
Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.- Parameters:
value
- the XML String value providing XML data- Returns:
- the implementation specific instance
- See Also:
-
newSqlXmlValue
Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.- Parameters:
provider
- theXmlBinaryStreamProvider
providing XML data- Returns:
- the implementation specific instance
- See Also:
-
newSqlXmlValue
Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.- Parameters:
provider
- theXmlCharacterStreamProvider
providing XML data- Returns:
- the implementation specific instance
- See Also:
-
newSqlXmlValue
Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.- Parameters:
resultClass
- the Result implementation class to be usedprovider
- theXmlResultProvider
that will provide the XML data- Returns:
- the implementation specific instance
- See Also:
-
newSqlXmlValue
Create aSqlXmlValue
instance for the given XML data, as supported by the underlying JDBC driver.- Parameters:
doc
- the XML Document to be used- Returns:
- the implementation specific instance
- See Also:
-