mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:14:25 +02:00
+ Added TCustomConnection by Uberto Barbini
This commit is contained in:
parent
e97b4edd00
commit
89e6318dd8
@ -442,9 +442,89 @@ begin
|
|||||||
DatabaseError(SNoDatasets);
|
DatabaseError(SNoDatasets);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ ---------------------------------------------------------------------
|
||||||
|
TCustomConnection
|
||||||
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
|
procedure TCustomConnection.SetAfterConnect(const AValue: TNotifyEvent);
|
||||||
|
begin
|
||||||
|
if FAfterConnect=AValue then exit;
|
||||||
|
FAfterConnect:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomConnection.SetAfterDisconnect(const AValue: TNotifyEvent);
|
||||||
|
begin
|
||||||
|
if FAfterDisconnect=AValue then exit;
|
||||||
|
FAfterDisconnect:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomConnection.SetBeforeConnect(const AValue: TNotifyEvent);
|
||||||
|
begin
|
||||||
|
if FBeforeConnect=AValue then exit;
|
||||||
|
FBeforeConnect:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomConnection.SetBeforeDisconnect(const AValue: TNotifyEvent);
|
||||||
|
begin
|
||||||
|
if FBeforeDisconnect=AValue then exit;
|
||||||
|
FBeforeDisconnect:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomConnection.DoInternalConnect;
|
||||||
|
begin
|
||||||
|
if Assigned(BeforeConnect) then
|
||||||
|
BeforeConnect(self);
|
||||||
|
DoConnect;
|
||||||
|
if Assigned(AfterConnect) then
|
||||||
|
AfterConnect(self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomConnection.DoInternalDisconnect;
|
||||||
|
begin
|
||||||
|
if Assigned(BeforeDisconnect) then
|
||||||
|
BeforeDisconnect(self);
|
||||||
|
DoDisconnect;
|
||||||
|
if Assigned(AfterDisconnect) then
|
||||||
|
AfterDisconnect(self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomConnection.DoConnect;
|
||||||
|
|
||||||
|
begin
|
||||||
|
// Do nothing yet
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomConnection.DoDisconnect;
|
||||||
|
|
||||||
|
begin
|
||||||
|
// Do nothing yet
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomConnection.GetConnected: boolean;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result := Connected;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomConnection.StartTransaction;
|
||||||
|
|
||||||
|
begin
|
||||||
|
// Do nothing yet
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomConnection.EndTransaction;
|
||||||
|
|
||||||
|
begin
|
||||||
|
// Do nothing yet
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 2005-04-24 19:21:28 joost
|
Revision 1.12 2005-04-26 16:37:44 michael
|
||||||
|
+ Added TCustomConnection by Uberto Barbini
|
||||||
|
|
||||||
|
Revision 1.11 2005/04/24 19:21:28 joost
|
||||||
- some fixes in assignment of transactions and databases
|
- some fixes in assignment of transactions and databases
|
||||||
|
|
||||||
Revision 1.10 2005/02/14 17:13:12 peter
|
Revision 1.10 2005/02/14 17:13:12 peter
|
||||||
|
33
fcl/db/db.pp
33
fcl/db/db.pp
@ -1373,6 +1373,34 @@ type
|
|||||||
property Params : TStrings read FParams Write FParams;
|
property Params : TStrings read FParams Write FParams;
|
||||||
property OnLogin: TLoginEvent read FOnLogin write FOnLogin;
|
property OnLogin: TLoginEvent read FOnLogin write FOnLogin;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TCustomConnection }
|
||||||
|
|
||||||
|
TCustomConnection = class(TDatabase)
|
||||||
|
private
|
||||||
|
FAfterConnect: TNotifyEvent;
|
||||||
|
FAfterDisconnect: TNotifyEvent;
|
||||||
|
FBeforeConnect: TNotifyEvent;
|
||||||
|
FBeforeDisconnect: TNotifyEvent;
|
||||||
|
procedure SetAfterConnect(const AValue: TNotifyEvent);
|
||||||
|
procedure SetAfterDisconnect(const AValue: TNotifyEvent);
|
||||||
|
procedure SetBeforeConnect(const AValue: TNotifyEvent);
|
||||||
|
procedure SetBeforeDisconnect(const AValue: TNotifyEvent);
|
||||||
|
protected
|
||||||
|
procedure DoInternalConnect; override;
|
||||||
|
procedure DoInternalDisconnect; override;
|
||||||
|
procedure DoConnect; virtual;
|
||||||
|
procedure DoDisconnect; virtual;
|
||||||
|
function GetConnected : boolean; virtual;
|
||||||
|
procedure StartTransaction; override;
|
||||||
|
procedure EndTransaction; override;
|
||||||
|
published
|
||||||
|
property AfterConnect : TNotifyEvent read FAfterConnect write SetAfterConnect;
|
||||||
|
property BeforeConnect : TNotifyEvent read FBeforeConnect write SetBeforeConnect;
|
||||||
|
property AfterDisconnect : TNotifyEvent read FAfterDisconnect write SetAfterDisconnect;
|
||||||
|
property BeforeDisconnect : TNotifyEvent read FBeforeDisconnect write SetBeforeDisconnect;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TBufDataset }
|
{ TBufDataset }
|
||||||
|
|
||||||
@ -1911,7 +1939,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.49 2005-04-26 15:45:30 michael
|
Revision 1.50 2005-04-26 16:37:44 michael
|
||||||
|
+ Added TCustomConnection by Uberto Barbini
|
||||||
|
|
||||||
|
Revision 1.49 2005/04/26 15:45:30 michael
|
||||||
+ Patch from Sergey Smirnov to fix TTimeField.AsString
|
+ Patch from Sergey Smirnov to fix TTimeField.AsString
|
||||||
|
|
||||||
Revision 1.48 2005/04/24 19:21:28 joost
|
Revision 1.48 2005/04/24 19:21:28 joost
|
||||||
|
Loading…
Reference in New Issue
Block a user