The "fixedLengthCharFormat" property controls how the "getRecords" actions return values from fields with the "char" data type (CT_FSTRING), which is FairCom's fixed-length string field. It does not apply to other field types, such as "varchar", "lvarchar", "binary", "varbinary", and "lvarbinary".
This property changes how a "char" field value is returned. It does not change how the value is stored. A table's padding and delimiter bytes control how the server stores a value in a "char" field. The server always uses the padding byte to fill out a "char" field's value when it has fewer bytes than its specified length. For example, if a table's padding byte is the space character, and you assign "value" to a ten-byte "char" field, the server stores "value " in the field.
This property applies to all "getRecords…" actions except for "getRecordsUsingSql" because SQL always returns "char" field values using SQL rules.
This property is an enumerated string.
Settings:
-
"sql"(default) uses SQL rules and returns a fixed-length UTF-8 string padded with spaces up to the field's specified length.- For example,
"value "is returned from a ten-byte"char"field set to"value". - The returned string is unaffected by a table's padding and delimiter bytes because this setting reads the field value, converts trailing padding and delimiter bytes into spaces, and returns the value with the trailing spaces.
- This is the default setting because the purpose of using a
"char"field is to create a string field with a fixed number of bytes; thus, the best practice is to set and return all bytes. If you set fewer bytes, the API follows SQL's lead and uses the space character to fill them in. - This new default behavior is a breaking change as of version 13.1.0. For compatibility with prior versions, use the
"trimTrailingPadding"setting.
- For example,
-
"trimTrailingSpaces"returns a variable-length UTF-8 string with spaces removed after the last non-space character.- For example,
"value"is returned from a ten-byte,"char"field set to"value ". - The returned string is unaffected by a table's padding and delimiter bytes because this setting reads the field value, converts trailing padding and delimiter bytes into spaces, and trims the trailing spaces.
- If a value contains trailing spaces when you store it, this setting removes them when it is returned.
- For example,
-
"trimTrailingPadding"returns a variable-length UTF-8 string with trailing padding and delimiter bytes removed.- For example,
"value "is returned from a ten-byte, null-padded"char"field set to"value ".- Notice that the field value contains a trailing space, which is stored and returned without trimming because the field is null-padded.
- The returned string is affected by a table's padding and delimiter bytes because this setting reads the field value, trims the trailing padding and delimiter bytes, and returns the value without the padding and delimiter bytes.
- This setting works well if the table sets the
"padValue"and"fieldDelimiterValue"properties to 0 or another character that never appears in fixed-length strings. - This setting matches the behavior of the JSON DB API before version 13.1.0 if the table has the
"padValue"property set to 0 and the"fieldDelimiterValue"set to 0.
- For example,