mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 21:19:31 +02:00
Some compatibility additions
This commit is contained in:
parent
9238319c2f
commit
44d7109be3
@ -1229,9 +1229,33 @@ end;
|
||||
|
||||
Procedure TDataset.GetFieldList(List: TList; const FieldNames: string);
|
||||
|
||||
Function NextName(Var S : String) : String;
|
||||
|
||||
Var
|
||||
P : integer;
|
||||
|
||||
begin
|
||||
P:=Pos(';',S);
|
||||
If (P=0) then
|
||||
P:=Length(S)+1;
|
||||
Result:=Copy(S,1,P-1);
|
||||
system.Delete(S,1,P);
|
||||
end;
|
||||
|
||||
var
|
||||
F: TField;
|
||||
Names,N : String;
|
||||
|
||||
begin
|
||||
|
||||
Names:=FieldNames;
|
||||
N:=Nextname(Names);
|
||||
while (N<>'') do
|
||||
begin
|
||||
F:=FieldByName(N);
|
||||
If Assigned(List) then
|
||||
List.Add(F);
|
||||
N:=NextName(Names);
|
||||
end;
|
||||
end;
|
||||
|
||||
Procedure TDataset.GetFieldNames(List: TStrings);
|
||||
@ -1695,7 +1719,10 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.11 2004-01-05 21:21:38 michael
|
||||
Revision 1.12 2004-03-25 20:43:39 michael
|
||||
Some compatibility additions
|
||||
|
||||
Revision 1.11 2004/01/05 21:21:38 michael
|
||||
+ Fix in setbuflistsize for when Value=-1
|
||||
|
||||
Revision 1.10 2003/11/09 21:23:10 michael
|
||||
|
27
fcl/db/db.pp
27
fcl/db/db.pp
@ -96,6 +96,9 @@ type
|
||||
ftDateTime: (DateTime: TDateTimeAlias);
|
||||
end;
|
||||
|
||||
TFieldAttribute = (faHiddenCol, faReadonly, faRequired, faLink, faUnNamed, faFixed);
|
||||
TFieldAttributes = set of TFieldAttribute;
|
||||
|
||||
TFieldDef = class(TComponent)
|
||||
Private
|
||||
FDataType : TFieldType;
|
||||
@ -105,19 +108,22 @@ type
|
||||
FRequired : Boolean;
|
||||
FSize : Word;
|
||||
FName : String;
|
||||
FAttributes : TFieldAttributes;
|
||||
Function GetFieldClass : TFieldClass;
|
||||
public
|
||||
constructor Create(AOwner: TFieldDefs; const AName: string;
|
||||
ADataType: TFieldType; ASize: Word; ARequired: Boolean; AFieldNo: Longint);
|
||||
destructor Destroy; override;
|
||||
function CreateField(AOwner: TComponent): TField;
|
||||
property InternalCalcField: Boolean read FInternalCalcField write FInternalCalcField;
|
||||
property DataType: TFieldType read FDataType;
|
||||
property FieldClass: TFieldClass read GetFieldClass;
|
||||
property FieldNo: Longint read FFieldNo;
|
||||
property Name: string read FName;
|
||||
property Precision: Longint read FPrecision write FPrecision;
|
||||
property InternalCalcField: Boolean read FInternalCalcField write FInternalCalcField;
|
||||
property Required: Boolean read FRequired;
|
||||
Published
|
||||
property Attributes: TFieldAttributes read FAttributes write FAttributes default [];
|
||||
property Name: string read FName write FName; // Must move to TNamedItem
|
||||
property DataType: TFieldType read FDataType;
|
||||
property Precision: Longint read FPrecision write FPrecision;
|
||||
property Size: Word read FSize;
|
||||
end;
|
||||
|
||||
@ -128,19 +134,23 @@ type
|
||||
FDataSet: TDataSet;
|
||||
FItems: TList;
|
||||
FUpdated: Boolean;
|
||||
FHiddenFields : Boolean;
|
||||
function GetCount: Longint;
|
||||
function GetItem(Index: Longint): TFieldDef;
|
||||
public
|
||||
constructor Create(ADataSet: TDataSet);
|
||||
destructor Destroy; override;
|
||||
procedure Add(const AName: string; ADataType: TFieldType; ASize: Word;
|
||||
ARequired: Boolean);
|
||||
procedure Add(const AName: string; ADataType: TFieldType; ASize: Word; ARequired: Boolean);
|
||||
procedure Add(const AName: string; ADataType: TFieldType; ASize: Word);
|
||||
procedure Add(const AName: string; ADataType: TFieldType);
|
||||
Function AddFieldDef : TFieldDef;
|
||||
procedure Assign(FieldDefs: TFieldDefs);
|
||||
procedure Clear;
|
||||
function Find(const AName: string): TFieldDef;
|
||||
function IndexOf(const AName: string): Longint;
|
||||
procedure Update;
|
||||
property Count: Longint read GetCount;
|
||||
Property HiddenFields : Boolean Read FHiddenFields Write FHiddenFields;
|
||||
property Items[Index: Longint]: TFieldDef read GetItem; default;
|
||||
end;
|
||||
|
||||
@ -1477,7 +1487,10 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.14 2004-03-19 23:19:51 michael
|
||||
Revision 1.15 2004-03-25 20:43:39 michael
|
||||
Some compatibility additions
|
||||
|
||||
Revision 1.14 2004/03/19 23:19:51 michael
|
||||
+ Corrected the Fields property.
|
||||
|
||||
Revision 1.13 2004/02/25 16:29:26 michael
|
||||
|
@ -121,6 +121,18 @@ begin
|
||||
Inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TFieldDefs.Add(const AName: string; ADataType: TFieldType);
|
||||
|
||||
begin
|
||||
Add(AName,ADatatype,0,False);
|
||||
end;
|
||||
|
||||
procedure TFieldDefs.Add(const AName: string; ADataType: TFieldType; ASize : Word);
|
||||
|
||||
begin
|
||||
Add(AName,ADatatype,ASize,False);
|
||||
end;
|
||||
|
||||
procedure TFieldDefs.Add(const AName: string; ADataType: TFieldType; ASize: Word;
|
||||
ARequired: Boolean);
|
||||
|
||||
@ -204,6 +216,12 @@ begin
|
||||
FDataSet.UpdateFieldDefs;
|
||||
end;
|
||||
|
||||
Function TFieldDefs.AddFieldDef : TFieldDef;
|
||||
|
||||
begin
|
||||
Result:=TFieldDef.Create(Self,'',ftUnknown,0,False,FItems.Count+1);
|
||||
end;
|
||||
|
||||
{ ---------------------------------------------------------------------
|
||||
TField
|
||||
---------------------------------------------------------------------}
|
||||
@ -1788,7 +1806,10 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 2004-02-25 16:29:26 michael
|
||||
Revision 1.10 2004-03-25 20:43:39 michael
|
||||
Some compatibility additions
|
||||
|
||||
Revision 1.9 2004/02/25 16:29:26 michael
|
||||
+ Added AsInteger to TField. Maps to AsLongint for now
|
||||
|
||||
Revision 1.8 2003/09/14 13:22:14 michael
|
||||
|
Loading…
Reference in New Issue
Block a user