Articles InterBase mit Arrays und FireDAC (Interbase with Arrays and FireDAC) by Matthias Eißing (German article)

emailx45

Бывалый
Staff member
Moderator
InterBase mit Arrays und FireDAC (Interbase with Arrays and FireDAC)
[SHOWTOGROUPS=4,20]
Matthias Eißing
14/4/2020

InterBase has been offering the possibility to use arrays since time immemorial.

What are arrays?
Arrays are one or more dimensional data stores of the same type within a column. These can be used with InterBase with all standard data types, except for BLOBs.

When should you use it / when not?
Arrays can be defined quite easily . But you should note when you should use them and when you should be better:

  • The data of the array are of the same type
  • The data of the array are used as a logical (data belong together) and physical (storage in one column; under common transaction control) unit.
Advantages result from the reduced load due to the transaction control: You can simply read and save one slide of data (one / multi-dimensional) in an array within a single transaction. The latter may result in significant performance advantages

Arrays are created as extensions of CREATE TABLEor CREATE DOMAIN:

CREATE TABLE TBL_ARRAY
(
ID INTEGER,
TICTACTOE BOOLEAN[1:3, 1:3]
);

Here a Tic Tac Toe field is defined in a column.

With / with FireDAC it looks like this in the Delphi IDE:



(View from the data explorer)



Within an application. (Normal DBGrid and 3x3 DBCheckBox)

It should be noted that first the rows / rows and then the columns / columns in the array are run through. Fortran, for example, expects a column / row order .

As of Berlin 10.1, the DBGrid also correctly displays an array!

Program access to the array elements
The array elements can be accessed directly via the 0-based elements. Alternating here:

Tbl_arrayTable.Edit;
Tbl_arrayTable.FieldByName('TICTACTOE[0]').Value := NOT Tbl_arrayTable.FieldByName('TICTACTOE[0]').AsBoolean;

What to pay attention to?
Unfortunately, the InterBase Console cannot display arrays:



My colleague Stephen Ball also made a nice video about it (in English)

[/SHOWTOGROUPS]
 
Last edited:
Top