FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.23k stars 212 forks source link

Add context variable about transaction start timestamp [CORE5493] #5762

Open firebird-automations opened 7 years ago

firebird-automations commented 7 years ago

Submitted by: @livius2

Votes: 1

Please add to context variables transaction start timestamp CURRENT_TRANSACTION_START_TIME

something like other context variables CURRENT_TRANSACTION, CURRENT_TIME It is usefull for e.g. audit - to have whole transaction operations marked with same timestamp.

We can use Select from MON$ tables now, but it cause performance drop - also if included in TRANSACTION START trigger

firebird-automations commented 7 years ago

Commented by: prenosil (prenosil)

I use trigger

CREATE OR ALTER TRIGGER DBTR_TRANSACTION_START ACTIVE ON TRANSACTION START POSITION 10 AS BEGIN RDB$SET_CONTEXT('USER_TRANSACTION', 'TRANSACTION_TIMESTAMP', CURRENT_TIMESTAMP); END