Ok, while I interesting in this topic too, here is some working example crated after the quick investigation:
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ZConnection, ZDbcPostgreSql;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
pgConn: TZConnection;
procedure Button1Click(Sender: TObject);
procedure pgConnAfterConnect(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure PGNotifyProcessor(arg: Pointer; message: PAnsiChar); cdecl;
begin
Form1.Memo1.Lines.Add(message);
end;
{ TForm1 }
procedure TForm1.pgConnAfterConnect(Sender: TObject);
var
pg: IZPostgreSQLConnection;
args: Pointer;
begin
pg := pgConn.DbcConnection as IZPostgreSQLConnection;
pg.GetPlainDriver.SetNoticeProcessor(pg.GetConnectionHandle, @PGNotifyProcessor, args);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
pgConn.ExecuteDirect('select foo(''bar'')');
end;
end.
It works for me.
I guess this example is not accurate and contains some issues. For example usage LCL calls in the procedure called from external source. But I hope it is enough to start.
Test environment is: FPC 2.6.4, Lazarus 1.5, Postgres 9.3, Linux Mint