最新 delphi xe dataSnap callback 问题
delphi xe 增强了callback功能
但是,看李维先生的例子,TDSClientCallbackChannelManager,好像没有用TSQLConnection上的服务器参数
这样,在密码认证的DataSnap 服务器上,就无法使用TDSClientCallbackChannelManager 来注册callback
不知道有没有先知,不吝赐教?
delphi xe 增强了callback功能
但是,看李维先生的例子,TDSClientCallbackChannelManager,好像没有用TSQLConnection上的服务器参数
这样,在密码认证的DataSnap 服务器上,就无法使用TDSClientCallbackChannelManager 来注册callback
不知道有没有先知,不吝赐教?
strict private
FSecurityToken: String;
FDSHostname: String;
FDSPort: String;
FDSPath: String;
FCommunicationProtocol: String;
FChannelName: String;
FManagerId: String;
FConnectionTimeout: String;
FCommunicationTimeout: String; FLocalCallbackRepo: TObjectDictionary<String, TDBXCallback>;
//增加一个
FDBXConnection:TFDBXConnection;
protected
........
property ConnectionTimeout: String read FConnectionTimeout write FConnectionTimeout;
property CommunicationTimeout: String read FCommunicationTimeout write FCommunicationTimeout;
//增加一个
property DBXConnection:TFDBXConnection read FDBXConnection write FDBXConnection; end;
implementation...procedure TDSClientCallbackChannelManager.ExecuteRemote(const AClassName,
AMethodName: String; ParamSetup, ParamCheckup: TParamSetup; NoTimeout: boolean);
var
DBXConnection: TDBXConnection;
DBXProperties: TDBXDatasnapProperties;
DBXCommand: TDBXCommand;
begin
DBXProperties := DBXConnectionProperties(NoTimeout);
try
//这里改一下就可以
if FDBXConnection<>nil then
DBXConnection := TDBXConnectionFactory.GetConnectionFactory.GetConnection(FDBXConnection.ConnectionProperties)
else DBXConnection := TDBXConnectionFactory.GetConnectionFactory.GetConnection(DBXProperties);
try
DBXCommand := DBXConnection.CreateCommand;
try
DBXCommand.CommandType := TDBXCommandTypes.DSServerMethod;
DBXCommand.Text := Format('%s.%s', [AClassName, AMethodName]);
DBXCommand.Prepare; ParamSetup(DBXCommand.Parameters); DBXCommand.ExecuteUpdate;
ParamCheckup(DBXCommand.Parameters);
finally
try
DBXCommand.Close;
except
// ignore closing exceptions
end;
DBXCommand.Free;
end;
finally
try
DBXConnection.Close;
except
// ignore it
end;
DBXConnection.Free;
end;
finally
DBXProperties.Free;
end;
end;这样改了后我们是可以用,不知道有那位高手可以改一改淡要再建一个连接,而是使用Tsqlconnection建立的那一个连接。