Browse Source

* Use TField.Assignvalue to set the fieldvalues in DoInsertAppend

git-svn-id: trunk@12262 -
joost 16 years ago
parent
commit
b0cf2a2dc6

+ 1 - 15
packages/fcl-db/src/base/dataset.inc

@@ -880,21 +880,7 @@ begin
     Insert;
     Insert;
 
 
   for i := 0 to ValuesSize-1 do with values[i] do
   for i := 0 to ValuesSize-1 do with values[i] do
-    case VType of
-      vtInteger   : fields[i].AsInteger    := VInteger;
-      vtBoolean   : fields[i].AsBoolean    := VBoolean;
-      vtChar      : fields[i].AsString     := VChar;
-      vtWideChar  : fields[i].AsString     := VWideChar;
-      vtString    : fields[i].AsString     := AnsiString(VString);
-      vtAnsiString: fields[i].AsString     := AnsiString(VAnsiString);
-      vtCurrency  : fields[i].AsCurrency   := VCurrency^;
-//      vtWideString: fields[i].AsWideString := VWideString;
-      vtInt64     : fields[i].AsLargeInt   := VInt64^;
-      vtQWord     : fields[i].AsLargeInt   := VQWord^;
-      vtVariant   : fields[i].AsVariant    := VVariant^;
-    else
-      DatabaseError(SIncompatibleTVarRec);
-    end; {case}
+    fields[i].AssignValue(values[i]);
   Post;
   Post;
 
 
 end;
 end;

+ 0 - 1
packages/fcl-db/src/base/dbconst.pas

@@ -44,7 +44,6 @@ Resourcestring
   STransNotActive          = 'Operation cannot be performed on an inactive transaction';
   STransNotActive          = 'Operation cannot be performed on an inactive transaction';
   STransActive             = 'Operation cannot be performed on an active transaction';
   STransActive             = 'Operation cannot be performed on an active transaction';
   SFieldNotFound           = 'Field not found : "%s"';
   SFieldNotFound           = 'Field not found : "%s"';
-  SIncompatibleTVarRec     = 'Faild to assign one of the TVarRec values into a TField';
   SInactiveDataset         = 'Operation cannot be performed on an inactive dataset';
   SInactiveDataset         = 'Operation cannot be performed on an inactive dataset';
   SInvalidDisplayValues    = '"%s" are not valid boolean displayvalues';
   SInvalidDisplayValues    = '"%s" are not valid boolean displayvalues';
   SInvalidFieldKind        = '%s : invalid field kind : ';
   SInvalidFieldKind        = '%s : invalid field kind : ';

+ 1 - 1
packages/fcl-db/src/base/fields.inc

@@ -369,7 +369,7 @@ begin
       vtWideString:
       vtWideString:
         AsWideString := WideString(VWideString);
         AsWideString := WideString(VWideString);
       vtInt64:
       vtInt64:
-        Self.Value := VInt64^;
+        AsLargeInt := VInt64^;
     else
     else
       Error;
       Error;
     end;
     end;