- some fixes in assignment of transactions and databases

This commit is contained in:
joost 2005-04-24 19:21:28 +00:00
parent 8884d2e079
commit ce319c62c2
4 changed files with 38 additions and 20 deletions

View File

@ -250,9 +250,9 @@ end;
Procedure TDBDataset.SetDatabase (Value : TDatabase);
begin
CheckInactive;
If Value<>FDatabase then
begin
CheckInactive;
If Assigned(FDatabase) then
FDatabase.UnregisterDataset(Self);
If Value<>Nil Then
@ -344,9 +344,9 @@ end;
Procedure TDBTransaction.SetDatabase (Value : TDatabase);
begin
CheckInactive;
If Value<>FDatabase then
begin
CheckInactive;
If Assigned(FDatabase) then
FDatabase.UnregisterTransaction(Self);
If Value<>Nil Then
@ -444,7 +444,10 @@ end;
{
$Log$
Revision 1.10 2005-02-14 17:13:12 peter
Revision 1.11 2005-04-24 19:21:28 joost
- some fixes in assignment of transactions and databases
Revision 1.10 2005/02/14 17:13:12 peter
* truncate log
}

View File

@ -1284,7 +1284,6 @@ type
FDatabase : TDatabase;
FDataSets : TList;
FOpenAfterRead : boolean;
Procedure SetDatabase (Value : TDatabase);
Function GetDataSetCount : Longint;
Function GetDataset(Index : longint) : TDBDataset;
procedure RegisterDataset (DS : TDBDataset);
@ -1292,6 +1291,7 @@ type
procedure RemoveDataSets;
procedure SetActive(Value : boolean);
Protected
Procedure SetDatabase (Value : TDatabase); virtual;
procedure CloseTrans;
procedure openTrans;
Procedure CheckDatabase;
@ -1909,7 +1909,10 @@ end.
{
$Log$
Revision 1.47 2005-04-13 22:09:15 joost
Revision 1.48 2005-04-24 19:21:28 joost
- some fixes in assignment of transactions and databases
Revision 1.47 2005/04/13 22:09:15 joost
- TIndexDefs.Destroy now calls inhedited.Destroy
Revision 1.46 2005/04/10 22:18:43 joost

View File

@ -909,6 +909,9 @@ begin
if not field.getData(@blobId) then
exit;
if not assigned(Transaction) then
DatabaseError(SErrConnTransactionnSet);
TransactionHandle := transaction.Handle;
blobHandle := nil;

View File

@ -130,6 +130,7 @@ type
FAction : TCommitRollbackAction;
protected
function GetHandle : Pointer; virtual;
Procedure SetDatabase (Value : TDatabase); override;
public
procedure Commit; virtual;
procedure CommitRetaining; virtual;
@ -260,22 +261,14 @@ end;
procedure TSQLConnection.SetTransaction(Value : TSQLTransaction);
begin
if FTransaction = nil then
begin
FTransaction := Value;
if Assigned(FTransaction) then
FTransaction.Database := Self;
exit;
end;
if (Value <> FTransaction) and (Value <> nil) then
if (not FTransaction.Active) then
if FTransaction<>value then
begin
FTransaction := Value;
FTransaction.Database := Self;
end
else
if Assigned(FTransaction) and FTransaction.Active then
DatabaseError(SErrAssTransaction);
if Assigned(Value) then
Value.Database := Self;
FTransaction := Value;
end;
end;
procedure TSQLConnection.UpdateIndexDefs(var IndexDefs : TIndexDefs;TableName : string);
@ -448,6 +441,19 @@ begin
inherited Destroy;
end;
Procedure TSQLTransaction.SetDatabase(Value : TDatabase);
begin
If Value<>Database then
begin
CheckInactive;
If Assigned(Database) then
with Database as TSqlConnection do
if Transaction = self then Transaction := nil;
inherited SetDatabase(Value);
end;
end;
{ TSQLQuery }
procedure TSQLQuery.OnChangeSQL(Sender : TObject);
@ -973,7 +979,10 @@ end.
{
$Log$
Revision 1.17 2005-04-13 22:10:26 joost
Revision 1.18 2005-04-24 19:21:28 joost
- some fixes in assignment of transactions and databases
Revision 1.17 2005/04/13 22:10:26 joost
- TSQLQuery now frees FIndexDefs
Revision 1.16 2005/04/10 18:29:26 joost