mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 10:29:21 +02:00
* Added FmtBCD support to Firebird
git-svn-id: trunk@17830 -
This commit is contained in:
parent
6e1d5e0aa0
commit
23363f3158
@ -121,7 +121,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
strutils;
|
||||
strutils, FmtBCD;
|
||||
|
||||
type
|
||||
TTm = packed record
|
||||
@ -842,6 +842,8 @@ begin
|
||||
begin
|
||||
if VSQLVar^.sqlscale = 0 then
|
||||
li := AParams[ParNr].AsLargeInt
|
||||
else if AParams[ParNr].DataType = ftFMTBcd then
|
||||
li := Round(AParams[ParNr].AsFMTBCD * IntPower(10, -VSQLVar^.sqlscale))
|
||||
else
|
||||
li := Round(AParams[ParNr].AsCurrency * IntPower(10, -VSQLVar^.sqlscale));
|
||||
Move(li, VSQLVar^.SQLData^, VSQLVar^.SQLLen);
|
||||
@ -863,6 +865,7 @@ var
|
||||
VarcharLen : word;
|
||||
CurrBuff : pchar;
|
||||
c : currency;
|
||||
AFmtBcd : tBCD;
|
||||
smalli : smallint;
|
||||
longi : longint;
|
||||
largei : largeint;
|
||||
@ -920,6 +923,26 @@ begin
|
||||
end; {case}
|
||||
Move(c, buffer^ , sizeof(c));
|
||||
end;
|
||||
ftFMTBcd :
|
||||
begin
|
||||
case SQLDA^.SQLVar[x].SQLLen of
|
||||
2 : begin
|
||||
Move(CurrBuff^, smalli, 2);
|
||||
AFmtBCD:= smalli*intpower(10,SQLDA^.SQLVar[x].SQLScale);
|
||||
end;
|
||||
4 : begin
|
||||
Move(CurrBuff^, longi, 4);
|
||||
AFmtBcd := longi*intpower(10,SQLDA^.SQLVar[x].SQLScale);
|
||||
end;
|
||||
8 : begin
|
||||
Move(CurrBuff^, largei, 8);
|
||||
AFmtBcd := largei*intpower(10,SQLDA^.SQLVar[x].SQLScale);
|
||||
end;
|
||||
else
|
||||
Result := False; // Just to be sure, in principle this will never happen
|
||||
end; {case}
|
||||
Move(AFmtBcd, buffer^ , sizeof(AFmtBcd));
|
||||
end;
|
||||
ftInteger :
|
||||
begin
|
||||
FillByte(buffer^,sizeof(Longint),0);
|
||||
|
Loading…
Reference in New Issue
Block a user