ZEOS Database Objects
PostgreSQL Components

Contents


TZPgSQLDatabase

Properties | Methods | Events

Component for connections to the PostgreSQL database server. The dynamic load library libpg.dll is necessary.

Hierarchy: TObject->TPersistent->TComponent->TZDatabase->TZPgSQLDatabase

TZPgSQLDatabase properties
Handle:TDirConnect Descriptor of direct connection to the database
Host:ShortString PostgreSQL database server host name
Database:ShortString Database name
Login:ShortString User name for connection
Password:ShortString Password for connection to the database
LoginPromt:Boolean When the value is switched to true, window for entering user name and password appears.
Port:ShortString Port number for connection to PostgreSQL server
Connected:Boolean Indicates the connection to database. When the value is switched to true, connection to the database occurs. Method Connect does the same.
Encoding:TEncodingType Indicates the local code page of symbols for representing contents of the database content. The following table lists all possible values:
  • etNone
  • et866
  • etCp1251
  • etISO88592
  • etKOI8r

Back | Contents

TZPgSQLDatabase methods
procedure Connect() Connects to the database
procedure Disconnect() Disconnects from the database

Back | Contents

TZPgSQLDatabase events
procedure AfterConnect(Sender:TObject) Occurs after an application completes connecting to a database
procedure AfterDisconnect(Sender:TObject) Occurs after an application completes disconnecting from a database
procedure BeforeConnect(Sender:TObject) Occurs before an application completes connecting to a database
procedure BeforeDisconnect(Sender:TObject) Occurs before an application completes disconnecting from a database

Back | Contents

TZPgSQLMonitor

Events

Component for the tracing of an outgoing queries. It have the one event, which occurs when any SQL queries is processed by PostgreSQL server. It returns the outgoing query and its result.

Hierarchy: TObject->TPersistent->TComponent->TZMonitor->TZPgSQLMonitor

TZPgSQLMonitor events
procedure MonitorEvent(Sql, Result: String) Event occurs when PostgreSQL server have processed the query. The returning values:
  • Sql - text of the outgoing query
  • Result - the result, which includes errors and time of processing.

Back | Contents

TZPgSQLQuery

Properties | Methods | Events

Component for perfoming SQL queries to PostgreSQL server. It's used for sending SQL statements to PostgreSQL server. пересылки выражений SQL запросов PostgreSQL серверу. The results of processing is available to use with the standart TDataSource. The records can be added, deleted or changed.

Hierarchy: TObject->TPersistenet->TComponent->TDataSet->TZDataSet-> TZCustomPostgreSQLDataSet->TZPgSQLQuery

TZPgSQLQuery properties
Active:Boolean Indicates the query is opened. When the value is switched to true, query will be opened. For query like 'SELECT' only.
AutoCalcFields:Boolean Determines when the OnCalcFields event is triggered.
CachedUpdates:Boolean Specifies whether cached updates are enabled
DataBase:TZPgSQLDatabase Identifies the database component
DataSource:TDataSource Identifies DataSource for access
ExtraOptions:TPostgreSQLOptions The set of the special options:
  • poTextAsMemo - specifies that field of type TEXT will be represented as MEMO field, otherwise as string with length 255 symbols.
  • poOisAsBlob - specifies that field of type OID will be considered as containing pointers on LargeObjects and represented as Blob field. ,otherwise as Integer
Filter:ShortString Specifies the text of the current filter for a dataset.
Filtered:Boolean Specifies whether filtering is active for a dataset.
FilterOptions:TFilterOptions Specifies filters is:
  • foCaseInsensitive - whether filtering is case insensitive
  • foNoPartialCompare - whether or not partial comparisons are permitted when filtering records
LinkFields The Wizard of relationships of queries
LinkOptions:TZLinkOptions The set of options for linking fileds
  • loLinkRequery - determines wheter or not link reguery
  • loCascadeUpdate - determines cascade renovation of data
  • loCascadeDelete - determines cascade removing
  • loAlwaysResync - determines sinchronization
