Package org.firebirdsql.jdbc.field
Class FBWorkaroundStringField
java.lang.Object
org.firebirdsql.jdbc.field.FBField
org.firebirdsql.jdbc.field.FBWorkaroundStringField
Class implementing workaround for "operation was cancelled" bug in server.
When we send some string data exceeding maximum length of the corresponding
field causes "operation was cancelled" in remote module of the server instead
of "arithmetic exception..." error. This makes code debugging harder, since
error message is not very informative.
However we cannot simply check length locally. Maximum allowed length in bytes is connected with the character set of the field as defined lengh * maximum number of bytes per character in that encoding. However this does not work for system tables which have defined length 31, character set UNICODE_FSS and maximum allowed length of 31 (instead of 31 * 3 = 63).
Until this bug is fixed in the engine we will simply check if field belongs to the system table and do not throw data truncation error locally.
- Author:
- Roman Rokytskyy, Mark Rotteveel
-
Field Summary
FieldsFields inherited from class org.firebirdsql.jdbc.field.FBField
fieldDescriptor, gdsHelper, requiredType, scale -
Method Summary
Modifier and TypeMethodDescriptionbooleanbytegetByte()byte[]getBytes()getDate()doublefloatgetFloat()intgetInt()longgetLong()shortgetShort()Get string value of this field.getTime()getTimestamp(Calendar cal) voidsetBigDecimal(BigDecimal value) voidsetBigInteger(BigInteger value) protected voidsetBinaryStreamInternal(InputStream in, long length) voidsetBoolean(boolean value) voidsetByte(byte value) voidsetBytes(byte[] value) protected voidsetCharacterStreamInternal(Reader in, long length) voidvoidvoidsetDouble(double value) voidsetFloat(float value) voidsetInteger(int value) voidsetLong(long value) voidsetShort(short value) voidvoidsetStringForced(String value) Set string value without any check of its length.voidvoidvoidsetTimestamp(Timestamp value) voidsetTimestamp(Timestamp value, Calendar cal) voidsetTrimString(boolean trimString) Methods inherited from class org.firebirdsql.jdbc.field.FBField
close, createField, getAlias, getArray, getBigDecimal, getBlob, getCharacterStream, getClob, getDatatypeCoder, getDecimal, getDecimal, getFieldData, getName, getObject, getObject, getObject, getObjectConverter, getRawDateTimeStruct, getRef, getRelationName, getRowId, isInvertTimeZone, isNull, isType, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setConnection, setDecimal, setFieldData, setNull, setObject, setRawDateTimeStruct, setRequiredType, setRowId
-
Field Details
-
possibleCharLength
protected final int possibleCharLength
-
-
Method Details
-
setTrimString
public void setTrimString(boolean trimString) -
setString
- Throws:
SQLException
-
setStringForced
Set string value without any check of its length. This is a workaround for the problem described above.- Parameters:
value- value to set.- Throws:
SQLException- if something went wrong.
-
getString
Get string value of this field.- Returns:
- string value of this filed or
nullif the value is NULL. - Throws:
SQLException
-
getByte
- Overrides:
getBytein classFBField- Throws:
SQLException
-
getShort
- Overrides:
getShortin classFBField- Throws:
SQLException
-
getInt
- Overrides:
getIntin classFBField- Throws:
SQLException
-
getLong
- Overrides:
getLongin classFBField- Throws:
SQLException
-
getBigDecimal
- Overrides:
getBigDecimalin classFBField- Throws:
SQLException
-
getFloat
- Overrides:
getFloatin classFBField- Throws:
SQLException
-
getDouble
- Overrides:
getDoublein classFBField- Throws:
SQLException
-
getBoolean
- Overrides:
getBooleanin classFBField- Throws:
SQLException
-
getBinaryStream
- Overrides:
getBinaryStreamin classFBField- Throws:
SQLException
-
getBytes
- Overrides:
getBytesin classFBField- Throws:
SQLException
-
getDate
- Overrides:
getDatein classFBField- Throws:
SQLException
-
getDate
- Overrides:
getDatein classFBField- Throws:
SQLException
-
getTime
- Overrides:
getTimein classFBField- Throws:
SQLException
-
getTime
- Overrides:
getTimein classFBField- Throws:
SQLException
-
getTimestamp
- Overrides:
getTimestampin classFBField- Throws:
SQLException
-
getTimestamp
- Overrides:
getTimestampin classFBField- Throws:
SQLException
-
getBigInteger
- Overrides:
getBigIntegerin classFBField- Throws:
SQLException
-
setByte
- Overrides:
setBytein classFBField- Throws:
SQLException
-
setShort
- Overrides:
setShortin classFBField- Throws:
SQLException
-
setInteger
- Overrides:
setIntegerin classFBField- Throws:
SQLException
-
setLong
- Overrides:
setLongin classFBField- Throws:
SQLException
-
setFloat
- Overrides:
setFloatin classFBField- Throws:
SQLException
-
setDouble
- Overrides:
setDoublein classFBField- Throws:
SQLException
-
setBigDecimal
- Overrides:
setBigDecimalin classFBField- Throws:
SQLException
-
setBoolean
- Overrides:
setBooleanin classFBField- Throws:
SQLException
-
setBinaryStreamInternal
- Overrides:
setBinaryStreamInternalin classFBField- Throws:
SQLException
-
setCharacterStreamInternal
- Overrides:
setCharacterStreamInternalin classFBField- Throws:
SQLException
-
setBytes
- Overrides:
setBytesin classFBField- Throws:
SQLException
-
setDate
- Overrides:
setDatein classFBField- Throws:
SQLException
-
setDate
- Overrides:
setDatein classFBField- Throws:
SQLException
-
setTime
- Overrides:
setTimein classFBField- Throws:
SQLException
-
setTime
- Overrides:
setTimein classFBField- Throws:
SQLException
-
setTimestamp
- Overrides:
setTimestampin classFBField- Throws:
SQLException
-
setTimestamp
- Overrides:
setTimestampin classFBField- Throws:
SQLException
-
setBigInteger
- Overrides:
setBigIntegerin classFBField- Throws:
SQLException
-