TDADatasetCollection
Overview
The TDADatasetCollection class, which is descended from the TDASQLCommandCollection collection, represents a collection of specified datasets (or data tables) that is defined in the schema.
You will not usually create instances of this class directly, but define a dataset collection in Schema Modeler or access a collection via the Datasets property of the TDASchema component.
Location
- Unit: uDASchemaClasses.pas
- Ancestry: TOwnedCollection | TSearcheableCollection | TDASQLCommandCollection | TDADatasetCollection
constructor Create (TComponent) (declared in TDASQLCommandCollection)
Creates a new instance.
constructor Create(aOwner: TComponent)
Parameters:
- aOwner: Owner
constructor Create (TPersistent, TCollectionItemClass) (declared in TSearcheableCollection)
Initializes the collection with the supplied parameters.
constructor Create(AOwner: TPersistent; ItemClass: TCollectionItemClass)
Parameters:
- AOwner: owner
- ItemClass: item class
Add reintroduce
Adds a new dataset to the current current dataset collection and returns the new dataset.
function Add: TDADataset
Add reintroduce (declared in TDASQLCommandCollection)
Adds a new item to the collection.
function Add: TDASQLCommand
CloneItem (declared in TSearcheableCollection)
Inserts a copy of an item and names it "Copy nn of " of the cloned item name.
function CloneItem(iIndex: Integer): Integer
Parameters:
- iIndex: position.
DatasetByName
Gets the dataset with the specified name from the current dataset collection. If aName is empty, the method gets the default dataset in the current collection.
If the specified dataset is not founded, an exception is raised.
function DatasetByName(const aName: string): TDADataset
Parameters:
- aName: Specified dataset name
Datasets
Represents one item in the current dataset collection.
property Datasets[Index: Integer]: TDADataset read write
FindDatasetByName
Finds and returns the dataset with the specified name from the current dataset collection.
function FindDatasetByName(const aName: string): TDADataset
Parameters:
- aName: Specified dataset name
FindItem virtual (declared in TSearcheableCollection)
Finds the first occurrence of the item with the supplied name. Search is case-insensitive.
function FindItem(const aName: string): TCollectionItem
Parameters:
- aName: the supplied name
FindUniqueName (declared in TSearcheableCollection)
Returns the supplied name if the item with that name is absent in the collection or adds a number to it and sequentially increments it until the result is unique.
function FindUniqueName(const iBaseName: string): string
Parameters:
- iBaseName: the supplied name
FindUniqueNameEx (declared in TSearcheableCollection)
Does the same as FindUniqueName, but uses a template with a numeric parameter as second argument, it should be compatible with the Delphi Format function.
function FindUniqueNameEx(const iBaseName: string; const iNumberedName: string): string
Parameters:
- iBaseName: the supplied name
- iNumberedName: numeric parameter
GetDefaultItem (declared in TSearcheableCollection)
Looks for the first occurrence of the item that has a boolean property with the name "Default" and the value true. Raises an exception if no such item can be found.
function GetDefaultItem: TCollectionItem
GetItemClass protected override
Returns the TDADataset class.
function GetItemClass: TDASQLCommandClass
GetItemDefault protected dynamic (declared in TSearcheableCollection)
Returns default item's name
function GetItemDefault(anItem: TCollectionItem): Boolean
Parameters:
- anItem: given item
GetItemName protected override (declared in TDASQLCommandCollection)
Gets the name of the specified item.
function GetItemName(anItem: TCollectionItem): string
Parameters:
- anItem: the specified item.
ItemByName (declared in TSearcheableCollection)
Returns an item with the specified name.
function ItemByName(const aName: string): TCollectionItem
Parameters:
- aName: fClientFields
ItemName protected virtual (declared in TSearcheableCollection)
Returns the string "item".
function ItemName: string
MoveItem (declared in TSearcheableCollection)
Moves the item from one position to another. Checks boundaries.
procedure MoveItem(iFromIndex: Integer; iToIndex: Integer)
Parameters:
- iFromIndex: old index
- iToIndex: new index
Notify protected override (declared in TSearcheableCollection)
Notifies about the adding or removal of an item if the event handler is assigned. If an item with an empty name is added and items without name are not allowed, it sets the name to "Item" plus number.
procedure Notify(Item: TCollectionItem; Action: TCollectionNotification)
Parameters:
- Item: given item
- Action: action
OnItemRemoved (declared in TSearcheableCollection)
Event handler for removing an item.
property OnItemRemoved: TDAItemRemovedEvent read write
delegate: procedure OnItemRemoved(aSender: TObject; const aName: string)
OnItemRenamed (declared in TSearcheableCollection)
Event handler for renaming an item.
property OnItemRenamed: TDAItemRenamedEvent read write
delegate: procedure OnItemRenamed(aSender: TObject; const aOldName: string; const aNewName: string)
SetItemName protected override (declared in TDASQLCommandCollection)
Sets a new name for the specified item.
function SetItemName(anItem: TCollectionItem; const aName: string): string
Parameters:
- anItem: item
- aName: name
SQLCommandByName (declared in TDASQLCommandCollection)
Returns the item with the specified name. If no matching parameter is defined, an exception will be raised.
function SQLCommandByName(const aName: string): TDASQLCommand
Parameters:
- aName: the specified name.
SQLCommands (declared in TDASQLCommandCollection)
This indexer property gives access to the individual commands contained in the collection. If no matching parameter is defined, an exception will be raised.
property SQLCommands[Index: Integer]: TDASQLCommand read write
TriggerOnItemRemoved virtual (declared in TSearcheableCollection)
Calls the event handler if it was assigned.
procedure TriggerOnItemRemoved(const iName: string)
Parameters:
- iName: item name
TriggerOnItemRenamed virtual (declared in TSearcheableCollection)
Calls the event handler if it was assigned.
procedure TriggerOnItemRenamed(const iOldName: string; const iNewName: string)
Parameters:
- iOldName: old name
- iNewName: new name
Datasets
Represents one item in the current dataset collection.
property Datasets[Index: Integer]: TDADataset read write
SQLCommands (declared in TDASQLCommandCollection)
This indexer property gives access to the individual commands contained in the collection. If no matching parameter is defined, an exception will be raised.
property SQLCommands[Index: Integer]: TDASQLCommand read write
constructor Create (TComponent) (declared in TDASQLCommandCollection)
Creates a new instance.
constructor Create(aOwner: TComponent)
Parameters:
- aOwner: Owner
constructor Create (TPersistent, TCollectionItemClass) (declared in TSearcheableCollection)
Initializes the collection with the supplied parameters.
constructor Create(AOwner: TPersistent; ItemClass: TCollectionItemClass)
Parameters:
- AOwner: owner
- ItemClass: item class
Add reintroduce
Adds a new dataset to the current current dataset collection and returns the new dataset.
function Add: TDADataset
Add reintroduce (declared in TDASQLCommandCollection)
Adds a new item to the collection.
function Add: TDASQLCommand
CloneItem (declared in TSearcheableCollection)
Inserts a copy of an item and names it "Copy nn of " of the cloned item name.
function CloneItem(iIndex: Integer): Integer
Parameters:
- iIndex: position.
DatasetByName
Gets the dataset with the specified name from the current dataset collection. If aName is empty, the method gets the default dataset in the current collection.
If the specified dataset is not founded, an exception is raised.
function DatasetByName(const aName: string): TDADataset
Parameters:
- aName: Specified dataset name
FindDatasetByName
Finds and returns the dataset with the specified name from the current dataset collection.
function FindDatasetByName(const aName: string): TDADataset
Parameters:
- aName: Specified dataset name
FindItem virtual (declared in TSearcheableCollection)
Finds the first occurrence of the item with the supplied name. Search is case-insensitive.
function FindItem(const aName: string): TCollectionItem
Parameters:
- aName: the supplied name
FindUniqueName (declared in TSearcheableCollection)
Returns the supplied name if the item with that name is absent in the collection or adds a number to it and sequentially increments it until the result is unique.
function FindUniqueName(const iBaseName: string): string
Parameters:
- iBaseName: the supplied name
FindUniqueNameEx (declared in TSearcheableCollection)
Does the same as FindUniqueName, but uses a template with a numeric parameter as second argument, it should be compatible with the Delphi Format function.
function FindUniqueNameEx(const iBaseName: string; const iNumberedName: string): string
Parameters:
- iBaseName: the supplied name
- iNumberedName: numeric parameter
GetDefaultItem (declared in TSearcheableCollection)
Looks for the first occurrence of the item that has a boolean property with the name "Default" and the value true. Raises an exception if no such item can be found.
function GetDefaultItem: TCollectionItem
GetItemClass protected override
Returns the TDADataset class.
function GetItemClass: TDASQLCommandClass
GetItemDefault protected dynamic (declared in TSearcheableCollection)
Returns default item's name
function GetItemDefault(anItem: TCollectionItem): Boolean
Parameters:
- anItem: given item
GetItemName protected override (declared in TDASQLCommandCollection)
Gets the name of the specified item.
function GetItemName(anItem: TCollectionItem): string
Parameters:
- anItem: the specified item.
ItemByName (declared in TSearcheableCollection)
Returns an item with the specified name.
function ItemByName(const aName: string): TCollectionItem
Parameters:
- aName: fClientFields
ItemName protected virtual (declared in TSearcheableCollection)
Returns the string "item".
function ItemName: string
MoveItem (declared in TSearcheableCollection)
Moves the item from one position to another. Checks boundaries.
procedure MoveItem(iFromIndex: Integer; iToIndex: Integer)
Parameters:
- iFromIndex: old index
- iToIndex: new index
Notify protected override (declared in TSearcheableCollection)
Notifies about the adding or removal of an item if the event handler is assigned. If an item with an empty name is added and items without name are not allowed, it sets the name to "Item" plus number.
procedure Notify(Item: TCollectionItem; Action: TCollectionNotification)
Parameters:
- Item: given item
- Action: action
SetItemName protected override (declared in TDASQLCommandCollection)
Sets a new name for the specified item.
function SetItemName(anItem: TCollectionItem; const aName: string): string
Parameters:
- anItem: item
- aName: name
SQLCommandByName (declared in TDASQLCommandCollection)
Returns the item with the specified name. If no matching parameter is defined, an exception will be raised.
function SQLCommandByName(const aName: string): TDASQLCommand
Parameters:
- aName: the specified name.
TriggerOnItemRemoved virtual (declared in TSearcheableCollection)
Calls the event handler if it was assigned.
procedure TriggerOnItemRemoved(const iName: string)
Parameters:
- iName: item name
TriggerOnItemRenamed virtual (declared in TSearcheableCollection)
Calls the event handler if it was assigned.
procedure TriggerOnItemRenamed(const iOldName: string; const iNewName: string)
Parameters:
- iOldName: old name
- iNewName: new name
OnItemRemoved (declared in TSearcheableCollection)
Event handler for removing an item.
property OnItemRemoved: TDAItemRemovedEvent read write
delegate: procedure OnItemRemoved(aSender: TObject; const aName: string)
OnItemRenamed (declared in TSearcheableCollection)
Event handler for renaming an item.
property OnItemRenamed: TDAItemRenamedEvent read write
delegate: procedure OnItemRenamed(aSender: TObject; const aOldName: string; const aNewName: string)