MasterSource:TDataSource Indicates the master DataSource for linking of fields
Options:TZDatabaseOptions Extended options
  • doParamAsIs - determines processing parameters in their primary representation
  • doHourGlass - determines whether or not to display a sand clock while query is processing
  • doQueryAllRecords - determines to process all records
  • doCheckNulls - determines check nulls values
  • doCalcDefault - determines calculation by default
ParamCount:Word Indicates the current number of parameters for the query.
Params:TParams Contains the parameters for a query's SQL statement.
ParamCheck:Boolean Specifies whether the parameter list for a query is regenerated
RequestLive:Boolean Specifies whether or not a query result is read-only
RecordCount:LongInt Indicates the total number of records associated with the dataset.
ShowRecordTypes The parameters of records, which determines to show:
  • rtModified - all modified records
  • rtInserted - all added records
  • rtDeleted - all deleted records
  • rtUnmodified - all unmodified records
Sql:TStringList Contains the text of the SQL statement to execute for the query
Transaction:TZPgSQLTransact Indicates Transact component
UpdateObject:TZUpdateSQL Specifies the update object component used to update a read-only result set when cached updates are enabled.

Back | Contents

TZPgSQLQuery methods
procedure ExecSql; Executes the SQL statement for the query. Use ExecSQL to execute queries that do not return a cursor to data (such as INSERT, UPDATE, DELETE, and CREATE TABLE).
function RowsAffected: LongInt; Returns the number of rows operated upon by the latest query execution.
procedure SortInverse; Inverts rules for sorting of the records
procedure SortClear; Removes rules for sorting of the records
procedure SortByField(FieldName: string); Sorts all record by field
procedure SortDescByField(FieldName: string); Sorts all record by field descanding
function Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions): Boolean; Searches the dataset for a specified record and makes that record the current record. Options is a set that optionally specifies additional search latitude when searching on string fields.
  • loCaseInsensitive - Key fields and key values are matched without regard to case
  • loPartialKey - Key values can include only part of the matching key field value
Returns True if it finds a matching record,
function Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant; Retrieves field values from a record that matches specified search values, like Locate.
function IsSequenced: Boolean; Indicates whether sequence numbers are available for database records.
procedure ApplyUpdates; Writes a dataset's pending cached updates to the database
procedure CommitUpdates; Clears the cached updates buffer.
procedure CancelUpdates; Clears all pending cached updates from the cache and restores the dataset its prior state.
procedure RevertRecord; Restores the current record in the dataset to an unmodified state when cached updates are enabled.
function ParamByName(const Value: string): TParam; Accesses parameter information based on a specified parameter name.
function CreateBlobStream(Field: TField; Mode: TBlobStreamMode): TStream; Provides the interface for a method that creates a blob stream for a Binary large object (BLOB) field in the dataset.
  • bmRead - The stream is used to read from a BLOB field.
  • bmWrite - The stream is used to write to a BLOB field.
  • bwReadWrite - The stream is used to modify a BLOB field's value.
procedure SaveToStream(Stream: TStream); Saves the contents of a Dataset to a stream.
procedure LoadFromStream(Stream: TStream); Loads a stream into the Dataset.
procedure SaveToFile(FileName: string); Saves a dataset's data to an external file.
procedure LoadFromFile(FileName: string); Loads a dataset's data from a file.

Back | Contents

