接口 SqlXmlHandler
- 所有已知实现类:
Jdbc4SqlXmlHandler
public interface SqlXmlHandler
Abstraction for handling XML fields in specific databases. Its main purpose is to isolate database-specific handling of XML stored in the database.JDBC 4.0 introduces the new data type
java.sql.SQLXMLbut 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
SqlXmlValueinstances.- 从以下版本开始:
- 2.5.5
- 作者:
- Thomas Risberg
- 另请参阅:
Jdbc4SqlXmlHandler,SQLXML,ResultSet.getSQLXML(int),PreparedStatement.setSQLXML(int, java.sql.SQLXML)
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 InputStreamgetXmlAsBinaryStream(ResultSet rs, int columnIndex)Retrieve the given column as binary stream from the given ResultSet.InputStreamgetXmlAsBinaryStream(ResultSet rs, String columnName)Retrieve the given column as binary stream from the given ResultSet.ReadergetXmlAsCharacterStream(ResultSet rs, int columnIndex)Retrieve the given column as character stream from the given ResultSet.ReadergetXmlAsCharacterStream(ResultSet rs, String columnName)Retrieve the given column as character stream from the given ResultSet.SourcegetXmlAsSource(ResultSet rs, int columnIndex, Class<? extends Source> sourceClass)Retrieve the given column as Source implemented using the specified source class from the given ResultSet.SourcegetXmlAsSource(ResultSet rs, String columnName, Class<? extends Source> sourceClass)Retrieve the given column as Source implemented using the specified source class from the given ResultSet.StringgetXmlAsString(ResultSet rs, int columnIndex)Retrieve the given column as String from the given ResultSet.StringgetXmlAsString(ResultSet rs, String columnName)Retrieve the given column as String from the given ResultSet.SqlXmlValuenewSqlXmlValue(Class<? extends Result> resultClass, XmlResultProvider provider)Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.SqlXmlValuenewSqlXmlValue(String value)Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.SqlXmlValuenewSqlXmlValue(XmlBinaryStreamProvider provider)Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.SqlXmlValuenewSqlXmlValue(XmlCharacterStreamProvider provider)Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.SqlXmlValuenewSqlXmlValue(Document doc)Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.
方法详细资料
getXmlAsString
@Nullable String getXmlAsString(ResultSet rs, String columnName) throws SQLException
Retrieve the given column as String from the given ResultSet.Might simply invoke
ResultSet.getStringor work withSQLXMLor database-specific classes depending on the database and driver.- 参数:
rs- the ResultSet to retrieve the content fromcolumnName- the column name to use- 返回:
- the content as String, or
nullin case of SQL NULL - 抛出:
SQLException- if thrown by JDBC methods- 另请参阅:
ResultSet.getString(int),ResultSet.getSQLXML(int)
getXmlAsString
@Nullable String getXmlAsString(ResultSet rs, int columnIndex) throws SQLException
Retrieve the given column as String from the given ResultSet.Might simply invoke
ResultSet.getStringor work withSQLXMLor database-specific classes depending on the database and driver.- 参数:
rs- the ResultSet to retrieve the content fromcolumnIndex- the column index to use- 返回:
- the content as String, or
nullin case of SQL NULL - 抛出:
SQLException- if thrown by JDBC methods- 另请参阅:
ResultSet.getString(int),ResultSet.getSQLXML(int)
getXmlAsBinaryStream
@Nullable InputStream getXmlAsBinaryStream(ResultSet rs, String columnName) throws SQLException
Retrieve the given column as binary stream from the given ResultSet.Might simply invoke
ResultSet.getAsciiStreamor work withSQLXMLor database-specific classes depending on the database and driver.- 参数:
rs- the ResultSet to retrieve the content fromcolumnName- the column name to use- 返回:
- the content as a binary stream, or
nullin case of SQL NULL - 抛出:
SQLException- if thrown by JDBC methods- 另请参阅:
ResultSet.getSQLXML(int),SQLXML.getBinaryStream()
getXmlAsBinaryStream
@Nullable InputStream getXmlAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException
Retrieve the given column as binary stream from the given ResultSet.Might simply invoke
ResultSet.getAsciiStreamor work withSQLXMLor database-specific classes depending on the database and driver.- 参数:
rs- the ResultSet to retrieve the content fromcolumnIndex- the column index to use- 返回:
- the content as binary stream, or
nullin case of SQL NULL - 抛出:
SQLException- if thrown by JDBC methods- 另请参阅:
ResultSet.getSQLXML(int),SQLXML.getBinaryStream()
getXmlAsCharacterStream
@Nullable Reader getXmlAsCharacterStream(ResultSet rs, String columnName) throws SQLException
Retrieve the given column as character stream from the given ResultSet.Might simply invoke
ResultSet.getCharacterStreamor work withSQLXMLor database-specific classes depending on the database and driver.- 参数:
rs- the ResultSet to retrieve the content fromcolumnName- the column name to use- 返回:
- the content as character stream, or
nullin case of SQL NULL - 抛出:
SQLException- if thrown by JDBC methods- 另请参阅:
ResultSet.getSQLXML(int),SQLXML.getCharacterStream()
getXmlAsCharacterStream
@Nullable Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLException
Retrieve the given column as character stream from the given ResultSet.Might simply invoke
ResultSet.getCharacterStreamor work withSQLXMLor database-specific classes depending on the database and driver.- 参数:
rs- the ResultSet to retrieve the content fromcolumnIndex- the column index to use- 返回:
- the content as character stream, or
nullin case of SQL NULL - 抛出:
SQLException- if thrown by JDBC methods- 另请参阅:
ResultSet.getSQLXML(int),SQLXML.getCharacterStream()
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
SQLXMLor database-specific classes depending on the database and driver.- 参数:
rs- the ResultSet to retrieve the content fromcolumnName- the column name to usesourceClass- the implementation class to be used- 返回:
- the content as character stream, or
nullin case of SQL NULL - 抛出:
SQLException- if thrown by JDBC methods- 另请参阅:
ResultSet.getSQLXML(int),SQLXML.getSource(java.lang.Class<T>)
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
SQLXMLor database-specific classes depending on the database and driver.- 参数:
rs- the ResultSet to retrieve the content fromcolumnIndex- the column index to usesourceClass- the implementation class to be used- 返回:
- the content as character stream, or
nullin case of SQL NULL - 抛出:
SQLException- if thrown by JDBC methods- 另请参阅:
ResultSet.getSQLXML(int),SQLXML.getSource(java.lang.Class<T>)
newSqlXmlValue
SqlXmlValue newSqlXmlValue(String value)
Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.- 参数:
value- the XML String value providing XML data- 返回:
- the implementation specific instance
- 另请参阅:
SqlXmlValue,SQLXML.setString(String)
newSqlXmlValue
SqlXmlValue newSqlXmlValue(XmlBinaryStreamProvider provider)
Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.- 参数:
provider- theXmlBinaryStreamProviderproviding XML data- 返回:
- the implementation specific instance
- 另请参阅:
SqlXmlValue,SQLXML.setBinaryStream()
newSqlXmlValue
SqlXmlValue newSqlXmlValue(XmlCharacterStreamProvider provider)
Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.- 参数:
provider- theXmlCharacterStreamProviderproviding XML data- 返回:
- the implementation specific instance
- 另请参阅:
SqlXmlValue,SQLXML.setCharacterStream()
newSqlXmlValue
SqlXmlValue newSqlXmlValue(Class<? extends Result> resultClass, XmlResultProvider provider)
Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.- 参数:
resultClass- the Result implementation class to be usedprovider- theXmlResultProviderthat will provide the XML data- 返回:
- the implementation specific instance
- 另请参阅:
SqlXmlValue,SQLXML.setResult(Class)
newSqlXmlValue
SqlXmlValue newSqlXmlValue(Document doc)
Create aSqlXmlValueinstance for the given XML data, as supported by the underlying JDBC driver.- 参数:
doc- the XML Document to be used- 返回:
- the implementation specific instance
- 另请参阅:
SqlXmlValue