* Mark blob parameters as binary

git-svn-id: trunk@16207 -
This commit is contained in:
michael 2010-10-23 14:09:59 +00:00
parent 52a118efbb
commit a723c86cb1

View File

@ -573,9 +573,11 @@ end;
procedure TPQConnection.Execute(cursor: TSQLCursor;atransaction:tSQLtransaction;AParams : TParams); procedure TPQConnection.Execute(cursor: TSQLCursor;atransaction:tSQLtransaction;AParams : TParams);
var ar : array of pchar; var ar : array of pchar;
i : integer; l,i : integer;
s : string; s : string;
ParamNames,ParamValues : array of string; lengths,formats : array of integer;
ParamNames,
ParamValues : array of string;
begin begin
with cursor as TPQCursor do with cursor as TPQCursor do
@ -585,7 +587,10 @@ begin
pqclear(res); pqclear(res);
if Assigned(AParams) and (AParams.count > 0) then if Assigned(AParams) and (AParams.count > 0) then
begin begin
setlength(ar,Aparams.count); l:=Aparams.count;
setlength(ar,l);
setlength(lengths,l);
setlength(formats,l);
for i := 0 to AParams.count -1 do if not AParams[i].IsNull then for i := 0 to AParams.count -1 do if not AParams[i].IsNull then
begin begin
case AParams[i].DataType of case AParams[i].DataType of
@ -602,10 +607,15 @@ begin
end; {case} end; {case}
GetMem(ar[i],length(s)+1); GetMem(ar[i],length(s)+1);
StrMove(PChar(ar[i]),Pchar(s),Length(S)+1); StrMove(PChar(ar[i]),Pchar(s),Length(S)+1);
lengths[i]:=Length(s);
if (AParams[i].DataType in [ftBlob,ftgraphic]) then
formats[i]:=1
else
Formats[i]:=0;
end end
else else
FreeAndNil(ar[i]); FreeAndNil(ar[i]);
res := PQexecPrepared(tr.PGConn,pchar('prepst'+nr),Aparams.count,@Ar[0],nil,nil,1); res := PQexecPrepared(tr.PGConn,pchar('prepst'+nr),Aparams.count,@Ar[0],@Lengths[0],@Formats[0],1);
for i := 0 to AParams.count -1 do for i := 0 to AParams.count -1 do
FreeMem(ar[i]); FreeMem(ar[i]);
end end