+ use InternalHandleException for exceptions when loading instances of TDataset, TDatabase or TDBTransaction

git-svn-id: trunk@1569 -
This commit is contained in:
joost 2005-10-23 11:07:13 +00:00
parent 68dca23994
commit ce1bb25e54
12 changed files with 56 additions and 55 deletions

View File

@ -32,12 +32,28 @@ begin
DatabaseError(SConnected,Self);
end;
Procedure TDatabase.InternalHandleException;
begin
if assigned(classes.ApplicationHandleException) then
classes.ApplicationHandleException(self)
else
ShowException(ExceptObject,ExceptAddr);
end;
procedure TDataBase.Loaded;
begin
inherited;
if FOpenAfterRead then
SetConnected(true);
try
if FOpenAfterRead then
SetConnected(true);
except
if csDesigning in Componentstate then
InternalHandleException
else
raise;
end;
end;
procedure TDataBase.SetConnected (Value : boolean);
@ -310,9 +326,24 @@ procedure TDBTransaction.Loaded;
begin
inherited;
if FOpenAfterRead then SetActive(true);
try
if FOpenAfterRead then SetActive(true);
except
if csDesigning in Componentstate then
InternalHandleException
else
raise;
end;
end;
Procedure TDBTransaction.InternalHandleException;
begin
if assigned(classes.ApplicationHandleException) then
classes.ApplicationHandleException(self)
else
ShowException(ExceptObject,ExceptAddr);
end;
Procedure TDBTransaction.CheckActive;

View File

@ -702,6 +702,15 @@ begin
result := FState <> dsInactive;
end;
Procedure TDataset.InternalHandleException;
begin
if assigned(classes.ApplicationHandleException) then
classes.ApplicationHandleException(self)
else
ShowException(ExceptObject,ExceptAddr);
end;
Procedure TDataset.SetActive (Value : Boolean);
begin
@ -723,7 +732,14 @@ procedure TDataset.Loaded;
begin
inherited;
if FOpenAfterRead then SetActive(true);
try
if FOpenAfterRead then SetActive(true);
except
if csDesigning in Componentstate then
InternalHandleException
else
raise;
end;
end;

View File

@ -1072,7 +1072,7 @@ type
procedure InternalDelete; virtual; abstract;
procedure InternalFirst; virtual; abstract;
procedure InternalGotoBookmark(ABookmark: Pointer); virtual; abstract;
procedure InternalHandleException; virtual; abstract;
procedure InternalHandleException; virtual;
procedure InternalInitFieldDefs; virtual; abstract;
procedure InternalInitRecord(Buffer: PChar); virtual; abstract;
procedure InternalLast; virtual; abstract;
@ -1355,6 +1355,7 @@ type
Procedure CheckInactive;
procedure EndTransaction; virtual; abstract;
procedure StartTransaction; virtual; abstract;
procedure InternalHandleException; virtual;
procedure Loaded; override;
Public
constructor Create(AOwner: TComponent); override;
@ -1398,6 +1399,7 @@ type
protected
Procedure CheckConnected;
Procedure CheckDisConnected;
procedure InternalHandleException; virtual;
procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Procedure DoInternalConnect; Virtual;Abstract;

View File

@ -65,7 +65,6 @@ type
procedure InternalPost; override;
// Misc methods:
procedure InternalClose; override;
procedure InternalHandleException; override;
procedure InternalInitFieldDefs; override;
procedure InternalOpen; override;
function IsCursorOpen: Boolean; override;
@ -348,12 +347,6 @@ begin
FillChar(FDataFile, SizeOf(FDataFile), 0);
end;
procedure TDDGDataSet.InternalHandleException;
begin
// standard implementation for this method:
// Application.HandleException(Self);
end;
procedure TDDGDataSet.InternalDelete;
begin
FIndexList.Delete(FRecordPos);

View File

@ -260,7 +260,6 @@ type
procedure InternalDelete; override;
procedure InternalFirst; override;
procedure InternalGotoBookmark(ABookmark: Pointer); override;
procedure InternalHandleException; override;
procedure InternalInitFieldDefs; override;
procedure InternalInitRecord(Buffer: PChar); override;
procedure InternalLast; override;
@ -1133,10 +1132,6 @@ begin
FCurrentRecord := PInteger(ABookmark)^;
end;
procedure TIBQuery.InternalHandleException;
begin
end;
procedure TIBQuery.InternalInitFieldDefs;
var
x : integer;

