Description

The Arrays sample shows you how to use the TFDParam.ArrayType property to send arrays to a PostgreSQL database server. To this end, the ArrayType property is set to atTable.

How to Use the Sample

Navigate to the location given above and open PGArrays.dproj.

Press F9 or choose Run > Run.

Files

File in Delphi

Contains

PGArrays.dprojPGArrays.dpr

The project itself.

fMain.pasfMain.fmx

The main form.

Implementation

Before running the sample, the main components are configured at design time using the Object Inspector as follows:

A TFDConnection object named FDConnection1. This is the FireDAC connection object that the sample uses to connect to a DBMS. The sample sets the ConnectionDefName property to PG_Demo.

A TFDQuery object named FDQuery1. This component implements a dataset capable of executing SQL queries. The sample sets its Connection property to FDConnection1 to specify the FireDAC connection object.

A TDataSource object named DataSource1. This component provides an interface between a dataset component and data-aware controls on a form. In this sample, it is used to provide communication between the dataset and the grid where the dataset is displayed. To this end, the sample sets the following properties:

The DataSet property of DataSource is set to FDQuery1.

The DataSource property of DBGrid1 is set to DataSource1.

When you run the application, you see a grid, a combo box and two buttons labeled as PG Read and PG Write. The purpose of these components in this sample is the following: