PgDAC

Demo Projects

PgDAC includes a number of demo projects that show off the main PgDAC functionality and development patterns.

The PgDAC demo projects consist of one large project called PgDacDemo with demos for all main PgDAC components, use cases, and data access technologies, and a number of smaller projects on how to use PgDAC in different IDEs and how to integrate PgDAC with third-party components.

Most demo projects are built for Delphi and Embarcadero RAD Studio. There are only two PgDAC demos for C++Builder. However, the C++Builder distribution includes source code for all the other demo projects as well.

Where are the PgDAC demo projects located?

In most cases all the PgDAC demo projects are located in "%PgDac%\Demos\".

In Delphi 2007 for Win32 under Windows Vista all the PgDAC demo projects are located in "My Documents\Devart\PgDac for Delphi 2007\Demos", for example "C:\Documents and Settings\All Users\Documents\Devart\PgDac for Delphi 2007\Demos\".

The structure of the demo project directory depends on the IDE version you are using.

For most new IDEs the structure will be as follows.

Demos

|—PgDacDemo [The main PgDAC demo project]

|—TechnologySpecific 

|  |— SecureBridge [A component and a demo for integration with the SecureBridge library]

|—ThirdParty

|  |— [A collection of demo projects on integration with third-party components]

|—Miscellaneous

   |— [Some other demo projects on design technologies]

 

PgDacDemo is the main demo project that shows off all the PgDAC functionality. The other directories contain a number of supplementary demo projects that describe special use cases. A list of all the samples in the PgDAC demo project and a description for the supplementary projects is provided in the following section.

Note: This documentation describes ALL the PgDAC demo projects. The actual demo projects you will have installed on your computer depends on your PgDAC version, PgDAC edition, and the IDE version you are using. The integration demos may require installation of third-party components to compile and work properly.

Instructions for using the PgDAC demo projects

To explore a PgDAC demo project,

  1. Launch your IDE.
  2. In your IDE, choose File | Open Project from the menu bar.
  3. Find the directory you installed PgDAC to and open the Demos folder.
  4. Browse through the demo project folders located here and open the project file of the demo you would like to use.
  5. Compile and launch the demo. If it exists, consult the ReadMe.txt file for more details.

The included sample applications are fully functional. To use the demos, you have to first set up a connection to PostgreSQL. You can do so by clicking on the "Connect" button.

Many demos may also use some database objects. If so, they will have two object manipulation buttons, "Create" and "Drop". If your demo requires additional objects, click "Create" to create the necessary database objects. When you are done with a demo, click "Drop" to remove all the objects used for the demo from your database.

Note: The PgDAC demo directory includes two sample SQL scripts for creating and dropping all the test schema objects used in the PgDAC demos. You can modify and execute this script manually, if you would like. This will not change the behavior of the demos.

You can find a complete walkthrough for the main PgDAC demo project in the Getting Started topic. The other PgDAC demo projects include a ReadMe.txt file with individual building and launching instructions.

Demo project descriptions

PgDacDemo

PgDacDemo is one large project which includes three collections of demos.

Working with components

A collection of samples that show how to work with the basic PgDAC components.

General demos

A collection of samples that show off the PgDAC technology and demonstrate some ways to work with data.

PostgreSQL-specific demos

A collection of samples that demonstrate how to incorporate PostgreSQL features in database applications.

PgDacDemo can be opened from %PgDac%\Demos\PgDacDemo\PgDacDemo.dpr (.bdsproj). The following table describes all demos contained in this project.

Working with Components

Name Description
Alerter Uses TPgAlerter to send notifications between connections.

ConnectDialog Demonstrates how to customize the PgDAC connect dialog . Changes the standard PgDAC connect dialog to two custom connect dialogs. The first customized sample dialog is inherited from the TForm class, and the second one is inherited from the default PgDAC connect dialog class.
CRDBGrid Demonstrates how to work with the TCRDBGrid component. Shows off the main TCRDBGrid features, like filtering, searching, stretching, using compound headers, and more.
Dump Demonstrates how to backup data from tables with the TPgDump component. Shows how to use scripts created during back up to restore table data. This demo lets you back up a table either by specifying the table name or by writing a SELECT query.
Loader Uses the TPgLoader component to quickly load data into a server table. This demo also compares the two TPgLoader data loading handlers: GetColumnData and PutData .
Query Demonstrates working with TPgQuery , which is one of the most useful PgDAC components. Includes many TPgQuery usage scenarios. Demonstrates how to execute queries in both standard and NonBlocking mode and how to edit data and export it to XML files.

