uniGUI之FirDAC(13)

2020-02-05 16:00:40来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

uniGUI之FirDAC(13)

In uniGUI, each TFDConnection component must be placed on MainModule or a DataModule created from uniGUI Wizard. It is also possible to create and destroy a common datamodule as part of the constructor and destructor of any TUniForm (because they are also private to its session). This will ensure that each session will have its own private TFDConnection component.

在uniGUI,每个TFDConnection组件必须放在 MainModule或者 由uniGUI Wizard创建的DataModule里。TFDConnection也可创建和销毁公众 datamodule ,作为 TUniForm(因为他们对Session同样是私有的)的constructor 和destructor 。这将确保每个Session将有它自己私有的TFDConnection组件。

In addition to that, we need to place a TFDManager component on the ServerModule and set its Active property to True in ServerModule's OnCreate event.

另外,要放一个TFDManager组件在ServerModule ,在ServerModule的OnCreate 事件里,设置它的Active 属性为True,。

Other components to place on ServerModule are TFDGUIxWaitCursor and TFDPhysXXXDriverLink. TFDPhysXXXDriverLink is the driver link component for your database engine. For MySQL it should be TFDPhysMySQLDriverLink. For TFDGUIxWaitCursor set Provider to Console and ScreenCursor to gcrNone. 

其他要放在ServerModule 里的组件有: TFDGUIxWaitCursor 和TFDPhysXXXDriverLink。TFDPhysXXXDriverLink是根据你的数据库类型来的,例如,MySQL就应该为TFDPhysMySQLDriverLink。将TFDGUIxWaitCursor的Provider 设置为Console ,同时 ScreenCursor 设置为gcrNone.。

In the OnCreate event FDManager1.Active should be set to True.

FDManager1的OnCreate 事件里, FDManager1.Active 应该设置为True.

procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);
begin
.
.
  FDManager1.Active := True;
end;

In similar manner, in the OnDestroy event FDManager1.Close should be called.

类似地,FDManager1的OnDestroy 事件,FDManager1.Close 应被调用。

procedure TUniServerModule.UniGUIServerModuleDestroy(Sender: TObject);
begin
.
.
.
  FDManager1.Close;
end;

Pooling Connections 连接池

One of the advanced features in  FireDAC is the support for pooled connections. It allows sharing identical database connections among sessions.

FireDAC 的一个高级特色,就是它支持连接池。它允许在多个会话里,共用同一个数据库连接


原文链接:https://www.cnblogs.com/tulater/p/12264271.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:uniGUI之MainModule(12)

下一篇:uniGUI之TUniHiddenPanel(14)