- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我开发了一个使用 PostgreSQL 8.4 RDBMS 的客户端应用程序。
我的应用程序是用 Lazarus 和 ZeosLib 7.2 编写的,用于数据库访问。
我使用了很多存储过程,在特定点上我使用 raise notice 来获取过程状态的信息,Es:
RAISE NOTICE 'Step 1: Import Items from CSV file';
....
....
RAISE NOTICE 'Step 2: Check Items data';
当我在 PgAdmin3 中执行程序时,它会在“消息”选项卡中显示通知。有一种方法可以在我的客户端应用程序中捕获引发的通知吗?
最佳答案
好吧,虽然我对这个话题也很感兴趣,但这里有一些在快速调查后创建的工作示例:
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.
它对我有用。
我猜这个例子不准确并且包含一些问题。例如,在从外部源调用的过程中使用 LCL 调用。但我希望这足以开始。
测试环境为:FPC 2.6.4、Lazarus 1.5、Postgres 9.3、Linux Mint
关于PostgreSQL:通过 ZeosLib/Lazarus 从客户端连接捕获 RAISE NOTICE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33526809/
我使用 Zeoslib 组件与我的 SQLite 数据库文件进行交互。我在一个文件夹中有几个 SQLite 数据库文件。所以,我希望能够使用 Zeoslib 组件打开其中任何一个。但是,它不会让我。它
是否可以使用 Zeoslib 和 Firebird 确定参数化查询中的参数数据类型? 我正在从 FibPlus 迁移到 Zeoslib。 带有类似“从注册成员(member)中选择名字、姓氏、年龄
我正在使用 mysql 开发一个项目,为此我正在使用 zeoslib 做一个类,我可以建立连接,我可以执行插入、更新等查询。但我的问题是 select,我运行它悄悄地,但我该怎么做才能得到返回呢?我想
我想知道如何将查询保存在内存中以显示在 DBgrid 中, 我当前的应用程序正在使用: TZConnection > TZquery > 数据源 > DBgrid 工作正常,但这里的问题是,在调用 Z
在 Firebird/Interbase 数据库中,我们有 TIBQuery、TIBTable 和 TIBDataSet,它们具有 FetchAll 方法计算该数据集有多少行。如果我们不调用该方法,这
我在 Delphi 中使用 Zeoslib 访问本地 MySQL 数据库。 我用 TZQuery 对象调用存储过程: ZMakeRankedTable.SQL.Text := 'CALL Make
我在启用共享内存协议(protocol)的情况下启动了本地 MYSQL 服务器。如何使用 ZeosLib 连接到我的服务器?我在哪里指定它正在使用共享内存? 我使用的是 Lazarus(freepas
我正在使用 Zeoslib Delphi 中的库。 我有一个大型多维静态数组,需要将其传输到本地 MySQL 数据库中的一个空表。我怎样才能有效地做到这一点? 只是迭代一百万个插入语句? 最佳答案 您
我在 Delphi 中使用 ZeosLib 通过 TZQuery 对象调用 MySQL 存储过程。在 MySQL 完成存储过程的执行后,我需要立即启动下一个代码块。 我在 MySQL 存储过程的末尾添
我正在尝试连接到远程 MySQL 服务器,但收到此异常错误: *使用旧的(4.1.1 之前)身份验证协议(protocol)的连接被拒绝(客户端选项“secure_auth”已启用)* 我尝试通过将字
我开发了一个使用 PostgreSQL 8.4 RDBMS 的客户端应用程序。 我的应用程序是用 Lazarus 和 ZeosLib 7.2 编写的,用于数据库访问。 我使用了很多存储过程,在特定点上
我有一个绑定(bind)到 DBGrid 的 TZTable (ZEOSlib),现在我需要知道用户更改了哪个特定的 TField。 我尝试过 if NOT (taPositionenArtNrGH.
我在使用 Delphi ZeosLib 和 Delphi 7 将 Unicode 插入 SQL Server 数据库,然后读取插入的值时遇到问题。我创建了一个简单的测试程序,首先插入然后查询插入的值。
我正在使用 MySQL 服务器和 Zeoslib 与 Delphi。我的程序可以远程连接MySQL数据库,但不能连接本地。但是,它不断引发以下错误 - “没有动态库可以找到或无法加载...” 因此,我
我是一名优秀的程序员,十分优秀!