Subject Re: [firebird-support] Re: Log transaction ID
Author Martijn Tonies
> > > gstat can show transaction numbers (OAT, Next transaction).
> > >
> > > But how do I find out the transaction number corresponding to the
> > > current transaction (i.e., to a given isc_tr_handle) ?
> > >
> > > I need this to help finding out which is the query corresponding to
> > > the OAT.
> >
> > With Firebird 1.5, CURRENT_TRANSACTION
>
> In DSQL / PSQL, yes.
>
> But a C program normally starts a transaction (thus becomimg a
> transaction handle, isc_tr_handle), and then executes a query within
> this transaction, and then commits the transaction.
>
> I want to (sys-)log the transaction number of each executed query, to
> see which one is living too long. So I must be able to get the
> transaction number from the isc_tr_handle.

I don't think the two are related.

Perhaps you can create a transaction-wrapper like thingy
that internally does a
SELECT CURRENT_TRANSACTION
FROM RDB$DATABASE
for your given isc_tr_handle.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com