View File

@ -81,7 +81,6 @@ type
procedure InternalDelete; override;
procedure InternalFirst; override;
procedure InternalGotoBookmark(ABookmark: Pointer); override;
procedure InternalHandleException; override;
procedure InternalInitFieldDefs; override;
procedure InternalInitRecord(Buffer: PChar); override;
procedure InternalLast; override;
@ -775,11 +774,6 @@ begin
Result:=FStream.Size;
end;
procedure TMemDataset.InternalHandleException;
begin
// Application.HandleException(Self);
end;
procedure TMemDataset.Clear;
begin

View File

@ -108,7 +108,6 @@ type
procedure InternalPost; override;
// Misc methods:
procedure InternalClose; override;
procedure InternalHandleException; override;
procedure InternalInitFieldDefs; override;
procedure InternalOpen; override;
function IsCursorOpen: Boolean; override;
@ -358,11 +357,6 @@ begin
FCurrentRecord := PInteger(ABookmark)^;
end;
procedure TMySQLDataset.InternalHandleException;
begin
// Application.HandleException(self);
end;
procedure TMySQLDataset.InternalInitFieldDefs;
var

View File

@ -108,7 +108,6 @@ type
procedure InternalPost; override;
// Misc methods:
procedure InternalClose; override;
procedure InternalHandleException; override;
procedure InternalInitFieldDefs; override;
procedure InternalOpen; override;
function IsCursorOpen: Boolean; override;
@ -358,11 +357,6 @@ begin
FCurrentRecord := PInteger(ABookmark)^;
end;
procedure TMySQLDataset.InternalHandleException;
begin
// Application.HandleException(self);
end;
procedure TMySQLDataset.InternalInitFieldDefs;
var

View File

@ -405,6 +405,8 @@ procedure TFixedFormatDataSet.InternalHandleException;
begin
{$ifndef fpc}
Application.HandleException(Self);
{$else}
inherited;
{$endif}
end;

View File

@ -202,7 +202,6 @@ type
Procedure SetTransaction(Value : TDBTransaction); override;
procedure InternalAddRecord(Buffer: Pointer; AAppend: Boolean); override;
procedure InternalClose; override;
procedure InternalHandleException; override;
procedure InternalInitFieldDefs; override;
procedure InternalOpen; override;
function GetCanModify: Boolean; override;
@ -710,10 +709,6 @@ begin
inherited internalclose;
end;
procedure TSQLQuery.InternalHandleException;
begin
end;
procedure TSQLQuery.InternalInitFieldDefs;
begin
if FLoadingFieldDefs then

View File

@ -130,7 +130,6 @@ type
procedure InternalDelete; override;
procedure InternalFirst; override;
procedure InternalGotoBookmark(ABookmark: Pointer); override;
procedure InternalHandleException; override;
procedure InternalInitRecord(Buffer: PChar); override;
procedure InternalLast; override;
procedure InternalOpen; override;
@ -616,11 +615,6 @@ begin
FCurrentItem := PDataRecord(ABookmark^);
end;
procedure TCustomSqliteDataset.InternalHandleException;
begin
//??
end;
procedure TCustomSqliteDataset.InternalInitRecord(Buffer: PChar);
var
Counter:Integer;

View File

@ -158,7 +158,6 @@ end;
procedure InternalAddRecord(Buffer : Pointer; DoAppend : boolean); override;
procedure InternalDelete; override;
procedure InternalFirst; override;
procedure InternalHandleException; override;
procedure InternalInitRecord(Buffer : pChar); override;
procedure InternalLast;override;
procedure InternalPost;override;
@ -985,14 +984,6 @@ begin
self.fCurrentRecord:=0;
end;
procedure TSQLite.InternalHandleException;
begin
{
if _DO_EXCEPTIONS=1 then
Application.HandleException(Self)
}
end;
procedure TSQLite.InternalInitRecord(Buffer: pChar);
begin