TZPgSQLQuery events
procedure AfterCancel(DataSet: TDataSet); Occurs after an application completes a request to cancel modifications to the current record.
procedure AfterClose(DataSet: TDataSet); Occurs after an application closes a dataset.
procedure AfterDelete(DataSet: TDataSet); Occurs after an application deletes a record.
procedure AfterEdit(DataSet: TDataSet); Occurs after an application deletes a record.
procedure AfterInsert(DataSet: TDataSet); Occurs after an application inserts a new record.
procedure AfterOpen(DataSet: TDataSet); Occurs after an application completes opening a dataset and before any data access occurs.
procedure AfterPost(DataSet: TDataSet); Occurs after an application writes the current record to the database or cache and before the dataset is returned to browse state.
procedure AfterScroll(DataSet: TDataSet); Occurs after an application scrolls from one record to another.
procedure BeforeCancel(DataSet: TDataSet); Occurs before an application executes a request to cancel changes to the current record.
procedure BeforeClose(DataSet: TDataSet); Occurs before an application executes a request to close the dataset.
procedure BeforeDelete(DataSet: TDataSet); Occurs before an application attempts to delete the current record.
procedure BeforeEdit(DataSet: TDataSet); Occurs before an application enters edit mode for the current record.
procedure BeforeInsert(DataSet: TDataSet); Occurs before an application enters insert mode.
procedure BeforeOpen(DataSet: TDataSet); Occurs before an application executes a request to open a dataset.
procedure BeforePost(DataSet: TDataSet); Occurs before an application posts changes for the current record to the database or cache.
procedure BeforeScroll(DataSet: TDataSet); Occurs before an application scrolls from one record to another.
procedure ApplyUpdateError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); Occurs if an exception is generated when cached updates are applied to a database.
procedure CalcFields(DataSet: TDataSet); Occurs when an application recalculates calculated fields.
procedure DeleteError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); Occurs when an application attempts to delete a record and an exception is raised.
procedure EditError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); Occurs when an application attempts to modify or insert a record and an exception is raised.
procedure FilterRecord(DataSet: TDataSet;var Accept: Boolean); Occurs each time a different record in the dataset becomes the current record and filtering is enabled.
procedure NewRecord(DataSet: TDataSet); Occurs when an application inserts or appends a new dataset record.
procedure PostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); Occurs when an application attempts to modify or insert a record and an exception is raised.
procedure UpdateRecord(DataSet: TDataSet; UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction); Occurs if an exception is generated when cached updates are applied to a database.

Back | Contents


TZPgSQLTable

Component for processing the results of the query to PostgreSQL server in the manner of table.

Hierarchy: TObject->TPersistenet->TComponent->TDataSet->TZDataSet-> TZCustomPostgreSQLDataSet->TZPgSQLTable

Hasn't any principle differences from TZPgSQLQuery, but the following exclusions:

Back | Contents

TZPgSQLTransact

Properties | Methods | Events

Component for work with transactions of PostgreSQL server

Hierarchy: TObject->TPersistent->TComponent->TZTransact->TZPgSQLTransact
TZPgSQLTransact properties
AutoCommit:Boolean If of the value of this property is switched to true then updates will be apllied automatically. Otherwise is necessary to call Commit or Rollback manually.
AutoRecovery:Boolean Indicates re-open of the transaction if error occur.
Connected:Boolean Indicates the connection to a database
Database:TZPgSQLDatabase Specifies a database component
Options:TZTransactOptions The set of options:
  • toHourGlass - determines to display a sand clock while transactions is procesing

Back | Contents

TZPgSQLTransact methods
procedure Connect Connects to PostgreSQL server
procedure Disconnect Disconnects from PostgreSQL server
procedure Commit Updates all changes in the transaction buffer and its clear
procedure RollBack Rollback of transactions
procedure DoApplyUpdates Updates all changes from the transaction buffer

Back | Contents

TZPgSQLTransact events
procedure OnApplyUpdates(Sender:TObject) Occurs when an application applies all changes from the transaction buffer
procedure OnCommit(Sender:TObject) Occurs when an application calls Commit method
procedure OnDataChange(Sender:TObject) Occurs when contents of the database is changed
procedure OnRollBack(Sender:TObject) Occurs when an apllication calls Rollback method

Back | Contents