Patch for direct access to the API PostgreSQL

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
mrLion
Senior Boarder
Senior Boarder
Posts: 71
Joined: 20.03.2010, 10:17

Patch for direct access to the API PostgreSQL

Post by mrLion »

The work often arises the need for direct access to the API database PostgreSQL. In version ZEOS 6.x get a reference to the function was quite simple, but in 7.0 it somehow disappeared. I ask you to add a given patch.

Code: Select all

--- D:/Design/ZEOS7Alpha/src/plain/ZPlainPostgreSqlDriver.pas	Вс ноя 21 12:31:26 2010
+++ D:/Design/Components/SET_OF_COMPONENTS/ZEOS/src/plain/ZPlainPostgreSqlDriver.pas	Пн апр  4 14:22:34 2011
@@ -466,6 +466,7 @@
   lo_export:       Tlo_export;
 end;
 
+PAPI = ^TZPOSTGRESQL_API; //Rog
 type
 
   {** Represents a generic interface to PostgreSQL native API. }
@@ -567,6 +568,7 @@
       FileName: PAnsiChar): Oid;
     function ExportLargeObject(Handle: PZPostgreSQLConnect; ObjId: Oid;
       FileName: PAnsiChar): Integer;
+    function GetPlainFunc():PAPI; ///Rog
   end;
 
   {** Implements a base driver for PostgreSQL}
@@ -681,6 +683,7 @@
       FileName: PAnsiChar): Oid;
     function ExportLargeObject(Handle: PZPostgreSQLConnect; ObjId: Oid;
       FileName: PAnsiChar): Integer;
+    function GetPlainFunc():PAPI; ///Rog
   end;
 
   {** Implements a driver for PostgreSQL 7.4 }
@@ -811,7 +814,11 @@
 begin
   POSTGRESQL_API.PQclear(Res);
 end;
-
+// Rog
+function TZPostgreSQLBaseDriver.GetPlainFunc():PAPI;
+begin
+  result:= @POSTGRESQL_API;
+end;
 function TZPostgreSQLBaseDriver.CloseLargeObject(
   Handle: PZPostgreSQLConnect; Fd: Integer): Integer;
 begin
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

SVN Rev 885 (Testing branch).

The API functions have been hidden by the redesign of the PlainLoader/Plaindriver classes we did in version 7. When you look at the code difference between 6.6 and 7.x you'll see the plain layer code is a lot cleaner. And indeed, more low level stuff has been hidden inside the driver classes.

Mark
Image
mrLion
Senior Boarder
Senior Boarder
Posts: 71
Joined: 20.03.2010, 10:17

Post by mrLion »

mdaems, For sure I will not open "terrible" secret that the use of low-level API sometimes much more effective. Many thanks for the quick response to my request.
Locked