Browse Source

* Merging revisions 42349 from trunk:
------------------------------------------------------------------------
r42349 | michael | 2019-07-11 22:16:35 +0200 (Thu, 11 Jul 2019) | 1 line

* Always try to show the field name when possible
------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@42852 -

michael 6 years ago
parent
commit
85bf1fdb9e
1 changed files with 8 additions and 7 deletions
  1. 8 7
      packages/fcl-db/src/base/fields.inc

+ 8 - 7
packages/fcl-db/src/base/fields.inc

@@ -877,7 +877,8 @@ begin
     try
       SetVarValue(AValue);
     except
-      on EVariantError do DatabaseErrorFmt(SFieldValueError, [DisplayName]);
+      on EVariantError do
+        DatabaseErrorFmt(SFieldError+SInvalidVariant, [DisplayName]);
     end;
 end;
 
@@ -933,7 +934,7 @@ procedure TField.SetData(Buffer: Pointer; NativeFormat : Boolean);
 
 begin
   If Not Assigned(FDataset) then
-    DatabaseErrorFmt(SNoDataset,[FieldName]);
+    DatabaseErrorFmt(SNoDataset,[DisplayName]);
   FDataSet.SetFieldData(Self,Buffer, NativeFormat);
 end;
 
@@ -1516,7 +1517,7 @@ end;
 procedure TNumericField.RangeError(AValue, Min, Max: Double);
 
 begin
-  DatabaseErrorFmt(SRangeError,[AValue,Min,Max,FieldName]);
+  DatabaseErrorFmt(SFieldError+SRangeError2,[DisplayName,AValue,Min,Max]);
 end;
 
 procedure TNumericField.SetDisplayFormat(const AValue: string);
@@ -1688,7 +1689,7 @@ begin
     If Code=0 then
       SetAsInteger(L)
     else
-      DatabaseErrorFmt(SNotAnInteger,[AValue]);
+      DatabaseErrorFmt(SFieldError+SNotAnInteger,[DisplayName,AValue]);
     end;
 end;
 
@@ -1843,7 +1844,7 @@ begin
     If Code=0 then
       SetAsLargeInt(L)
     else
-      DatabaseErrorFmt(SNotAnInteger,[AValue]);
+      DatabaseErrorFmt(SFieldError+SNotAnInteger,[DisplayName,AValue]);
     end;
 end;
 
@@ -2220,7 +2221,7 @@ begin
     begin
     I:=Pos(';',AValue);
     If (I<2) or (I=Length(AValue)) then
-      DatabaseErrorFmt(SInvalidDisplayValues,[AValue]);
+      DatabaseErrorFmt(SFieldError+SInvalidDisplayValues,[DisplayName,AValue]);
     FdisplayValues:=AValue;
     // Store display values and their uppercase equivalents;
     FDisplays[False,True]:=Copy(AValue,1,I-1);
@@ -3497,7 +3498,7 @@ procedure TFields.CheckfieldKind(Fieldkind: TFieldKind; Field: TField);
 
 begin
   If Not (FieldKind in ValidFieldKinds) Then
-    DatabaseErrorFmt(SInvalidFieldKind,[Field.FieldName]);
+    DatabaseErrorFmt(SInvalidFieldKind,[Field.DisplayName]);
 end;
 
 function TFields.GetCount: Longint;