public class Jdbc4SqlXmlHandler extends Object implements SqlXmlHandler
SqlXmlHandler
interface.
Provides database-specific implementations for storing and
retrieving XML documents to and from fields in a database,
relying on the JDBC 4.0 java.sql.SQLXML
facility.SQLXML
,
ResultSet.getSQLXML(int)
,
PreparedStatement.setSQLXML(int, java.sql.SQLXML)
Constructor and Description |
---|
Jdbc4SqlXmlHandler() |
Modifier and Type | Method and Description |
---|---|
InputStream |
getXmlAsBinaryStream(ResultSet rs,
int columnIndex)
Retrieve the given column as binary stream from the given ResultSet.
|
InputStream |
getXmlAsBinaryStream(ResultSet rs,
String columnName)
Retrieve the given column as binary stream from the given ResultSet.
|
Reader |
getXmlAsCharacterStream(ResultSet rs,
int columnIndex)
Retrieve the given column as character stream from the given ResultSet.
|
Reader |
getXmlAsCharacterStream(ResultSet rs,
String columnName)
Retrieve the given column as character stream from the given ResultSet.
|
Source |
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.
|
Source |
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.
|
String |
getXmlAsString(ResultSet rs,
int columnIndex)
Retrieve the given column as String from the given ResultSet.
|
String |
getXmlAsString(ResultSet rs,
String columnName)
Retrieve the given column as String from the given ResultSet.
|
SqlXmlValue |
newSqlXmlValue(Class<? extends Result> resultClass,
XmlResultProvider provider)
Create a
SqlXmlValue instance for the given XML data,
as supported by the underlying JDBC driver. |
SqlXmlValue |
newSqlXmlValue(Document document)
Create a
SqlXmlValue instance for the given XML data,
as supported by the underlying JDBC driver. |
SqlXmlValue |
newSqlXmlValue(String value)
Create a
SqlXmlValue instance for the given XML data,
as supported by the underlying JDBC driver. |
SqlXmlValue |
newSqlXmlValue(XmlBinaryStreamProvider provider)
Create a
SqlXmlValue instance for the given XML data,
as supported by the underlying JDBC driver. |
SqlXmlValue |
newSqlXmlValue(XmlCharacterStreamProvider provider)
Create a
SqlXmlValue instance for the given XML data,
as supported by the underlying JDBC driver. |
public String getXmlAsString(ResultSet rs, String columnName) throws SQLException
SqlXmlHandler
Might simply invoke ResultSet.getString
or work with
SQLXML
or database-specific classes depending on the
database and driver.
getXmlAsString
in interface SqlXmlHandler
rs
- the ResultSet to retrieve the content fromcolumnName
- the column name to usenull
in case of SQL NULLSQLException
- if thrown by JDBC methodsResultSet.getString(int)
,
ResultSet.getSQLXML(int)
public String getXmlAsString(ResultSet rs, int columnIndex) throws SQLException
SqlXmlHandler
Might simply invoke ResultSet.getString
or work with
SQLXML
or database-specific classes depending on the
database and driver.
getXmlAsString
in interface SqlXmlHandler
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to usenull
in case of SQL NULLSQLException
- if thrown by JDBC methodsResultSet.getString(int)
,
ResultSet.getSQLXML(int)
public InputStream getXmlAsBinaryStream(ResultSet rs, String columnName) throws SQLException
SqlXmlHandler
Might simply invoke ResultSet.getAsciiStream
or work with
SQLXML
or database-specific classes depending on the
database and driver.
getXmlAsBinaryStream
in interface SqlXmlHandler
rs
- the ResultSet to retrieve the content fromcolumnName
- the column name to usenull
in case of SQL NULLSQLException
- if thrown by JDBC methodsResultSet.getSQLXML(int)
,
SQLXML.getBinaryStream()
public InputStream getXmlAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException
SqlXmlHandler
Might simply invoke ResultSet.getAsciiStream
or work with
SQLXML
or database-specific classes depending on the
database and driver.
getXmlAsBinaryStream
in interface SqlXmlHandler
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to usenull
in case of SQL NULLSQLException
- if thrown by JDBC methodsResultSet.getSQLXML(int)
,
SQLXML.getBinaryStream()
public Reader getXmlAsCharacterStream(ResultSet rs, String columnName) throws SQLException
SqlXmlHandler
Might simply invoke ResultSet.getCharacterStream
or work with
SQLXML
or database-specific classes depending on the
database and driver.
getXmlAsCharacterStream
in interface SqlXmlHandler
rs
- the ResultSet to retrieve the content fromcolumnName
- the column name to useSQLException
- if thrown by JDBC methodsResultSet.getSQLXML(int)
,
SQLXML.getCharacterStream()
public Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLException
SqlXmlHandler
Might simply invoke ResultSet.getCharacterStream
or work with
SQLXML
or database-specific classes depending on the
database and driver.
getXmlAsCharacterStream
in interface SqlXmlHandler
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to useSQLException
- if thrown by JDBC methodsResultSet.getSQLXML(int)
,
SQLXML.getCharacterStream()
public Source getXmlAsSource(ResultSet rs, String columnName, Class<? extends Source> sourceClass) throws SQLException
SqlXmlHandler
Might work with SQLXML
or database-specific classes depending
on the database and driver.
getXmlAsSource
in interface SqlXmlHandler
rs
- the ResultSet to retrieve the content fromcolumnName
- the column name to usesourceClass
- the implementation class to be usedSQLException
- if thrown by JDBC methodsResultSet.getSQLXML(int)
,
SQLXML.getSource(java.lang.Class<T>)
public Source getXmlAsSource(ResultSet rs, int columnIndex, Class<? extends Source> sourceClass) throws SQLException
SqlXmlHandler
Might work with SQLXML
or database-specific classes depending
on the database and driver.
getXmlAsSource
in interface SqlXmlHandler
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to usesourceClass
- the implementation class to be usedSQLException
- if thrown by JDBC methodsResultSet.getSQLXML(int)
,
SQLXML.getSource(java.lang.Class<T>)
public SqlXmlValue newSqlXmlValue(String value)
SqlXmlHandler
SqlXmlValue
instance for the given XML data,
as supported by the underlying JDBC driver.newSqlXmlValue
in interface SqlXmlHandler
value
- the XML String value providing XML dataSqlXmlValue
,
SQLXML.setString(String)
public SqlXmlValue newSqlXmlValue(XmlBinaryStreamProvider provider)
SqlXmlHandler
SqlXmlValue
instance for the given XML data,
as supported by the underlying JDBC driver.newSqlXmlValue
in interface SqlXmlHandler
provider
- the XmlBinaryStreamProvider
providing XML dataSqlXmlValue
,
SQLXML.setBinaryStream()
public SqlXmlValue newSqlXmlValue(XmlCharacterStreamProvider provider)
SqlXmlHandler
SqlXmlValue
instance for the given XML data,
as supported by the underlying JDBC driver.newSqlXmlValue
in interface SqlXmlHandler
provider
- the XmlCharacterStreamProvider
providing XML dataSqlXmlValue
,
SQLXML.setCharacterStream()
public SqlXmlValue newSqlXmlValue(Class<? extends Result> resultClass, XmlResultProvider provider)
SqlXmlHandler
SqlXmlValue
instance for the given XML data,
as supported by the underlying JDBC driver.newSqlXmlValue
in interface SqlXmlHandler
resultClass
- the Result implementation class to be usedprovider
- the XmlResultProvider
that will provide the XML dataSqlXmlValue
,
SQLXML.setResult(Class)
public SqlXmlValue newSqlXmlValue(Document document)
SqlXmlHandler
SqlXmlValue
instance for the given XML data,
as supported by the underlying JDBC driver.newSqlXmlValue
in interface SqlXmlHandler
document
- the XML Document to be usedSqlXmlValue