New TPSQLPointField class in PostgresDAC-2.6.0

The v2.6.0 release of PostgresDAC will provide native support for PostgreSQL geometric types, so several TField descendants were created. Meet the TPSQLPointField which encapsulates point PostgreSQL type.

Some internals

Since PostgreSQL point type uses floating-point numbers, we cannot use standard Delphi TPoint type, which uses integer numbers. Thus new TPSQLPoint type were introduced with constant representing origin:

TPSQLPoint = packed record
  X: Double;
  Y: Double;

  OriginPoint: TPSQLPoint = (X: 0.0; Y: 0.0);

As the ancestor for the new class TNumericField were chosen, because of properties for formatting numeric data for display and editing purposes.


Let’s have a look on definition:

TPSQLPointField = class(TNumericField)
  property AsTPoint: TPoint read GetAsTPoint write SetAsTPoint;
  property Value: TPSQLPoint read GetAsPoint write SetAsPoint;

First of all Value property is redeclared, now it is of TPSQLPoint type. This behaviour is common for all TField descendants and this is not a big surprise, I believe.

And the second AsTPoint property added to support standard Delphi TPoint type.

warning Float numbers are rounded (not truncated) when accessing this value.

Test Drive

You may test the new functionality by downloading Beta of PostgresDAC-2.6.0 directly from the MicroOLAP site. Please feel free to contact Support Team at your earliest convenience with the questions or proposals.


2 thoughts on “New TPSQLPointField class in PostgresDAC-2.6.0

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s