Package org.firebirdsql.jdbc.field
Class FBField
- java.lang.Object
-
- org.firebirdsql.jdbc.field.FBField
-
- Direct Known Subclasses:
FBLongVarCharField,FBWorkaroundStringField
public abstract class FBField extends java.lang.ObjectDescribe classFBFieldhere.- Author:
- Roman Rokytskyy, Mark Rotteveel
-
-
Field Summary
Fields Modifier and Type Field Description protected FieldDescriptorfieldDescriptorprotected GDSHelpergdsHelperprotected intrequiredTypeprotected intscale
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Close this field.static FBFieldcreateField(FieldDescriptor fieldDescriptor, FieldDataProvider dataProvider, GDSHelper gdsHelper, boolean cached)This is a factory method that creates appropriate instance of theFBFieldclass according to the SQL datatype.java.lang.StringgetAlias()Returns the alias of the column as declared in XSQLVAR.java.sql.ArraygetArray()java.math.BigDecimalgetBigDecimal()java.math.BigDecimalgetBigDecimal(int scale)java.math.BigIntegergetBigInteger()java.io.InputStreamgetBinaryStream()java.sql.BlobgetBlob()booleangetBoolean()bytegetByte()byte[]getBytes()java.io.ReadergetCharacterStream()java.sql.ClobgetClob()protected DatatypeCodergetDatatypeCoder()java.sql.DategetDate()java.sql.DategetDate(java.util.Calendar cal)Decimal<?>getDecimal()Returns the value as a Decimal type.<D extends Decimal<D>>
DgetDecimal(java.lang.Class<D> targetType)doublegetDouble()protected byte[]getFieldData()floatgetFloat()intgetInt()longgetLong()java.lang.StringgetName()Returns the name of the column as declared in the XSQLVAR.java.lang.ObjectgetObject()<T> TgetObject(java.lang.Class<T> type)java.lang.ObjectgetObject(java.util.Map<java.lang.String,java.lang.Class<?>> map)protected org.firebirdsql.jdbc.field.ObjectConvertergetObjectConverter()DatatypeCoder.RawDateTimeStructgetRawDateTimeStruct()java.sql.RefgetRef()java.lang.StringgetRelationName()Returns the relation to which belongs column as declared in XSQLVAR.java.sql.RowIdgetRowId()shortgetShort()java.lang.StringgetString()java.sql.TimegetTime()java.sql.TimegetTime(java.util.Calendar cal)java.sql.TimestampgetTimestamp()java.sql.TimestampgetTimestamp(java.util.Calendar cal)protected booleanisInvertTimeZone()booleanisNull()static booleanisType(FieldDescriptor field, int jdbcType)Deprecated.This method will be removed in Jaybird 5, as a replacement useJdbcTypeConverter.isJdbcType(FieldDescriptor, int)voidsetBigDecimal(java.math.BigDecimal value)voidsetBigInteger(java.math.BigInteger value)voidsetBinaryStream(java.io.InputStream in)voidsetBinaryStream(java.io.InputStream in, int length)voidsetBinaryStream(java.io.InputStream in, long length)protected voidsetBinaryStreamInternal(java.io.InputStream in, long length)voidsetBlob(FBBlob blob)voidsetBoolean(boolean value)voidsetByte(byte value)voidsetBytes(byte[] value)voidsetCharacterStream(java.io.Reader in)voidsetCharacterStream(java.io.Reader in, int length)voidsetCharacterStream(java.io.Reader in, long length)protected voidsetCharacterStreamInternal(java.io.Reader in, long length)voidsetClob(FBClob clob)voidsetConnection(GDSHelper gdsHelper)voidsetDate(java.sql.Date value)voidsetDate(java.sql.Date value, java.util.Calendar cal)voidsetDecimal(Decimal<?> decimal)Sets the value as a Decimal type.voidsetDouble(double value)protected voidsetFieldData(byte[] data)voidsetFloat(float value)voidsetInteger(int value)voidsetLong(long value)voidsetNull()voidsetObject(java.lang.Object value)voidsetRawDateTimeStruct(DatatypeCoder.RawDateTimeStruct raw)voidsetRequiredType(int requiredType)Set the required type forgetObject()conversion.voidsetRowId(java.sql.RowId rowId)voidsetShort(short value)voidsetString(java.lang.String value)voidsetTime(java.sql.Time value)voidsetTime(java.sql.Time value, java.util.Calendar cal)voidsetTimestamp(java.sql.Timestamp value)voidsetTimestamp(java.sql.Timestamp value, java.util.Calendar cal)
-
-
-
Field Detail
-
fieldDescriptor
protected final FieldDescriptor fieldDescriptor
-
gdsHelper
protected GDSHelper gdsHelper
-
requiredType
protected int requiredType
-
scale
protected int scale
-
-
Method Detail
-
getFieldData
protected final byte[] getFieldData()
-
setFieldData
protected final void setFieldData(byte[] data)
-
getObjectConverter
protected final org.firebirdsql.jdbc.field.ObjectConverter getObjectConverter()
-
getDatatypeCoder
protected final DatatypeCoder getDatatypeCoder()
-
isNull
public final boolean isNull() throws java.sql.SQLException- Returns:
trueif the corresponding field isnull, otherwisefalse- Throws:
java.sql.SQLException
-
setNull
public void setNull()
-
setConnection
public void setConnection(GDSHelper gdsHelper)
-
setRequiredType
public void setRequiredType(int requiredType)
Set the required type forgetObject()conversion.- Parameters:
requiredType- required type, one of theTypesconstants.
-
isType
@Deprecated public static boolean isType(FieldDescriptor field, int jdbcType)
Deprecated.This method will be removed in Jaybird 5, as a replacement useJdbcTypeConverter.isJdbcType(FieldDescriptor, int)- Returns:
trueif the field is of typetype.
-
createField
public static FBField createField(FieldDescriptor fieldDescriptor, FieldDataProvider dataProvider, GDSHelper gdsHelper, boolean cached) throws java.sql.SQLException
This is a factory method that creates appropriate instance of theFBFieldclass according to the SQL datatype. This instance knows how to perform all necessary type conversions.- Throws:
java.sql.SQLException
-
getName
public java.lang.String getName()
Returns the name of the column as declared in the XSQLVAR.
-
getAlias
public java.lang.String getAlias()
Returns the alias of the column as declared in XSQLVAR.
-
getRelationName
public java.lang.String getRelationName()
Returns the relation to which belongs column as declared in XSQLVAR.
-
close
public void close() throws java.sql.SQLExceptionClose this field. This method tells field implementation to release all resources allocated when field methods were called.- Throws:
java.sql.SQLException- if field cannot be closed.
-
getByte
public byte getByte() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getShort
public short getShort() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getInt
public int getInt() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getLong
public long getLong() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getFloat
public float getFloat() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getDouble
public double getDouble() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBigDecimal
public java.math.BigDecimal getBigDecimal() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBigDecimal
public java.math.BigDecimal getBigDecimal(int scale) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBoolean
public boolean getBoolean() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getString
public java.lang.String getString() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getObject
public java.lang.Object getObject() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getObject
public java.lang.Object getObject(java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getObject
public <T> T getObject(java.lang.Class<T> type) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBinaryStream
public java.io.InputStream getBinaryStream() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getCharacterStream
public java.io.Reader getCharacterStream() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBytes
public byte[] getBytes() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBlob
public java.sql.Blob getBlob() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getDate
public java.sql.Date getDate() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getDate
public java.sql.Date getDate(java.util.Calendar cal) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getTime
public java.sql.Time getTime() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getTime
public java.sql.Time getTime(java.util.Calendar cal) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getTimestamp
public java.sql.Timestamp getTimestamp() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getTimestamp
public java.sql.Timestamp getTimestamp(java.util.Calendar cal) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getRef
public java.sql.Ref getRef() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getClob
public java.sql.Clob getClob() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getArray
public java.sql.Array getArray() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBigInteger
public java.math.BigInteger getBigInteger() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getRowId
public java.sql.RowId getRowId() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setByte
public void setByte(byte value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setShort
public void setShort(short value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setInteger
public void setInteger(int value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setLong
public void setLong(long value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setFloat
public void setFloat(float value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setDouble
public void setDouble(double value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBigDecimal
public void setBigDecimal(java.math.BigDecimal value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBoolean
public void setBoolean(boolean value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setString
public void setString(java.lang.String value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBigInteger
public void setBigInteger(java.math.BigInteger value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setObject
public void setObject(java.lang.Object value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBinaryStreamInternal
protected void setBinaryStreamInternal(java.io.InputStream in, long length) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBinaryStream
public final void setBinaryStream(java.io.InputStream in, long length) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBinaryStream
public final void setBinaryStream(java.io.InputStream in) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBinaryStream
public final void setBinaryStream(java.io.InputStream in, int length) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setCharacterStreamInternal
protected void setCharacterStreamInternal(java.io.Reader in, long length) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setCharacterStream
public final void setCharacterStream(java.io.Reader in, long length) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setCharacterStream
public final void setCharacterStream(java.io.Reader in) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setCharacterStream
public final void setCharacterStream(java.io.Reader in, int length) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBytes
public void setBytes(byte[] value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setDate
public void setDate(java.sql.Date value, java.util.Calendar cal) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setDate
public void setDate(java.sql.Date value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setTime
public void setTime(java.sql.Time value, java.util.Calendar cal) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setTime
public void setTime(java.sql.Time value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setTimestamp
public void setTimestamp(java.sql.Timestamp value, java.util.Calendar cal) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setTimestamp
public void setTimestamp(java.sql.Timestamp value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBlob
public void setBlob(FBBlob blob) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
setClob
public void setClob(FBClob clob) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
setRowId
public void setRowId(java.sql.RowId rowId) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getRawDateTimeStruct
public DatatypeCoder.RawDateTimeStruct getRawDateTimeStruct() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
setRawDateTimeStruct
public void setRawDateTimeStruct(DatatypeCoder.RawDateTimeStruct raw) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getDecimal
public Decimal<?> getDecimal() throws java.sql.SQLException
Returns the value as a Decimal type.The default for this method is implemented in terms of
getBigDecimal(), and returning aDecimal128. Implementations may return aDecimal64(or evenDecimal32).- Returns:
- The value as decimal
- Throws:
java.sql.SQLException- For database access errors, or values that cannot be converted.
-
getDecimal
public final <D extends Decimal<D>> D getDecimal(java.lang.Class<D> targetType) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
setDecimal
public void setDecimal(Decimal<?> decimal) throws java.sql.SQLException
Sets the value as a Decimal type.The default for this method is implemented in terms of
setBigDecimal(BigDecimal).- Parameters:
decimal- Value to set- Throws:
java.sql.SQLException
-
isInvertTimeZone
protected boolean isInvertTimeZone()
-
-