+ Patch from Michalis Kamburelis to correct transactions

This commit is contained in:
michael 2005-03-23 08:35:05 +00:00
parent 012392381c
commit d9ccf57c4a

View File

@ -52,6 +52,8 @@ type
procedure SetDBDialect; procedure SetDBDialect;
procedure SetTransaction(Value : TIBTransaction); procedure SetTransaction(Value : TIBTransaction);
protected protected
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
function GetHandle : pointer; virtual; function GetHandle : pointer; virtual;
{ This procedure makes connection to Interbase server internally. { This procedure makes connection to Interbase server internally.
Is visible only by descendants, in application programming Is visible only by descendants, in application programming
@ -180,7 +182,7 @@ type
property AccessMode: TAccessMode property AccessMode: TAccessMode
read FAccessMode write FAccessMode default amReadWrite; read FAccessMode write FAccessMode default amReadWrite;
property IsolationLevel: TIsolationLevel property IsolationLevel: TIsolationLevel
read FIsolationLevel write FIsolationLevel default ilReadCommitted; read FIsolationLevel write FIsolationLevel default ilConcurrent;
property LockResolution: TLockResolution property LockResolution: TLockResolution
read FLockResolution write FLockResolution default lrWait; read FLockResolution write FLockResolution default lrWait;
property TableReservation: TTableReservation property TableReservation: TTableReservation
@ -383,22 +385,24 @@ end;
procedure TIBDatabase.SetTransaction(Value : TIBTransaction); procedure TIBDatabase.SetTransaction(Value : TIBTransaction);
begin begin
if FTransaction = nil then if Value <> FTransaction then
begin begin
FTransaction := Value; if FTransaction <> nil then
if Assigned(FTransaction) then begin
FTransaction.Database := Self; if FTransaction.Active then
exit; raise EInterBaseError.Create(
end; 'Cannot assign transaction while old transaction active!');
FTransaction.RemoveFreeNotification(Self);
if (Value <> FTransaction) and (Value <> nil) then end;
if (not FTransaction.Active) then
FTransaction := Value;
if FTransaction <> nil then
begin begin
FTransaction := Value;
FTransaction.Database := Self; FTransaction.Database := Self;
end FTransaction.FreeNotification(Self);
else end;
raise EInterBaseError.Create('Cannot assign transaction while old transaction active!'); end;
end; end;
function TIBDatabase.GetHandle: pointer; function TIBDatabase.GetHandle: pointer;
@ -468,6 +472,14 @@ begin
inherited Destroy; inherited Destroy;
end; end;
procedure TIBDatabase.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited;
if (AComponent = FTransaction) and (Operation = opRemove) then
FTransaction := nil;
end;
{ TIBTransaction } { TIBTransaction }
procedure TIBTransaction.SetActive(Value : boolean); procedure TIBTransaction.SetActive(Value : boolean);
@ -573,7 +585,7 @@ end;
constructor TIBTransaction.Create(AOwner : TComponent); constructor TIBTransaction.Create(AOwner : TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FIsolationLevel := ilReadCommitted; FIsolationLevel := ilConcurrent;
end; end;
destructor TIBTransaction.Destroy; destructor TIBTransaction.Destroy;
@ -990,7 +1002,7 @@ begin
for x := 0 to FSQLDA^.SQLD - 1 do for x := 0 to FSQLDA^.SQLD - 1 do
begin begin
{$R-} {$R-}
if (Field.FieldName = FSQLDA^.SQLVar[x].SQLName) then if (Field.FieldName = FSQLDA^.SQLVar[x].AliasName) then
begin begin
Result := not PFieldDataPrefix(CurrBuff)^.IsNull; Result := not PFieldDataPrefix(CurrBuff)^.IsNull;
@ -1138,7 +1150,7 @@ begin
begin begin
TranslateFldType(FSQLDA^.SQLVar[x].SQLType, FSQLDA^.SQLVar[x].SQLLen, lenset, TranslateFldType(FSQLDA^.SQLVar[x].SQLType, FSQLDA^.SQLVar[x].SQLLen, lenset,
TransType, TransLen); TransType, TransLen);
TFieldDef.Create(FieldDefs, FSQLDA^.SQLVar[x].SQLName, TransType, TFieldDef.Create(FieldDefs, FSQLDA^.SQLVar[x].AliasName, TransType,
TransLen, False, (x + 1)); TransLen, False, (x + 1));
end; end;
{$R+} {$R+}
@ -1247,7 +1259,10 @@ end.
{ {
$Log$ $Log$
Revision 1.16 2005-03-17 09:02:17 michael Revision 1.17 2005-03-23 08:35:05 michael
+ Patch from Michalis Kamburelis to correct transactions
Revision 1.16 2005/03/17 09:02:17 michael
+ Patch from Michalis Kamburelis to fix TField.IsNull + Patch from Michalis Kamburelis to fix TField.IsNull
Revision 1.15 2005/02/14 17:13:12 peter Revision 1.15 2005/02/14 17:13:12 peter