PDAC Classes, Properties, Events, and Methods
This section contains a listing of all the classes, properties, events, and methods present in the Pervasive Direct Access Components. All are listed in Pascal notation and show differences with their Embarcadero counterpart components.
Exception Classes
Class EPvDatabaseError
This class is an ancestor for all exception classes in PDAC. It has the property Owner that contains a reference to the class that generated the exception.
Class EPvDBEngineError
This is an abstract base class for all DB engine error related classes. Property Errors lists the errors (in classes, derived from the TPvDBError class) and property ErrorCount indicates the total number of errors contained in the Errors property.
Class TPvDBError
TPvDBError is an abstract base class for all classes that represent database engine errors for the EPvDBEngineError exception class. It contains follow properties:
Property Message specifies the text of the error message.
Property NativeError indicates the status code returned from the engine (the Btrieve status code).
Class EPvDrmEngineError
Exceptions of this class are raised by the Btrieve subset of PDAC. Property ErrorCode is a DRM error code. The Errors array of EPvDrmEngineError contains objects with type TPvDrmError.
Class TPvDrmError
Class TPvDrmError describes a DRM error. In ErrorCode it contains a DRM error code, and in NativeError it contains a Btrieve status code.
Class EPvSqlEngineError
Exceptions of this class are raised by the SQL (relational) subset of PDAC. Property ErrorCode is the return value of the last ODBC call. The Errors array of EPvSqlEngineError contains objects with type TPvSqlError.
Class TPvSqlError
Class TPvSqlError describes ODBC errors.
Class EPvDbAdminEngineError
Exceptions of this class are raised during execution of DBNames and DSN management functions, such as TPvSqlSession.AddAlias, on local and remote servers. It has an additional property ErrorType: TPvDbAdminEngineErrorTypes. If ErrorType = dbmeDTI then NativeError contains a DTI (Distributed Tuning Interface) error code, otherwise NativeError contains local error codes of DBNames and DSN related function (see EPvSqlInstallerEngineError and EPvOwnSqlInstallerEngineError).
Class EPvSqlInstallerEngineError
Exceptions of this class are raised during execution of DNSs management functions, such as TPvSqlSession.AddAlias, on local servers, i.e. if TPvSqlSession.ServerName property is empty or has name of the local server. Errors contains the value, returned by SQLInstallerError() function.
Class EPvOwnSqlInstallerEngineError
Because DSN management functions in some cases lack meaningful errors, exceptions of this class are provided to raised in order to introduce new types of errors. In the NativeError the following values are possible:
Supporting Classes
Supporting classes are required by the higher-level components and encapsulate BDE-specific functionality. These classes are “cloned” in PDAC with as few changes as possible.
Class TPvSessionList/TPvSqlSessionList
Classes TPvSessionList and TPvSqlSessionList manage session components in applications that provide multiple sessions. In this class only the types of contained objects (TSession to TPvSession or TPvSqlSession) have been changed.
Class TPvBlobStream/TPvSQLBlobStream
Classes TPvBlobStream and TPvSQLBlobStream are stream objects that let applications read from or write to field objects that represent Binary large object (BLOB) fields. They function in the same way as the TBlobStream VCL class.
Classes TParam/TParams
Class TParam represents a field parameter. Properties of a TParam are used to set the value of a parameter that represents the value of a field. TParams is list of the TParam objects. TParam and TParams in PDAC have no changes in their interface sections; they are only moved to the new file.
Class TMasterDataLink
*Note: For Delphi/C++Builder 3 and 4 only
TMasterDataLink allows a dataset to establish a master/detail relationship. It has no changes in its interface section, and is only moved to a new file.
General Differences from VCL
Interfaces exposed by PDAC components correspond almost exactly to the appropriate VCL components, which work via the BDE. More detailed info about related VCL components is contained in the Delphi/C++Builder help system (file del?vcl.hlp or bcbvcl?.hlp, where ? is ‘3’ or ‘4’ or ‘5’). However, since some BDE features do not exist in Pervasive PSQL and some Pervasive PSQL features do not exist in the BDE, Pervasive has corrected these interfaces (dropped or added properties/methods/events). The listing below enumerates only those interfaces that have been changed. All other interfaces are cloned as-is.
Global Variables
Instead of the BDE’s ‘Session’ and ‘Sessions’ global variables, PDAC has its own global variables ‘BtvSession: TPvSession’ and ‘BtvSessions: TPvSessionList’ for the Btrieve subset and ‘PvSqlSession: TPvSqlSession’ and ‘PvSqlSessions: TPvSqlSessionList’ for the relational subset. They behave the same as the Session and Sessions variables and are created automatically on application startup and destroyed automatically on application shutdown.
Btrieve Subset
In the Transactional subset, PDAC uses Pervasive PSQL ‘Named Databases’ as aliases.
SQL Subset
In the Relational subset, PDAC uses Data Source Names (DSNs) as aliases.
Specific Class Differences from VCL
The following sections contain specific differences from the Embarcadero VCL.
TPvSession and TPvSqlSession
*Tip: For more information see DTI documentation.
*Tip: DTI is supported only by Pervasive.SQL 2000 and above.
TPvSession Specific
var MyList: TStringList;
begin
MyList := TStringList.Create;
try
with MyList do
begin
Add('DDF_PATH=D:\MyDemoData');
Add('PATH=D:\MyDemodata');
Add('BOUND=False');
Add('INTEGRITY=False');
Add('Create_DDF=False');
end;
PvSession1.AddAlias('TestAlias', MyList);
finally
MyList.Free;
end;
TPvSqlSession Specific
var MyStringList: TStringList;
begin
MyStringList := TStringList.Create;
try
MyStringList.Clear();
MyStringList.Add('IS_ENGINE_DSN=False');
MyStringList.Add('IS_SYSTEM_DSN=True');
MyStringList.Add('SERVER_NAME=ServerName');
MyStringList.Add('SERVER_DSN=DEMO1');
// DSN on the Server
PvSqlSession1.AddAlias('ATest', MyStringList);
finally
MyStringList.Free;
end;
TPvDatabase and TPvSqlDatabase
*Tip: For more information on SQLSetConnectAttr(), please refer to Microsoft ODBC Programmer's Reference.
TPvDatabase Specific
This property indicates that the database contains characters encoded according to the OEM (DOS) code page, and that these characters should be converted to the ANSI (Windows) code page before use. The database remains in the OEM code page, but all reads and writes of character data are translated by PDAC.
This conversion uses the mapping provided by the Windows OemToCharBuff and CharToOemBuff functions. It is important to note that not all characters are round-trip convertible. Only the characters present in both the OEM and ANSI code pages will be preserved in an update. As a rule of thumb, most of the alphabetic characters are preserved, but other types of characters, such as the box-drawing characters, may not be. For characters that cannot be preserved exactly, the closest look-alike character is chosen. For example, the box-drawing characters are replaced by plus (+), minus (-), and pipe (|).
Currently, only characters stored in user tables are converted. Metadata (stored in DDF files) such as table, column, and file names are not.
TPvSqlDatabase Specific
TPvTable, TPvQuery, and TPvStoredProc
TPvTable Specific
CurFilter – pointer to formed input data buffer structure for extended operations (see GetNextExtended in the Btrieve Programmer’s Reference). This buffer also contains the current filter.
Op – Btrieve operation. See Btrieve Programmer’s Reference;
DirectBtrCall returns the Btrieve status code. pKeyBuf, KeyLen and KeyNum parameters should be taken from PvTable.BtrHandle property.
Small samples below demonstrate how to lock and unlock the current record via direct calls to Btrieve:
procedure TForm1.Lock(Sender: TObject);
var b: TBookmark;
DataLen: word;
Res: integer;
begin
b := PvTable1.GetBookmark();
try
DataLen := 4;
Res := PvTable1.DirectBtrCall(B_GET_DIRECT + 300, b, DataLen, PvTable1.BtrHandle.pKeyBuf, PvTable1.BtrHandle.KeyLen, PvTable1.BtrHandle.KeyNum);
finally
PvTable1.FreeBookmark(b);
end;
end
 
