mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 17:49:07 +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);
|
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
|
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;
|
end;
|
||||||
|
|
||||||
Procedure TDataset.GetFieldNames(List: TStrings);
|
Procedure TDataset.GetFieldNames(List: TStrings);
|
||||||
@ -1695,7 +1719,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
+ Fix in setbuflistsize for when Value=-1
|
||||||
|
|
||||||
Revision 1.10 2003/11/09 21:23:10 michael
|
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);
|
ftDateTime: (DateTime: TDateTimeAlias);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TFieldAttribute = (faHiddenCol, faReadonly, faRequired, faLink, faUnNamed, faFixed);
|
||||||
|
TFieldAttributes = set of TFieldAttribute;
|
||||||
|
|
||||||
TFieldDef = class(TComponent)
|
TFieldDef = class(TComponent)
|
||||||
Private
|
Private
|
||||||
FDataType : TFieldType;
|
FDataType : TFieldType;
|
||||||
@ -105,19 +108,22 @@ type
|
|||||||
FRequired : Boolean;
|
FRequired : Boolean;
|
||||||
FSize : Word;
|
FSize : Word;
|
||||||
FName : String;
|
FName : String;
|
||||||
|
FAttributes : TFieldAttributes;
|
||||||
Function GetFieldClass : TFieldClass;
|
Function GetFieldClass : TFieldClass;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TFieldDefs; const AName: string;
|
constructor Create(AOwner: TFieldDefs; const AName: string;
|
||||||
ADataType: TFieldType; ASize: Word; ARequired: Boolean; AFieldNo: Longint);
|
ADataType: TFieldType; ASize: Word; ARequired: Boolean; AFieldNo: Longint);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function CreateField(AOwner: TComponent): TField;
|
function CreateField(AOwner: TComponent): TField;
|
||||||
property InternalCalcField: Boolean read FInternalCalcField write FInternalCalcField;
|
|
||||||
property DataType: TFieldType read FDataType;
|
|
||||||
property FieldClass: TFieldClass read GetFieldClass;
|
property FieldClass: TFieldClass read GetFieldClass;
|
||||||
property FieldNo: Longint read FFieldNo;
|
property FieldNo: Longint read FFieldNo;
|
||||||
property Name: string read FName;
|
property InternalCalcField: Boolean read FInternalCalcField write FInternalCalcField;
|
||||||
property Precision: Longint read FPrecision write FPrecision;
|
|
||||||
property Required: Boolean read FRequired;
|
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;
|
property Size: Word read FSize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -128,19 +134,23 @@ type
|
|||||||
FDataSet: TDataSet;
|
FDataSet: TDataSet;
|
||||||
FItems: TList;
|
FItems: TList;
|
||||||
FUpdated: Boolean;
|
FUpdated: Boolean;
|
||||||
|
FHiddenFields : Boolean;
|
||||||
function GetCount: Longint;
|
function GetCount: Longint;
|
||||||
function GetItem(Index: Longint): TFieldDef;
|
function GetItem(Index: Longint): TFieldDef;
|
||||||
public
|
public
|
||||||
constructor Create(ADataSet: TDataSet);
|
constructor Create(ADataSet: TDataSet);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Add(const AName: string; ADataType: TFieldType; ASize: Word;
|
procedure Add(const AName: string; ADataType: TFieldType; ASize: Word; ARequired: Boolean);
|
||||||
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 Assign(FieldDefs: TFieldDefs);
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
function Find(const AName: string): TFieldDef;
|
function Find(const AName: string): TFieldDef;
|
||||||
function IndexOf(const AName: string): Longint;
|
function IndexOf(const AName: string): Longint;
|
||||||
procedure Update;
|
procedure Update;
|
||||||
property Count: Longint read GetCount;
|
property Count: Longint read GetCount;
|
||||||
|
Property HiddenFields : Boolean Read FHiddenFields Write FHiddenFields;
|
||||||
property Items[Index: Longint]: TFieldDef read GetItem; default;
|
property Items[Index: Longint]: TFieldDef read GetItem; default;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1477,7 +1487,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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.
|
+ Corrected the Fields property.
|
||||||
|
|
||||||
Revision 1.13 2004/02/25 16:29:26 michael
|
Revision 1.13 2004/02/25 16:29:26 michael
|
||||||
|
@ -121,6 +121,18 @@ begin
|
|||||||
Inherited Destroy;
|
Inherited Destroy;
|
||||||
end;
|
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;
|
procedure TFieldDefs.Add(const AName: string; ADataType: TFieldType; ASize: Word;
|
||||||
ARequired: Boolean);
|
ARequired: Boolean);
|
||||||
|
|
||||||
@ -204,6 +216,12 @@ begin
|
|||||||
FDataSet.UpdateFieldDefs;
|
FDataSet.UpdateFieldDefs;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Function TFieldDefs.AddFieldDef : TFieldDef;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=TFieldDef.Create(Self,'',ftUnknown,0,False,FItems.Count+1);
|
||||||
|
end;
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
TField
|
TField
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
@ -1788,7 +1806,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
+ Added AsInteger to TField. Maps to AsLongint for now
|
||||||
|
|
||||||
Revision 1.8 2003/09/14 13:22:14 michael
|
Revision 1.8 2003/09/14 13:22:14 michael
|
||||||
|
Loading…
Reference in New Issue
Block a user