SupportBinaryProtocol: Boolean;
SupportBinaryProtocol: Boolean;
The SupportBinaryProtocol property determines whether binary queries will be used to work with PostgreSQL server.
The property is relevant if the database connects to a server based on PostgreSQL DBMS.
Available values:
True. Binary queries are used to work with a server. The use of binary queries enables the user to reduce the volume of traffic required to send queries and get server data.
False. Default value. Text queries are used to work with a server.
NOTE. Binary queries can be used if PostgreSQL 9.3 or later is used at DBMS server.
Sub UserProc;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
DB: IDatabase;
LogonData: IPrimaryPostgresSPLD;
Begin
MB := MetabaseClass.Active;
//Information about created object
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_DATABASE;
CrInfo.Id := "POSTGRESQL_DB";
CrInfo.Name := "PostgreSQL database";
CrInfo.Parent := MB.Root;
//Create a new database and set up properties
DB := MB.CreateObject(CrInfo).Edit As IDatabase;
DB.Authentication := AuthenticationMode.Password;
DB.DriverId := "POSTGRES";
DB.SupportBinaryProtocol := True;
LogonData := DB.LogonData As IPrimaryPostgresSPLD;
LogonData.Server := "Server";
LogonData.Database := "PPTest";
//Save
(DB As IMetabaseObject).Save;
End Sub UserProc;
After executing the example a new database is created in the repository root directory. The database will connect to the specified schema located at PostgreSQL server. Binary queries will be used when addressing to the server.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
DB: IDatabase;
LogonData: IPrimaryPostgresSPLD;
Begin
MB := Params.Metabase;
//Information about created object
CrInfo := MB.CreateCreateInfo();
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_DATABASE As Integer;
CrInfo.Id := "POSTGRESQL_DB";
CrInfo.Name := "PostgreSQL database";
CrInfo.Parent := MB.Root;
//Create a new database and set up properties
DB := MB.CreateObject(CrInfo).Edit() As IDatabase;
DB.Authentication := AuthenticationMode.amPassword;
DB.DriverId := "POSTGRES";
DB.SupportBinaryProtocol := True;
LogonData := DB.LogonData As IPrimaryPostgresSPLD;
LogonData.Server := "Server";
LogonData.Database := "PPTest";
//Save
(DB As IMetabaseObject).Save();
End Sub;
See also: