public class DefaultBlrCalculator extends java.lang.Object implements BlrCalculator
Most likely this can be used without change for other protocol versions as well, although we may need to investigate
the TODOs specified in calculateBlr(org.firebirdsql.gds.ng.fields.RowDescriptor)
.
Modifier and Type | Field and Description |
---|---|
static DefaultBlrCalculator |
CALCULATOR_DIALECT_3
Cached instance of
DefaultBlrCalculator for dialect 3 databases. |
Constructor and Description |
---|
DefaultBlrCalculator(short dialect) |
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.
|
public static final DefaultBlrCalculator CALCULATOR_DIALECT_3
DefaultBlrCalculator
for dialect 3 databases.public byte[] calculateBlr(RowDescriptor rowDescriptor) throws java.sql.SQLException
BlrCalculator
calculateBlr
in interface BlrCalculator
rowDescriptor
- Row descriptorjava.sql.SQLException
- When the RowDescriptor
contains an unsupported field type.public byte[] calculateBlr(RowDescriptor rowDescriptor, RowValue rowValue) throws java.sql.SQLException
BlrCalculator
This allows to optimize for the actual length of the field.
calculateBlr
in interface BlrCalculator
rowDescriptor
- Row descriptorrowValue
- Row valuejava.sql.SQLException
- When the RowValue
contains an unsupported field type.public int calculateIoLength(FieldDescriptor fieldDescriptor) throws java.sql.SQLException
BlrCalculator
The return value indicates the length and padding of the type in the buffer
calculateIoLength
in interface BlrCalculator
fieldDescriptor
- Field descriptorjava.sql.SQLException
public int calculateIoLength(FieldDescriptor fieldDescriptor, FieldValue fieldValue) throws java.sql.SQLException
BlrCalculator
The return value indicates the length and padding of the type in the buffer
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 BlrCalculator.calculateBlr(RowDescriptor, RowValue)
.
calculateIoLength
in interface BlrCalculator
fieldDescriptor
- Field descriptorfieldValue
- Field valuejava.sql.SQLException
Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.