Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/component/ZAbstractRODataset.pas
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ interface
TypInfo, {$IFDEF MSEgui}mclasses, mdb{$ELSE}DB{$ENDIF},
{$IFDEF WITH_GENERIC_TLISTTFIELD}Generics.Collections,{$ENDIF}
{$IFNDEF NO_UNIT_CONTNRS}Contnrs,{$ENDIF}
ZSysUtils, ZCompatibility, ZExpression, ZClasses,
ZSysUtils, ZCompatibility, ZExpression, ZClasses, ZDbcInterbase6Statement, ZDbcFirebirdInterbase,
ZDbcIntfs, ZDbcCache, ZDbcCachedResultSet, ZTokenizer,
ZAbstractConnection, ZDatasetUtils, ZSqlStrings, ZFormatSettings, ZTransaction, ZExceptions
{$IFNDEF DISABLE_ZPARAM},ZDatasetParam{$ENDIF};
Expand Down Expand Up @@ -3759,6 +3759,8 @@ function TZAbstractRODataset.CreateStatement(const SQL: string; Properties: TStr
end;
{$ELSE}
Result := TxnCon.PrepareStatementWithParams(SQL, Temp);
if Assigned(FTransaction) and (Result is TZInterbase6PreparedStatement) then // assing transaction for IB/FB
TZInterbase6PreparedStatement(Result).IBTransaction := IZInterbaseFirebirdTransaction(Txn);
{$ENDIF}
finally
Temp.Free;
Expand Down
8 changes: 7 additions & 1 deletion src/dbc/ZDbcInterbase6Statement.pas
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ TZAbstractInterbase6PreparedStatement = class(TZAbstractFirebirdInterbasePrepa
private
FResultXSQLDA: IZSQLDA; //the out param or resultset Interface
FIBConnection: IZInterbase6Connection; //the IB/FB connection interface
FIBTransaction: IZInterbaseFirebirdTransaction; //the IB/FB transaction interface
FParamSQLData: IZParamsSQLDA;//the in param Interface
FParamXSQLDA: PXSQLDA;
FPlainDriver: TZInterbasePlainDriver; //the api holder object of the provider
Expand Down Expand Up @@ -104,6 +105,7 @@ TZAbstractInterbase6PreparedStatement = class(TZAbstractFirebirdInterbasePrepa

function LobTransactionEqualsToActiveTransaction(const Lob: IZInterbaseFirebirdLob): Boolean; override;
public
property IBTransaction : IZInterbaseFirebirdTransaction read FIBTransaction write FIBTransaction;
/// <summary>Constructs this object and assignes the main properties.</summary>
/// <param>"Connection" the IZInterbase6Connection interface which creates
/// this object.</param>
Expand Down Expand Up @@ -203,7 +205,10 @@ procedure TZAbstractInterbase6PreparedStatement.ExecuteInternal;
if DriverManager.HasLoggingListener then
DriverManager.LogMessage(lcBindPrepStmt,Self);
RestartTimer;
ISC_TR_HANDLE := FIBConnection.GetTrHandle;
if Assigned(FIBTransaction) and (FIBTransaction.QueryInterface(IZIBTransaction, Transaction) = S_OK) then
ISC_TR_HANDLE := Transaction.GetTrHandle
else
ISC_TR_HANDLE := FIBConnection.GetTrHandle;
dialect := FIBConnection.GetDialect;
if (FStatementType = stExecProc)
then iError := FPlainDriver.isc_dsql_execute2(@FStatusVector, ISC_TR_HANDLE,
Expand Down Expand Up @@ -292,6 +297,7 @@ constructor TZAbstractInterbase6PreparedStatement.Create(const Connection: IZInt
begin
inherited Create(Connection, SQL, Info);
FIBConnection := Connection;
FIBTransaction := nil;
FPlainDriver := TZInterbasePlainDriver(FIBConnection.GetIZPlainDriver.GetInstance);
ResultSetType := rtForwardOnly;
FStmtHandle := 0;
Expand Down