public class BlobType extends java.lang.Object implements DataHandler
blob
type.Constructor and Description |
---|
BlobType() |
Modifier and Type | Method and Description |
---|---|
blob |
convert(java.lang.Object sqlVal)
Creates and returns a new
blob from a SQL counterpart. |
BaseDataType |
getField(Record r,
int offset)
Obtain the value of the property of a
Record located at a specified offset in data
array. |
int |
getFieldSizeInIndex(java.lang.Object val)
Compute the size in bytes taken by a specified value for the data type handled by this
class.
|
java.lang.Object |
initialValue(java.lang.String text,
PropertyMeta meta)
Instantiate a low-level initial value suitable for storage in a
BaseRecord 's data
array, parsed from a string representation. |
int |
readProperty(java.sql.ResultSet rs,
int rsOffset,
java.lang.Object[] data,
int propIndex)
Reads data from one or more positions from the
ResultSet , eventually converting it
to a proper type and storing the result directly to the Record 's data structure. |
void |
setField(java.lang.Object[] data,
BaseDataType val,
int offset,
PropertyMeta meta)
Sets a value of a property in a
Record . |
int |
setParameter(java.sql.PreparedStatement stmt,
int index,
java.lang.Object val)
Use the the data from a
blob field stored in BaseRecord.data and use it to
initialize a parameter of type blob in a SQL prepared query. |
public blob convert(java.lang.Object sqlVal)
blob
from a SQL counterpart.convert
in interface DataHandler
sqlVal
- A value obtained from a SQL query, which needs to be converted to a
BaseDataType
.blob
object representing the same value as sqlVal
.public int setParameter(java.sql.PreparedStatement stmt, int index, java.lang.Object val) throws java.sql.SQLException
blob
field stored in BaseRecord.data
and use it to
initialize a parameter of type blob in a SQL prepared query.setParameter
in interface ParameterSetter
stmt
- The prepared statement whose the parameter is to be set.index
- The index/position of the parameter.val
- The value of the parameter. Must be a blob
.java.sql.SQLException
- when an error is encountered while setting the value.public int readProperty(java.sql.ResultSet rs, int rsOffset, java.lang.Object[] data, int propIndex) throws java.sql.SQLException
ResultSet
, eventually converting it
to a proper type and storing the result directly to the Record
's data structure.readProperty
in interface PropertyReader
rs
- The ResultSet
to read from.rsOffset
- The index/position in current row of rs
to start reading.data
- The destination. Ie. the record's data
field member.propIndex
- The destination offset. Ie. the property index.java.sql.SQLException
- when an error is encountered while setting the value.public java.lang.Object initialValue(java.lang.String text, PropertyMeta meta)
BaseRecord
's data
array, parsed from a string representation.initialValue
in interface DataHandler
text
- String representation of the initial value.meta
- Property metadata.public int getFieldSizeInIndex(java.lang.Object val)
getFieldSizeInIndex
in interface DataHandler
val
- The value to be computed the size. Assumed to be a Blob
.val
object occupies.public void setField(java.lang.Object[] data, BaseDataType val, int offset, PropertyMeta meta)
Record
. The specified value is converted from
BaseDataType
FWD standard to plain Java, as the data
array expects before
assigning the value to right offset.setField
in interface DataHandler
data
- The data
array of the record to be altered.val
- The BaseDataType
value to be set. Assumed to be a blob
.offset
- The offset of the property, ie, the entry in data
array. This includes both
base property offset and the eventual extent index.meta
- Property metadata. Used to fine-tune stored data.public BaseDataType getField(Record r, int offset)
Record
located at a specified offset in data
array. It assumes the data at specified offset is compatible with this data handler.getField
in interface DataHandler
r
- The Record
.offset
- The offset.BaseDataType
.