[fpc-pascal] another pqconnection patch

Joao Morais post at joaomorais.com.br
Thu May 29 16:50:08 CEST 2008


Joao Morais wrote:
> There are other problems, at least with timestamp field. Please wait =

> another patch soon.

The following patch fixes the storage of floating point, time and =

timestamp fields on a pgsql database.

Patch is against trunk.

Joao Morais
-------------- next part --------------
Index: packages/fcl-db/src/sqldb/postgres/pqconnection.pp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- packages/fcl-db/src/sqldb/postgres/pqconnection.pp	(revision 11126)
+++ packages/fcl-db/src/sqldb/postgres/pqconnection.pp	(working copy)
@@ -568,10 +568,16 @@
         for i :=3D 0 to AParams.count -1 do if not AParams[i].IsNull then
           begin
           case AParams[i].DataType of
-            ftdatetime : s :=3D formatdatetime('YYYY-MM-DD',AParams[i].AsD=
ateTime);
-            ftdate     : s :=3D formatdatetime('YYYY-MM-DD',AParams[i].AsD=
ateTime);
-          else
-            s :=3D AParams[i].asstring;
+            ftDateTime:
+              s :=3D FormatDateTime('yyyy-mm-dd hh:nn:ss', AParams[i].AsDa=
teTime);
+            ftDate:
+              s :=3D FormatDateTime('yyyy-mm-dd', AParams[i].AsDateTime);
+            ftTime:
+              s :=3D FormatDateTime('hh:nn:ss', AParams[i].AsDateTime);
+            ftFloat, ftCurrency:
+              Str(AParams[i].AsFloat, s);
+            else
+              s :=3D AParams[i].AsString;
           end; {case}
           GetMem(ar[i],length(s)+1);
           StrMove(PChar(ar[i]),Pchar(s),Length(S)+1);


More information about the fpc-pascal mailing list