mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-22 11:10:58 +02:00
Merged revisions 1374,1389,1396 via svnmerge from
svn+ssh://peter@www.freepascal.org/FPC/svn/fpc/trunk r1374 (marco) * TUpdatestatusset (kbmmw port missed this) r1389 (joost) + Fix bug #4376, varchar without size specification r1396 (joost) + fixed some memory issues when using parameters git-svn-id: branches/fixes_2_0@1430 -
This commit is contained in:
parent
093b45ec18
commit
3c0f6f85fe
@ -53,6 +53,7 @@ type
|
|||||||
deParentScroll);
|
deParentScroll);
|
||||||
|
|
||||||
TUpdateStatus = (usUnmodified, usModified, usInserted, usDeleted);
|
TUpdateStatus = (usUnmodified, usModified, usInserted, usDeleted);
|
||||||
|
TUpdateStatusSet = SET OF TUpdateStatus;
|
||||||
|
|
||||||
TUpdateMode = (upWhereAll, upWhereChanged, upWhereKeyOnly);
|
TUpdateMode = (upWhereAll, upWhereChanged, upWhereKeyOnly);
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ 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 pointer;
|
||||||
i : integer;
|
i : integer;
|
||||||
s : string;
|
s : string;
|
||||||
|
|
||||||
@ -479,13 +479,18 @@ begin
|
|||||||
begin
|
begin
|
||||||
setlength(ar,Aparams.count);
|
setlength(ar,Aparams.count);
|
||||||
for i := 0 to AParams.count -1 do
|
for i := 0 to AParams.count -1 do
|
||||||
|
begin
|
||||||
case AParams[i].DataType of
|
case AParams[i].DataType of
|
||||||
ftdatetime : ar[i] := pchar(formatdatetime('YYYY-MM-DD',AParams[i].AsDateTime));
|
ftdatetime : s := formatdatetime('YYYY-MM-DD',AParams[i].AsDateTime);
|
||||||
else
|
else
|
||||||
ar[i] := pchar(AParams[i].asstring);
|
s := AParams[i].asstring;
|
||||||
writeln(ar[i]);
|
end; {case}
|
||||||
|
GetMem(ar[i],length(s)+1);
|
||||||
|
StrMove(PChar(ar[i]),Pchar(s),Length(S)+1);
|
||||||
end;
|
end;
|
||||||
res := PQexecPrepared(tr,pchar('prepst'+nr),Aparams.count,@Ar[0],nil,nil,0)
|
res := PQexecPrepared(tr,pchar('prepst'+nr),Aparams.count,@Ar[0],nil,nil,0);
|
||||||
|
for i := 0 to AParams.count -1 do
|
||||||
|
FreeMem(ar[i]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
res := PQexecPrepared(tr,pchar('prepst'+nr),0,nil,nil,nil,0);
|
res := PQexecPrepared(tr,pchar('prepst'+nr),0,nil,nil,nil,0);
|
||||||
@ -539,7 +544,10 @@ begin
|
|||||||
fieldtype := TranslateFldType(PQftype(BaseRes, i));
|
fieldtype := TranslateFldType(PQftype(BaseRes, i));
|
||||||
|
|
||||||
if (fieldtype = ftstring) and (size = -1) then
|
if (fieldtype = ftstring) and (size = -1) then
|
||||||
|
begin
|
||||||
size := pqfmod(baseres,i)-3;
|
size := pqfmod(baseres,i)-3;
|
||||||
|
if size = -4 then size := dsMaxStringSize;
|
||||||
|
end;
|
||||||
if fieldtype = ftdate then
|
if fieldtype = ftdate then
|
||||||
size := sizeof(double);
|
size := sizeof(double);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user