Change ProtocolVersion at run-time
-
- Posts: 4
- Joined: Fri 05 Aug 2011 13:32
- Location: United States
Change ProtocolVersion at run-time
Is it possible to change the protocolversion at runtime? pv30 is 3x slower for my connection, but it provides better feedback. I'd like to give the user the option to switch protocols. Seems simple, but I haven't figured it out ...
Hello,
You can use the following code to change the protocol version in the runtime:
You can use the following code to change the protocol version in the runtime:
Code: Select all
procedure TForm1.ChangeProtocol(Connection: TPgConnection;
Value: TProtocolVersion);
var
OldState: Boolean;
begin
if not Assigned(Connection) then exit;
if Value Connection.ProtocolVersion then
begin
if Connection.Connected then
begin
OldState := true;
Connection.Disconnect;
end;
Connection.ProtocolVersion := Value;
if OldState then
Connection.Connect;
end;
end;