procedure TForm1.Unlock(Sender: TObject);
var Res: integer;
vr: Word;
begin
vr := 0;
Res := PvTable1.DirectBtrCall(B_UNLOCK, @vr, vr, @vr, vr, -2);
end
TPvQuery and TPvStoredProc Specific
TPvQuery Specific
The following properties were added:
If ‘LoadBlobOnOpen’ is true, then all BLOBs will be cached in memory on query open. If ‘LoadBlobOnOpen’ is false, then BLOBs will be read as required.
Setting this property true will force PDAC to pass the SQL Text directly to the engine, without the pre-parsing that is ordinarily done to bind parameters. This is necessary when, for instance, creating Stored Procedures with parameters. Use the property as follows:
procedure TForm1.Button1Click(Sender: TObject);
begin
PvQuery1.SQL.Clear;
 
PvQuery1.SQL.Add('CREATE PROCEDURE TestPr(IN :A INTEGER) AS');
PvQuery1.SQL.Add('BEGIN');
PvQuery1.SQL.Add('PRINT :A;');
PvQuery1.SQL.Add('END');
PvQuery1.PassThrough := True;
PvQuery1.ExecSQL;
PvQuery1.PassThrough := False;
end;
The PassThrough Property is available at Design Time in the IDE, as well.
TPvStoredProc Specific
TPvUpdateSQL
TPvBatchMove