You've already forked lazarus-ccr
TvPlanIt: Deletion of a resource deletes also the associated events, contacts and tasks. Tested with all database datastores. Update datastore sample projects.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8947 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -8,7 +8,7 @@ interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, DB, IBConnection, sqldb,
|
||||
VpBaseDS, VpDBDS;
|
||||
VpBaseDS, VpData, VpDBDS;
|
||||
|
||||
type
|
||||
TVpFirebirdDatastore = class(TVpCustomDBDatastore)
|
||||
@ -28,6 +28,9 @@ type
|
||||
function GetEventsTable: TDataset; override;
|
||||
function GetResourceTable: TDataset; override;
|
||||
function GetTasksTable: TDataset; override;
|
||||
procedure InternalPurgeContacts(Res: TVpResource); override;
|
||||
procedure InternalPurgeEvents(Res: TVpResource); override;
|
||||
procedure InternalPurgeTasks(Res: TVpResource); override;
|
||||
procedure Loaded; override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure OpenTables;
|
||||
@ -576,6 +579,33 @@ begin
|
||||
FTasksTable.Refresh;
|
||||
end;
|
||||
|
||||
{ Removes all contacts of the specified resource from the database. }
|
||||
procedure TVpFirebirdDataStore.InternalPurgeContacts(Res: TVpResource);
|
||||
var
|
||||
sql: String;
|
||||
begin
|
||||
sql := Format('DELETE FROM Contacts WHERE ResourceID = %d', [Res.ResourceID]);
|
||||
FConnection.ExecuteDirect(sql);
|
||||
end;
|
||||
|
||||
{ Removes all events of the specified resource from the database. }
|
||||
procedure TVpFirebirdDatastore.InternalPurgeEvents(Res: TVpResource);
|
||||
var
|
||||
sql: String;
|
||||
begin
|
||||
sql := Format('DELETE FROM Events WHERE ResourceID = %d', [Res.ResourceID]);
|
||||
FConnection.ExecuteDirect(sql);
|
||||
end;
|
||||
|
||||
{ Removes all tasks of the specified resource from the database. }
|
||||
procedure TVpFirebirdDatastore.InternalPurgeTasks(Res: TVpResource);
|
||||
var
|
||||
sql: String;
|
||||
begin
|
||||
sql := Format('DELETE FROM Tasks WHERE ResourceID = %d', [Res.ResourceID]);
|
||||
FConnection.ExecuteDirect(sql);
|
||||
end;
|
||||
|
||||
procedure TVpFirebirdDatastore.SetConnected(const AValue: Boolean);
|
||||
begin
|
||||
if (AValue = Connected) or (FConnection = nil) or (FConnectLock > 0) then
|
||||
|
Reference in New Issue
Block a user