Note: This is a very good introductory demo. We recommend starting here when first becoming familiar with PgDAC.

Sql Uses TPgSQL to execute SQL statements. Demonstrates how to work in a separate thread, in standard mode, in NonBlocking mode, and how to break long-duration query execution.
StoredProc Uses TPgStoredProc to access an editable recordset from a PostgreSQL stored procedure in the client application.
Table Demonstrates how to use TPgTable to work with data from a single table on the server without writing any SQL queries manually. Performs server-side data sorting and filtering and retrieves results for browsing and editing.
UpdateSQL Demonstrates using the TPgUpdateSQL component to customize update commands. Lets you optionally use T:Devart.PgDac.TPgCommand and TPgQuery objects for carrying out insert, delete, query, and update commands.
VirtualTable Demonstrates working with the TVirtualTable component. This sample shows how to fill virtual dataset with data from other datasets, filter data by a given criteria, locate specified records, perform file operations, and change data and table structure.

General Demos

Name Description
CachedUpdates Demonstrates how to perform the most important tasks of working with data in CachedUpdates mode, including highlighting uncommitted changes, managing transactions, and committing changes in a batch.
FilterAndIndex Demonstrates PgDAC's local storage functionality. This sample shows how to perform local filtering, sorting and locating by multiple fields, including by calculated and lookup fields.
MasterDetail Uses PgDAC functionality to work with master/detail relationships. This sample shows how to use local master/detail functionality. Demonstrates different kinds of master/detail linking, including linking by SQL, by simple fields, and by calculated fields.
Lock Demonstrates the recommended approach for managing transactions with the TPgConnection component. The TPgConnection interface provides a wrapper for PostgreSQL server commands like START TRANSACTION, COMMIT, ROLLBACK.

PostgreSQL-specific Demos

Name Description
Pictures Uses PgDAC functionality to work with graphics. The sample demonstrates how to retrieve binary data from PgSQL server database and display it on visual components. Sample also shows how to load and save pictures to files and to the database.
Text Uses PgDAC functionality to work with text. The sample demonstrates how to retrieve text data from SQL Server database and display it on visual components. Sample also shows how to load and save text to files and to the database.

Supplementary Demo Projects

PgDAC also includes a number of additional demo projects that describe some special use cases, show how to use PgDAC in different IDEs and give examples of how to integrate it with third-party components. These supplementary PgDAC demo projects are sorted into subfolders in the %PgDac%\Demos\ directory.

Location Name Description
ThirdParty FastReport Demonstrates how PgDAC can be used with FastReport components. This project consists of two parts. The first part is several packages that integrate PgDAC components into the FastReport editor. The second part is a demo application that lets you design and preview reports with PgDAC technology in the FastReport editor.
TechnologySpecific SecureBridge The demo project demonstrates how to integrate the SecureBridge components with PgDAC to ensure secure connection to PostgreSQL server through an SSH tunnel and SSL.
This demo consists of three parts. The first part is a package that contains the TPgSSHIOHandler and TPgSSLIOHandler component. These components provide integration with the SecureBridge library. The second part is two sample projects that demonstrate how to connect to PostgreSQL server through an SSH server and through SSL, connect to the SSH server with SecureBridge by password or by public key, generate reliable random numbers, enable local port forwarding.
For more information see the Readme.html file in the demo directory.
Miscellaneous Dll Demonstrates creating and loading DLLs for PgDAC-based projects. This demo project consists of two parts - an Pg_Dll project that creates a DLL of a form that sends a query to the server and displays its results, and an Pg_Exe project that can be executed to display a form for loading and running this DLL. Allows you to build a dll for one PgDAC-based project and load and test it from a separate application.
FailOver Demonstrates the recommended approach to working with unstable networks. This sample lets you perform transactions and updates in several different modes, simulate a sudden session termination, and view what happens to your data state when connections to the server are unexpectedly lost. Shows off CachedUpdates, LocalMasterDetail, FetchAll, Pooling, and different Failover modes.
PgDacDemo PgDacDemo [Win32 version of the main PgDAC demo project - see above]
© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback