Patch for TZPostgreSQLConnection
Posted: 05.04.2012, 07:18
Exception on destroy program
Haw it's make
Create new project
Append TZConnecttion, TZSQLMonitor
On Create
Make connection to server
When halt(0)
On Destroy
Make query ZConnection.ExecuteDirect
Patch:
Tested ON: Win7, Delphi XE2, Postgres 8.4
Haw it's make
Create new project
Append TZConnecttion, TZSQLMonitor
On Create
Make connection to server
When halt(0)
On Destroy
Make query ZConnection.ExecuteDirect
Patch:
Code: Select all
Index: ZDbcPostgreSql.pas
===================================================================
--- ZDbcPostgreSql.pas (revision 1089)
+++ ZDbcPostgreSql.pas (working copy)
@@ -746,13 +746,14 @@
var
LogMessage: string;
begin
- if not Closed then
- begin
+ if not Closed then begin
FPlainDriver.Finish(FHandle);
FHandle := nil;
LogMessage := Format('DISCONNECT FROM "%s"', [Database]);
- DriverManager.LogMessage(lcDisconnect, FPlainDriver.GetProtocol, LogMessage);
+ if Assigned(DriverManager) then
+ DriverManager.LogMessage(lcDisconnect, FPlainDriver.GetProtocol, LogMessage);
end;
+
inherited Close;
end;