Browse Source

* Patch from Joao Morais to fix the storage of floating point, time and timestamp fields on a PgSQL database

git-svn-id: trunk@11128 -
joost 17 years ago
parent
commit
a33023e384
1 changed files with 10 additions and 4 deletions
  1. 10 4
      packages/fcl-db/src/sqldb/postgres/pqconnection.pp

+ 10 - 4
packages/fcl-db/src/sqldb/postgres/pqconnection.pp

@@ -568,10 +568,16 @@ begin
         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
-            ftdatetime : s := formatdatetime('YYYY-MM-DD',AParams[i].AsDateTime);
-            ftdate     : s := formatdatetime('YYYY-MM-DD',AParams[i].AsDateTime);
-          else
-            s := AParams[i].asstring;
+            ftDateTime:
+              s := FormatDateTime('yyyy-mm-dd hh:nn:ss', AParams[i].AsDateTime);
+            ftDate:
+              s := FormatDateTime('yyyy-mm-dd', AParams[i].AsDateTime);
+            ftTime:
+              s := FormatDateTime('hh:nn:ss', AParams[i].AsDateTime);
+            ftFloat, ftCurrency:
+              Str(AParams[i].AsFloat, s);
+            else
+              s := AParams[i].AsString;
           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);