Product Documentation

SQL Operations Guide

Previous Topic

Next Topic

FairCom DB SQL Callback Configuration File

Since there is no practical way to inspect a table and detect which CT_INT4 fields are actually MYTIME fields, a configuration is necessary for describing every table that has at least one MYTIME field.

By default, the FairCom DB SQL callback configuration file is called ctsqlcbk.ini. Both Windows and Unix based systems use the same configuration syntax and file name convention.

The syntax of the configuration file is similar to Windows .INI files. Comments are started with a semicolon character. Every character after a semicolon is treated as comments and will be ignored, as shown here.

Configuration .ini

; this is a table declaration

[nmalert]

field = number, CT_FSTRING, 10 ; first field


Each table is described in the configuration file with the table name inside square brackets. Each table represents a section entry, followed by the table’s field, index and index segment definitions as shown above:

[nmalert]

The fields are defined using the following syntax:

field = field-name, field-type, field-length

field-name is a string containing the field name. The field name should not be placed inside single or double quotes, and a comma must not be part of the field name.

field-type is one of the following:

Available Field Types

CT_BOOL

CT_MONEY

CT_FSTRING

CT_CHAR

CT_CURRENCY

CT_FPSTRING

CT_CHARU

CT_NUMBER

CT_F2STRING

CT_INT2

CT_DATE

CT_F4STRING

CT_INT2U

CT_TIME

CT_STRING

CT_INT4

CT_TIMES

CT_PSTRING

CT_INT4U

CT_SFLOAT

CT_2STRING

CT_INT8

CT_DFLOAT

CT_4STRING

CT_INT8U

CT_ARRAY

 

field-length is an integer value representing the field length.

Conversion Example

[nmalert]

field = number, CT_FSTRING, 10

field = seq, CT_INT2, 2

field = modwhen, CT_TIMES, 8

field = modby, CT_INT2, 2

field = code, CT_FSTRING, 5

After the field definitions, each index, with its segments, must be declared. The syntax for an index definition is:

index = keylen, nsegs

Conversion Example

[nmalert]

field = number, CT_FSTRING, 10

field = seq, CT_INT2, 2

field = modwhen, CT_TIMES, 8

field = modby, CT_INT2, 2

field = code, CT_FSTRING, 5

index = 12, 2

segment = number, 2

segment = seq, 8

index = 13, 2

segment = code, 2

The index segment must follow the index declaration. Each index segment must be declared using the following syntax:

  1. If an index segment consists of a whole field:

    segment = field-name, segmode

    field-name is a string containing the field name. The field name should not be placed inside single or double quotes, and a comma must be part of the field name.

    segmode is an integer value representing an index segment mode.

  2. If an index segment consists of an arbitrary offset in the record buffer that cannot be mapped back to the offset of a field in the DODA, or an index segment length does not match a field length, the index segment syntax is:

    seg = segoffset, seglength, segmode

    segoffset is an integer value indicating the offset of the segment in the record buffer.

    seglength is an integer value indicating the segment length in bytes.

    segmode is an integer value representing an index segment mode.

Conversion Example

[nmalert]

field = number, CT_FSTRING, 10

field = seq, CT_INT2, 2

field = modwhen, CT_TIMES, 8

field = modby, CT_INT2, 2

field = code, CT_FSTRING, 5

index = 12, 2

segment = number, 2

segment = seq, 8

index = 13, 2

segment = code, 2

Every table that has one or more MYTIME fields must be added to the configuration file. There is no special ordering of the tables. Below is an example of a configuration file with two tables: nmalert and nmmdesc.

Conversion Example

[nmalert]

field = number, CT_FSTRING, 10

field = seq, CT_INT2, 2

field = modwhen, CT_TIMES, 8

field = modby, CT_INT2, 2

field = code, CT_FSTRING, 5

index = 12, 2

segment = number, 2

segment = seq, 8

index = 13, 2

segment = code, 2


[nmmdesc]

field = number, CT_FSTRING, 10

field = modby, CT_INT2, 2

field = modwhen, CT_TIMES, 8

field = text, CT_STRING, 0

index = 10, 1

segment = number, 2

TOCIndex