Registriert seit: 25. Nov 2005
Ort: München
1.909 Beiträge
Delphi 2010 Professional
|
Re: [Firebird 2.1] Statement zu einer offenen Transaktion fi
24. Feb 2009, 22:36
Um solche Schlawiner rauszufinden setze ich ab & zu das unten ab.
Die "Abfrage" gibt dir oben die älteste aktive Transaktion und zu jeder Transaktion den host, prozessname, user, etc.
Alles schön untereinander, so dass man nicht wie blöde nach links und rechts scrollen muss.
SQL-Code:
execute block
returns
(
Kind varchar(30),
ID bigint,
Time_Stamp timestamp,
Data blob sub_type text,
State integer
)
as
declare userName varchar(256);
declare dbName varchar(256);
declare tid bigint;
declare aid bigint;
begin
for select
mon$timestamp,
mon$state,
mon$transaction_id,
mon$attachment_id
from
mon$transactions t
-- where
-- mon$transaction_id = t.mon$oldest_active
order by
case when mon$transaction_id = t.mon$oldest_active then
0
else
1
end,
mon$transaction_id
into
:Time_Stamp, :State, :ID, :AID
do
begin
Data = null;
Kind = 'Transaction';
suspend;
TID = ID;
for select
trim(mon$remote_address)
||' -> '|| trim(mon$remote_process),
mon$remote_pid,
mon$user,
mon$attachment_name
from
MON$ATTACHMENTS
where
mon$attachment_id = :AID
into
:Data, :ID, :userName, :dbName
do
begin
State = null;
Kind = 'Process';
suspend;
ID = null;
Kind = 'Database';
Data = dbName;
suspend;
Kind = 'User';
Data = userName;
suspend;
Kind = 'Statement';
for select
mon$statement_id,
mon$timestamp,
mon$sql_text,
mon$state
from
MON$STATEMENTS
where
mon$transaction_id = :tid
and mon$attachment_id = :aid
into
:ID, :Time_Stamp, :Data, :State
do
suspend;
end
end
end
Robert Giesecke I’m a great believer in “Occam’s Razor,” the principle which says:
“If you say something complicated, I’ll slit your throat.”
|
|
Zitat
|