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

emailx45

Местный
Регистрация
5 Май 2008
Сообщения
3,571
Реакции
2,439
Credits
574
InterBase mit Arrays und FireDAC (Interbase with Arrays and FireDAC)
[SHOWTOGROUPS=4,20]
Matthias Eißing
14/4/2020

Для просмотра ссылки Войди или Зарегистрируйся 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 Для просмотра ссылки Войди или Зарегистрируйся quite Для просмотра ссылки Войди или Зарегистрируйся . 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:

6470.pastedimage1586855876799v1.png


(View from the data explorer)

0880.pastedimage1586857592125v2.png


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. Для просмотра ссылки Войди или Зарегистрируйся .

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:

1121.pastedimage1586858043343v3.png


My colleague Для просмотра ссылки Войди или Зарегистрируйся also made a Для просмотра ссылки Войди или Зарегистрируйся about it (in English)

[/SHOWTOGROUPS]
 
Последнее редактирование: