Browse Source

* More delphi compilability changes

git-svn-id: trunk@6615 -
michael 18 years ago
parent
commit
b5d1cadd09
3 changed files with 34 additions and 2 deletions
  1. 6 2
      fcl/db/db.pp
  2. 16 0
      fcl/db/dsparams.inc
  3. 12 0
      fcl/db/fields.inc

+ 6 - 2
fcl/db/db.pp

@@ -1848,8 +1848,12 @@ uses dbconst,typinfo, fmtbcd;
 { ---------------------------------------------------------------------
     Auxiliary functions
   ---------------------------------------------------------------------}
-
-
+{$ifndef fpc}
+Function VarIsClear(const V: Variant): Boolean;
+begin
+  Result:=VarIsEmpty(V);
+end;
+{$endif}
 
 Procedure DatabaseError (Const Msg : String);
 

+ 16 - 0
fcl/db/dsparams.inc

@@ -513,7 +513,11 @@ begin
   If IsNull then
     Result:=0
   else
+{$ifdef fpc}
     Result:=FValue;
+{$else}
+    Result:=Integer(FValue);
+{$endif}    
 end;
 
 
@@ -609,7 +613,11 @@ end;
 
 Procedure TParam.SetAsLargeInt(AValue: LargeInt);
 begin
+{$ifdef fpc}
   FValue:=AValue;
+{$else}
+  FValue:=integer(AValue);
+{$endif}  
   FDataType:=ftLargeint;
 end;
 
@@ -646,19 +654,27 @@ begin
     case VarType(Value) of
       varBoolean  : FDataType:=ftBoolean;
       varSmallint,
+{$ifdef fpc}
       varShortInt,
+{$endif}
       varByte     : FDataType:=ftSmallInt;
+{$ifdef fpc}
       varWord,
+{$endif}      
       varInteger  : FDataType:=ftInteger;
       varCurrency : FDataType:=ftCurrency;
+{$ifdef fpc}
       varLongWord,
+{$endif}
       varSingle,
       varDouble   : FDataType:=ftFloat;
       varDate     : FDataType:=ftDateTime;
       varString,
       varOleStr   : if (FDataType<>ftFixedChar) then
                       FDataType:=ftString;
+{$ifdef fpc}
       varInt64    : FDataType:=ftLargeInt;
+{$endif}      
     else
       FDataType:=ftUnknown;
     end;

+ 12 - 0
fcl/db/fields.inc

@@ -336,7 +336,11 @@ begin
       vtWideString:
         AsString := WideString(VWideString);
       vtInt64:
+{$ifdef fpc}
         Self.Value := VInt64^;
+{$else}
+        Self.Value := Integer(VInt64^);// Definitely wrong result !! MVC.
+{$endif}        
     else
       Error;
     end;
@@ -1309,7 +1313,11 @@ Var L : Largeint;
 
 begin
   If GetValue(L) then
+{$ifdef fpc}
     Result:=L
+{$else}
+    Result:=Integer(L); // Wrong result MVC.
+{$endif}    
   else
     Result:=Null;
 end;
@@ -1408,7 +1416,11 @@ end;
 
 procedure TLargeintField.SetVarValue(const AValue: Variant);
 begin
+{$ifdef fpc}
   SetAsLargeint(AValue);
+{$else}
+  SetAsLargeint(Integer(AValue));
+{$endif}
 end;
 
 Function TLargeintField.CheckRange(AValue : largeint) : Boolean;