fcl-db: postgresql: Fix AV in UnprepareStatement (TPQCursor.tr is nil).

Revealed by TTestTSQLQuery.TestKeepOpenOnCommit.
Commit destroys TPQTrans object, which in destructor sets tr:=nil for all registered cursors. So attempt to Close TSQLQuery after Commit has leading to AV.

git-svn-id: trunk@29507 -
This commit is contained in:
lacak 2015-01-19 13:01:51 +00:00
parent d24382e8f8
commit d8ce1caea3

View File

@ -953,7 +953,7 @@ begin
res:=nil;
if FPrepared then
begin
if PQtransactionStatus(tr.PGConn) <> PQTRANS_INERROR then
if assigned(tr) and (PQtransactionStatus(tr.PGConn) <> PQTRANS_INERROR) then
begin
res := PQexec(tr.PGConn,pchar('deallocate '+StmtName));
CheckResultError(res,nil,SErrUnPrepareFailed);