5.2.6 Array Fields
For array fields where the array type is different from “octet”, “char” and “wchar”, an IDL array type is stored as consecutive columns of the same type in a SQL table. If the Database Integration Service daemon creates a table from an IDL type that contains an array, it will create the column names using a naming convention that prevents name collisions. By default, the daemon simply adds the suffix “[i]”, where “i” is the array index of that element (beginning at 0 for the first index). The open bracket and close bracket characters can be configured using the tags in the configuration file <open_bracket_char> and <close_bracket_char> (see Table 4.8 Database Mapping Options). Note, this naming convention is not required for the Database Integration Service daemon to serialize/deserialize IDL array fields.
Note that array fields of type “octet”, “char” and “wchar” are mapped into a single column element of the corresponding SQL types BINARY(x), CHAR(x) and WCHAR(x), respectively. Table 5.7 Array Fields in IDL and SQL shows a mapping of an array field between IDL and SQL.
|
IDL Type |
SQL Table Schema |
struct MyArrayContainer {long my_key_field; //@key short my_arr_field[2]; }; |
CREATE TABLE "MyArrayContainer" ( "my_key_field" INTEGER NOT NULL, "my_arr_field[0]" SMALLINT NOT NULL, "my_arr_field[1]" SMALLINT NOT NULL, PRIMARY KEY("my_key_field")); |