From 03c9f47f2d60e05fb9859f2f5659cf2e29149cb1 Mon Sep 17 00:00:00 2001 From: joost Date: Wed, 31 Jan 2007 23:04:59 +0000 Subject: [PATCH] * 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 - --- fcl/db/db.pp | 3 ++- fcl/db/fields.inc | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/fcl/db/db.pp b/fcl/db/db.pp index 353f19418e..8c375f3c4f 100644 --- a/fcl/db/db.pp +++ b/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; diff --git a/fcl/db/fields.inc b/fcl/db/fields.inc index f501462fd2..26aff4f330 100644 --- a/fcl/db/fields.inc +++ b/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;