java.lang.Object | |
↳ | org.springframework.jdbc.core.support.SqlLobValue |
Object to represent an SQL BLOB/CLOB value parameter. BLOBs can either be an InputStream or a byte array. CLOBs can be in the form of a Reader, InputStream or String. Each CLOB/BLOB value will be stored together with its length. The type is based on which constructor is used. Objects of this class are immutable except for the LobCreator reference. Use them and discard them.
This class holds a reference to a LocCreator that must be closed after the update has completed. This is done via a call to the closeLobCreator method. All handling of the LobCreator is done by the framework classes that use it - no need to set or close the LobCreator for end users of this class.
A usage example:
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); // reusable object LobHandler lobHandler = new DefaultLobHandler(); // reusable object jdbcTemplate.update( "INSERT INTO imagedb (image_name, content, description) VALUES (?, ?, ?)", new Object[] { name, new SqlLobValue(contentStream, contentLength, lobHandler), new SqlLobValue(description, lobHandler) }, new int[] {Types.VARCHAR, Types.BLOB, Types.CLOB});
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.springframework.jdbc.core.SqlTypeValue
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new BLOB value with the given byte array,
using a DefaultLobHandler.
| |||||||||||
Create a new BLOB value with the given byte array.
| |||||||||||
Create a new CLOB value with the given content string,
using a DefaultLobHandler.
| |||||||||||
Create a new CLOB value with the given content string.
| |||||||||||
Create a new BLOB/CLOB value with the given stream,
using a DefaultLobHandler.
| |||||||||||
Create a new BLOB/CLOB value with the given stream.
| |||||||||||
Create a new CLOB value with the given character stream,
using a DefaultLobHandler.
| |||||||||||
Create a new CLOB value with the given character stream.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Close the LobCreator, if any.
| |||||||||||
Set the specified content via the LobCreator.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.jdbc.core.DisposableSqlTypeValue
| |||||||||||
From interface
org.springframework.jdbc.core.SqlTypeValue
|
Create a new BLOB value with the given byte array, using a DefaultLobHandler.
bytes | the byte array containing the BLOB value |
---|
Create a new BLOB value with the given byte array.
bytes | the byte array containing the BLOB value |
---|---|
lobHandler | the LobHandler to be used |
Create a new CLOB value with the given content string, using a DefaultLobHandler.
content | the String containing the CLOB value |
---|
Create a new CLOB value with the given content string.
content | the String containing the CLOB value |
---|---|
lobHandler | the LobHandler to be used |
Create a new BLOB/CLOB value with the given stream, using a DefaultLobHandler.
stream | the stream containing the LOB value |
---|---|
length | the length of the LOB value |
Create a new BLOB/CLOB value with the given stream.
stream | the stream containing the LOB value |
---|---|
length | the length of the LOB value |
lobHandler | the LobHandler to be used |
Create a new CLOB value with the given character stream, using a DefaultLobHandler.
reader | the character stream containing the CLOB value |
---|---|
length | the length of the CLOB value |
Create a new CLOB value with the given character stream.
reader | the character stream containing the CLOB value |
---|---|
length | the length of the CLOB value |
lobHandler | the LobHandler to be used |
Close the LobCreator, if any.
Set the specified content via the LobCreator.
ps | the PreparedStatement to work on |
---|---|
paramIndex | the index of the parameter for which we need to set the value |
sqlType | SQL type of the parameter we are setting |
typeName | the type name of the parameter (optional) |
SQLException |
---|