Browse Source

* added const to SetIndex declaration
* implemented TField.GetClassDesc
* TBlobField.AsString now returns an empty string if the field is null, and displaytext returns (blob)

git-svn-id: trunk@6280 -

joost 18 years ago
parent
commit
03c9f47f2d
2 changed files with 16 additions and 5 deletions
  1. 2 1
      fcl/db/db.pp
  2. 14 4
      fcl/db/fields.inc

+ 2 - 1
fcl/db/db.pp

@@ -274,7 +274,7 @@ type
     FProviderFlags : TProviderFlags;
     Function GetIndex : longint;
     procedure SetAlignment(const AValue: TAlignMent);
-    procedure SetIndex(AValue: Integer);
+    procedure SetIndex(const AValue: Integer);
     Procedure SetDataset(AValue : TDataset);
     function GetDisplayText: String;
     function GetEditText: String;
@@ -305,6 +305,7 @@ type
     function GetOldValue: variant; virtual;
     function GetAsString: string; virtual;
     function GetCanModify: Boolean; virtual;
+    function GetClassDesc: String; virtual;
     function GetDataSize: Word; virtual;
     function GetDefaultWidth: Longint; virtual;
     function GetDisplayName : String;

+ 14 - 4
fcl/db/fields.inc

@@ -474,7 +474,7 @@ end;
 function TField.GetAsString: string;
 
 begin
-  Raise AccessError(SString);
+  Result := GetClassDesc;
 end;
 
 function TField.GetOldValue: Variant;
@@ -545,6 +545,16 @@ begin
     end;
 end;
 
+function TField.GetClassDesc: String;
+var ClassN : string;
+begin
+  ClassN := copy(ClassName,2,pos('Field',ClassName)-2);
+  if isNull then
+    result := '(' + LowerCase(ClassN) + ')'
+   else
+    result := '(' + UpperCase(ClassN) + ')';
+end;
+
 function TField.GetData(Buffer: Pointer): Boolean;
 
 begin
@@ -637,7 +647,7 @@ begin
     end;
 end;
 
-procedure TField.SetIndex(AValue: Integer);
+procedure TField.SetIndex(const AValue: Integer);
 begin
   if FFields <> nil then FFields.SetFieldIndex(Self, AValue)
 end;
@@ -2228,7 +2238,7 @@ begin
         Free
       end
   else
-    Result := '(blob)';
+    Result := '';
 end;
 
 function TBlobField.GetAsVariant: Variant;
@@ -2280,7 +2290,7 @@ end;
 procedure TBlobField.GetText(var TheText: string; ADisplayText: Boolean);
 
 begin
-  TheText:=GetAsString;
+  TheText:=inherited GetAsString;
 end;