2
0
Эх сурвалжийг харах

Merged revisions 12313-12314 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r12313 | joost | 2008-12-07 23:19:07 +0100 (Sun, 07 Dec 2008) | 1 line

* Only the lowest 16 bits of pqfmod gives the scale
........
r12314 | joost | 2008-12-08 00:02:06 +0100 (Mon, 08 Dec 2008) | 1 line

* The size=-1 case it not necessary anymore after r12313
........

git-svn-id: branches/fixes_2_2@12423 -

joost 16 жил өмнө
parent
commit
65c9a7b380

+ 5 - 6
packages/fcl-db/src/sqldb/postgres/pqconnection.pp

@@ -389,7 +389,7 @@ begin
                              size := PQfsize(Res, Tuple);
                              if (size = -1) then
                                begin
-                               size := pqfmod(res,Tuple)-4;
+                               size := (PQfmod(res,Tuple)-4) and $FFFF;
                                if size = -5 then size := dsMaxStringSize;
                                end;
                              if size > dsMaxStringSize then size := dsMaxStringSize;
@@ -409,11 +409,10 @@ begin
     Oid_Bool               : Result := ftBoolean;
     Oid_Numeric            : begin
                              Result := ftBCD;
-                             size := PQfmod(res,Tuple);
-                             if size = -1 then
-                               size := 4
-                             else
-                               size := size -4;
+                             // The precision is the high 16 bits, the scale the
+                             // low 16 bits. Both with an offset of 4.
+                             // In this case we need the scale:
+                             size := (PQfmod(res,Tuple)-4) and $FFFF;
                              end;
     Oid_Money              : Result := ftCurrency;
     Oid_Unknown            : Result := ftUnknown;