AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken [Firebird 2.1] Statement zu einer offenen Transaktion finden
Thema durchsuchen
Ansicht
Themen-Optionen

[Firebird 2.1] Statement zu einer offenen Transaktion finden

Ein Thema von alzaimar · begonnen am 24. Feb 2009 · letzter Beitrag vom 5. Apr 2009
 
Elvis

Registriert seit: 25. Nov 2005
Ort: München
1.909 Beiträge
 
Delphi 2010 Professional
 
#4

Re: [Firebird 2.1] Statement zu einer offenen Transaktion fi

  Alt 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.”
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:54 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz