mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 20:29:18 +02:00
* Truncate strings longer then dsMaxStringSize
* Cleaned up some unnecessary calls git-svn-id: trunk@8977 -
This commit is contained in:
parent
340acdea57
commit
95325732a8
@ -389,7 +389,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
size := pqfmod(res,Tuple)-4;
|
size := pqfmod(res,Tuple)-4;
|
||||||
if size = -5 then size := dsMaxStringSize;
|
if size = -5 then size := dsMaxStringSize;
|
||||||
end
|
end;
|
||||||
|
if size > dsMaxStringSize then size := dsMaxStringSize;
|
||||||
end;
|
end;
|
||||||
// Oid_text : Result := ftstring;
|
// Oid_text : Result := ftstring;
|
||||||
Oid_text : Result := ftBlob;
|
Oid_text : Result := ftBlob;
|
||||||
@ -683,7 +684,6 @@ begin
|
|||||||
result := false
|
result := false
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
i := PQfsize(res, x);
|
|
||||||
CurrBuff := pqgetvalue(res,CurTuple,x);
|
CurrBuff := pqgetvalue(res,CurTuple,x);
|
||||||
|
|
||||||
result := true;
|
result := true;
|
||||||
@ -691,6 +691,7 @@ begin
|
|||||||
case FieldDef.DataType of
|
case FieldDef.DataType of
|
||||||
ftInteger, ftSmallint, ftLargeInt,ftfloat :
|
ftInteger, ftSmallint, ftLargeInt,ftfloat :
|
||||||
begin
|
begin
|
||||||
|
i := PQfsize(res, x);
|
||||||
case i of // postgres returns big-endian numbers
|
case i of // postgres returns big-endian numbers
|
||||||
sizeof(int64) : pint64(buffer)^ := BEtoN(pint64(CurrBuff)^);
|
sizeof(int64) : pint64(buffer)^ := BEtoN(pint64(CurrBuff)^);
|
||||||
sizeof(integer) : pinteger(buffer)^ := BEtoN(pinteger(CurrBuff)^);
|
sizeof(integer) : pinteger(buffer)^ := BEtoN(pinteger(CurrBuff)^);
|
||||||
@ -703,16 +704,15 @@ begin
|
|||||||
ftString :
|
ftString :
|
||||||
begin
|
begin
|
||||||
li := pqgetlength(res,curtuple,x);
|
li := pqgetlength(res,curtuple,x);
|
||||||
|
if li > dsMaxStringSize then li := dsMaxStringSize;
|
||||||
Move(CurrBuff^, Buffer^, li);
|
Move(CurrBuff^, Buffer^, li);
|
||||||
pchar(Buffer + li)^ := #0;
|
pchar(Buffer + li)^ := #0;
|
||||||
i := pqfmod(res,x)-3;
|
|
||||||
end;
|
end;
|
||||||
ftBlob : Createblob := True;
|
ftBlob : Createblob := True;
|
||||||
ftdate :
|
ftdate :
|
||||||
begin
|
begin
|
||||||
dbl := pointer(buffer);
|
dbl := pointer(buffer);
|
||||||
dbl^ := BEtoN(plongint(CurrBuff)^) + 36526;
|
dbl^ := BEtoN(plongint(CurrBuff)^) + 36526;
|
||||||
i := sizeof(double);
|
|
||||||
end;
|
end;
|
||||||
ftDateTime, fttime :
|
ftDateTime, fttime :
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user