org.firebirdsql.gds.ng.fields

## Interface BlrCalculator

- All Known Implementing Classes:
    DefaultBlrCalculator

      public interface BlrCalculator

  Interface for calculating the blr (binary language representation) of a row.
  Since:
    3.0
  Author:
    Mark Rotteveel

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `calculateBlr(RowDescriptor rowDescriptor)` Calculates the blr for the row descriptor.
    `byte[]` | `calculateBlr(RowDescriptor rowDescriptor, RowValue rowValue)` Calculates the blr for a specific row value.
    `int` | `calculateIoLength(FieldDescriptor fieldDescriptor)` Calculates the io length for the field descriptor.
    `int` | `calculateIoLength(FieldDescriptor fieldDescriptor, FieldValue fieldValue)` Calculates the io length for the field descriptor.

- - ### Method Detail

    - #### calculateBlr

          byte[] calculateBlr(RowDescriptor rowDescriptor)
                              throws java.sql.SQLException

      Calculates the blr for the row descriptor.
      Parameters:
        `rowDescriptor` - Row descriptor
      Returns:
        Byte array with the blr
      Throws:
        `java.sql.SQLException` - When the `RowDescriptor` contains an unsupported field type.

    - #### calculateBlr

          byte[] calculateBlr(RowDescriptor rowDescriptor,
                            RowValue rowValue)
                              throws java.sql.SQLException

      Calculates the blr for a specific row value.

      This allows to optimize for the actual length of the field.

      Parameters:
        `rowDescriptor` - Row descriptor
        `rowValue` - Row value
      Returns:
        Byte array with the blr
      Throws:
        `java.sql.SQLException` - When the `RowValue` contains an unsupported field type.

    - #### calculateIoLength

          int calculateIoLength(FieldDescriptor fieldDescriptor)
                                throws java.sql.SQLException

      Calculates the io length for the field descriptor.

      The return value indicates the length and padding of the type in the buffer

      - < 0 : Type is of specified length * -1 and not padded
      - == 0 : Type is of dynamic length (which is specified in the buffer as an integer) and padded
      - > 0 : Type is of specified length minus 1 (subtracting 1 is required to avoid 0 for types of zero length) and padded
      Parameters:
        `fieldDescriptor` - Field descriptor
      Returns:
        The io length
      Throws:
        `java.sql.SQLException`

    - #### calculateIoLength

          int calculateIoLength(FieldDescriptor fieldDescriptor,
                              FieldValue fieldValue)
                                throws java.sql.SQLException

      Calculates the io length for the field descriptor.

      The return value indicates the length and padding of the type in the buffer

      - < 0 : Type is of specified length * -1 and not padded
      - == 0 : Type is of dynamic length (which is specified in the buffer as an integer) and padded
      - > 0 : Type is of specified length minus 1 (subtracting 1 is required to avoid 0 for types of zero length) nd padded

      This allows to optimize for the actual length of the field.

      For `CHAR` (`ISCConstants.SQL_TEXT` the implementation should be consistent with the lengths as given by `calculateBlr(RowDescriptor, RowValue)`.

      Parameters:
        `fieldDescriptor` - Field descriptor
        `fieldValue` - Field value
      Returns:
        The io length
      Throws:
        `java.sql.SQLException`

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