org.firebirdsql.jdbc.field

## Class FBWorkaroundStringField

- java.lang.Object
- - org.firebirdsql.jdbc.field.FBField
  - - org.firebirdsql.jdbc.field.FBWorkaroundStringField

-     public final class FBWorkaroundStringField
      extends FBField

  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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected EncodingDefinition` | `encodingDefinition`
    `protected int` | `possibleCharLength`

    - ### Fields inherited from class org.firebirdsql.jdbc.field.FBField

      `fieldDescriptor, gdsHelper, mappingPath, requiredType, scale`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.math.BigDecimal` | `getBigDecimal()`
    `java.math.BigInteger` | `getBigInteger()`
    `java.io.InputStream` | `getBinaryStream()`
    `boolean` | `getBoolean()`
    `byte` | `getByte()`
    `byte[]` | `getBytes()`
    `java.sql.Date` | `getDate()`
    `java.sql.Date` | `getDate(java.util.Calendar cal)`
    `double` | `getDouble()`
    `protected static EncodingDefinition` | `getEncodingDefinition(FieldDescriptor fieldDescriptor)`
    `float` | `getFloat()`
    `int` | `getInt()`
    `long` | `getLong()`
    `short` | `getShort()`
    `java.lang.String` | `getString()` Get string value of this field.
    `java.sql.Time` | `getTime()`
    `java.sql.Time` | `getTime(java.util.Calendar cal)`
    `java.sql.Timestamp` | `getTimestamp()`
    `java.sql.Timestamp` | `getTimestamp(java.util.Calendar cal)`
    `void` | `setBigDecimal(java.math.BigDecimal value)`
    `void` | `setBigInteger(java.math.BigInteger value)`
    `protected void` | `setBinaryStreamInternal(java.io.InputStream in, long length)`
    `void` | `setBoolean(boolean value)`
    `void` | `setByte(byte value)`
    `void` | `setBytes(byte[] value)`
    `protected void` | `setCharacterStreamInternal(java.io.Reader in, long length)`
    `void` | `setDate(java.sql.Date value)`
    `void` | `setDate(java.sql.Date value, java.util.Calendar cal)`
    `void` | `setDouble(double value)`
    `void` | `setFloat(float value)`
    `void` | `setInteger(int value)`
    `void` | `setLong(long value)`
    `void` | `setShort(short value)`
    `void` | `setString(java.lang.String value)`
    `byte[]` | `setStringForced(java.lang.String value)` Set string value without any check of its length.
    `void` | `setTime(java.sql.Time value)`
    `void` | `setTime(java.sql.Time value, java.util.Calendar cal)`
    `void` | `setTimestamp(java.sql.Timestamp value)`
    `void` | `setTimestamp(java.sql.Timestamp value, java.util.Calendar cal)`
    `void` | `setTrimString(boolean trimString)`

    - ### Methods inherited from class org.firebirdsql.jdbc.field.FBField

      `close, createField, getAlias, getArray, getBigDecimal, getBlob, getCharacterStream, getClob, getDatatypeCoder, getFieldData, getName, getObject, getObject, getObject, getObjectConverter, getRawDateTimeStruct, getRef, getRelationName, isInvertTimeZone, isNull, isType, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setConnection, setFieldData, setNull, setObject, setRawDateTimeStruct, setRequiredType`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### possibleCharLength

          protected final int possibleCharLength

    - #### encodingDefinition

          protected final EncodingDefinition encodingDefinition

  - ### Method Detail

    - #### setTrimString

          public void setTrimString(boolean trimString)

    - #### setString

          public void setString(java.lang.String value)
                         throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### setStringForced

          public byte[] setStringForced(java.lang.String value)
                                 throws java.sql.SQLException

      Set string value without any check of its length. This is a workaround for the problem described above.
      Parameters:
        `value` - value to set.
      Throws:
        `java.sql.SQLException` - if something went wrong.

    - #### getString

          public java.lang.String getString()
                                     throws java.sql.SQLException

      Get string value of this field.
      Returns:
        string value of this filed or `null` if the value is NULL.
      Throws:
        `java.sql.SQLException`

    - #### getEncodingDefinition

          protected static EncodingDefinition getEncodingDefinition(FieldDescriptor fieldDescriptor)
                                                             throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getByte

          public byte getByte()
                       throws java.sql.SQLException

      Overrides:
        `getByte` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getShort

          public short getShort()
                         throws java.sql.SQLException

      Overrides:
        `getShort` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getInt

          public int getInt()
                     throws java.sql.SQLException

      Overrides:
        `getInt` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getLong

          public long getLong()
                       throws java.sql.SQLException

      Overrides:
        `getLong` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getBigDecimal

          public java.math.BigDecimal getBigDecimal()
                                             throws java.sql.SQLException

      Overrides:
        `getBigDecimal` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getFloat

          public float getFloat()
                         throws java.sql.SQLException

      Overrides:
        `getFloat` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getDouble

          public double getDouble()
                           throws java.sql.SQLException

      Overrides:
        `getDouble` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getBoolean

          public boolean getBoolean()
                             throws java.sql.SQLException

      Overrides:
        `getBoolean` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getBinaryStream

          public java.io.InputStream getBinaryStream()
                                              throws java.sql.SQLException

      Overrides:
        `getBinaryStream` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getBytes

          public byte[] getBytes()
                          throws java.sql.SQLException

      Overrides:
        `getBytes` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getDate

          public java.sql.Date getDate(java.util.Calendar cal)
                                throws java.sql.SQLException

      Overrides:
        `getDate` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getDate

          public java.sql.Date getDate()
                                throws java.sql.SQLException

      Overrides:
        `getDate` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getTime

          public java.sql.Time getTime(java.util.Calendar cal)
                                throws java.sql.SQLException

      Overrides:
        `getTime` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getTime

          public java.sql.Time getTime()
                                throws java.sql.SQLException

      Overrides:
        `getTime` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getTimestamp

          public java.sql.Timestamp getTimestamp(java.util.Calendar cal)
                                          throws java.sql.SQLException

      Overrides:
        `getTimestamp` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getTimestamp

          public java.sql.Timestamp getTimestamp()
                                          throws java.sql.SQLException

      Overrides:
        `getTimestamp` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### getBigInteger

          public java.math.BigInteger getBigInteger()
                                             throws java.sql.SQLException

      Overrides:
        `getBigInteger` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setByte

          public void setByte(byte value)
                       throws java.sql.SQLException

      Overrides:
        `setByte` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setShort

          public void setShort(short value)
                        throws java.sql.SQLException

      Overrides:
        `setShort` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setInteger

          public void setInteger(int value)
                          throws java.sql.SQLException

      Overrides:
        `setInteger` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setLong

          public void setLong(long value)
                       throws java.sql.SQLException

      Overrides:
        `setLong` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setFloat

          public void setFloat(float value)
                        throws java.sql.SQLException

      Overrides:
        `setFloat` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setDouble

          public void setDouble(double value)
                         throws java.sql.SQLException

      Overrides:
        `setDouble` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setBigDecimal

          public void setBigDecimal(java.math.BigDecimal value)
                             throws java.sql.SQLException

      Overrides:
        `setBigDecimal` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setBoolean

          public void setBoolean(boolean value)
                          throws java.sql.SQLException

      Overrides:
        `setBoolean` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setBinaryStreamInternal

          protected void setBinaryStreamInternal(java.io.InputStream in,
                                                 long length)
                                          throws java.sql.SQLException

      Overrides:
        `setBinaryStreamInternal` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setCharacterStreamInternal

          protected void setCharacterStreamInternal(java.io.Reader in,
                                                    long length)
                                             throws java.sql.SQLException

      Overrides:
        `setCharacterStreamInternal` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setBytes

          public void setBytes(byte[] value)
                        throws java.sql.SQLException

      Overrides:
        `setBytes` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setDate

          public void setDate(java.sql.Date value,
                              java.util.Calendar cal)
                       throws java.sql.SQLException

      Overrides:
        `setDate` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setDate

          public void setDate(java.sql.Date value)
                       throws java.sql.SQLException

      Overrides:
        `setDate` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setTime

          public void setTime(java.sql.Time value,
                              java.util.Calendar cal)
                       throws java.sql.SQLException

      Overrides:
        `setTime` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setTime

          public void setTime(java.sql.Time value)
                       throws java.sql.SQLException

      Overrides:
        `setTime` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setTimestamp

          public void setTimestamp(java.sql.Timestamp value,
                                   java.util.Calendar cal)
                            throws java.sql.SQLException

      Overrides:
        `setTimestamp` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setTimestamp

          public void setTimestamp(java.sql.Timestamp value)
                            throws java.sql.SQLException

      Overrides:
        `setTimestamp` in class `FBField`
      Throws:
        `java.sql.SQLException`

    - #### setBigInteger

          public void setBigInteger(java.math.BigInteger value)
                             throws java.sql.SQLException

      Overrides:
        `setBigInteger` in class `FBField`
      Throws:
        `java.sql.SQLException`

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.