summaryrefslogtreecommitdiff
path: root/packages/fcl-db/src/sqldb/postgres/pqconnection.pp
diff options
context:
space:
mode:
Diffstat (limited to 'packages/fcl-db/src/sqldb/postgres/pqconnection.pp')
-rw-r--r--packages/fcl-db/src/sqldb/postgres/pqconnection.pp16
1 files changed, 10 insertions, 6 deletions
diff --git a/packages/fcl-db/src/sqldb/postgres/pqconnection.pp b/packages/fcl-db/src/sqldb/postgres/pqconnection.pp
index 664b8a2bd9..d40e9a9398 100644
--- a/packages/fcl-db/src/sqldb/postgres/pqconnection.pp
+++ b/packages/fcl-db/src/sqldb/postgres/pqconnection.pp
@@ -546,7 +546,7 @@ begin
FPrepared := True;
end
else
- statement := buf;
+ statement := AParams.ParseSQL(buf,false,sqEscapeSlash in ConnOptions, sqEscapeRepeat in ConnOptions,psPostgreSQL);
end;
end;
@@ -561,10 +561,11 @@ begin
res := pqexec(tr.PGConn,pchar('deallocate prepst'+nr));
if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
begin
+ pqclear(res);
+ DatabaseError(SErrPrepareFailed + ' (PostgreSQL: ' + PQerrorMessage(tr.PGConn) + ')',self)
+ end
+ else
pqclear(res);
- DatabaseError(SErrPrepareFailed + ' (PostgreSQL: ' + PQerrorMessage(tr.PGConn) + ')',self)
- end;
- pqclear(res);
end;
FPrepared := False;
end;
@@ -641,9 +642,12 @@ begin
s := Statement;
res := pqexec(tr.PGConn,pchar(s));
if (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
- pqclear(res);
+ begin
+ pqclear(res);
+ res:=nil;
+ end;
end;
- if not (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
+ if assigned(res) and not (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
begin
s := PQerrorMessage(tr.PGConn);
pqclear(res);