Browse Source

+ Support for float-parameters

git-svn-id: trunk@3950 -
joost 19 years ago
parent
commit
45507a5a7b
1 changed files with 29 additions and 0 deletions
  1. 29 0
      fcl/db/sqldb/interbase/ibconnection.pp

+ 29 - 0
fcl/db/sqldb/interbase/ibconnection.pp

@@ -51,6 +51,7 @@ type
     procedure GetDateTime(CurrBuff, Buffer : pointer; AType : integer);
     procedure SetDateTime(CurrBuff: pointer; PTime : TDateTime; AType : integer);
     procedure GetFloat(CurrBuff, Buffer : pointer; Field : TFieldDef);
+    procedure SetFloat(CurrBuff: pointer; Dbl: Double; Size: integer);
     procedure CheckError(ProcName : string; Status : array of ISC_STATUS);
     function getMaxBlobSize(blobHandle : TIsc_Blob_Handle) : longInt;
     procedure SetParameters(cursor : TSQLCursor;AParams : TParams);
@@ -655,6 +656,10 @@ begin
           Move(li, in_sqlda^.SQLvar[SQLVarNr].SQLData^, in_SQLDA^.SQLVar[SQLVarNr].SQLLen);
           {$R+}
           end;
+        ftFloat:
+          {$R-}
+          SetFloat(in_sqlda^.SQLvar[SQLVarNr].SQLData, AParams[ParNr].AsFloat, in_SQLDA^.SQLVar[SQLVarNr].SQLLen);
+          {$R+}
       else
         DatabaseErrorFmt(SUnsupportedParameter,[Fieldtypenames[AParams[ParNr].DataType]],self);
       end {case}
@@ -912,6 +917,30 @@ begin
   qry.free;
 end;
 
+procedure TIBConnection.SetFloat(CurrBuff: pointer; Dbl: Double; Size: integer);
+
+var
+  Ext : extended;
+  Sin : single;
+begin
+  case Size of
+    4 :
+      begin
+        Sin := Dbl;
+        Move(Sin, CurrBuff^, 4);
+      end;
+    8 :
+      begin
+        Move(Dbl, CurrBuff^, 8);
+      end;
+    10:
+      begin
+        Ext := Dbl;
+        Move(Ext, CurrBuff^, 10);
+      end;
+  end;
+end;
+
 procedure TIBConnection.GetFloat(CurrBuff, Buffer : pointer; Field : TFieldDef);
 var
   Ext : extended;