Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get trigger list from database

Posted on 1999-01-21
11
Medium Priority
?
231 Views
Last Modified: 2012-05-04
Hi all :-)

Small problem... I need to know list of tables, stored procedures, triggers and generators... Tables and stored procedures're ok with RX components, but what with triggers and generators ??? Exist some component for it ??? (I need in any SQL server - MSSQL/ORACLE/Borland)....

Thanx
0
Comment
Question by:rayofunreal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1362662
hi rayofunreal,

All information you want, you can get from the resultset of this query

select * from user_objects

meikl
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1362663
hi rayofunreal,

tested in oracle only

meikl

0
 
LVL 1

Author Comment

by:rayofunreal
ID: 1362664
Sorry,m this doesn't work with standard BDE :-(

Thanx....

R.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:rayofunreal
ID: 1362665
I mean Interbase....
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1362666
Hi rayofunreal,

a SQL Statement (Interbase)

Show Triggers

meikl
0
 
LVL 1

Author Comment

by:rayofunreal
ID: 1362667
I need to do it RUNTIME... Here're some BDE API calls, but I haven't doc about them :-(

Show Triggers ??? I'll try it...
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1362668
Hi rayofunreal,

you can do it at runtime!
use a tquery-component!

meikl
0
 
LVL 10

Expert Comment

by:Lischke
ID: 1362669
There's no consistent way to determine the number of system objects in all available DBMS. This is the reason why you cannot retrive them with the BDE. At least for Interbase you can do it so:

procedure ListItemNames(ItemType: TItemType; Info: PConnectionInfo; List: TStrings; SysInclude: Boolean);

begin
  if AquireConnectionSet(Info) then
    with Info.Connection do
    begin
      with TIB_Cursor.Create(nil) do
      try
        IB_Connection:=Info.Connection;
        case ItemType of
          itDomain     : SQL.Add('select rdb$field_name from rdb$fields');
          itException  : SQL.Add('select rdb$exception_name from rdb$exceptions');
          itFilter     : SQL.Add('select rdb$function_name from rdb$filters');
          itGenerator  : SQL.Add('select rdb$generator_name from rdb$generators');
          itStoredProc : SQL.Add('select rdb$procedure_name from rdb$procedures');
          itTable      : SQL.Add('select rdb$relation_name from rdb$relations');
          itTrigger    : SQL.Add('select rdb$trigger_name from rdb$triggers');
          itUDF        : SQL.Add('select rdb$function_name from rdb$functions');
          itView       : SQL.Add('select rdb$relation_name from rdb$relations');
        end;
        if not SysInclude then SQL.Add('where ((RDB$SYSTEM_FLAG <> 1) or (RDB$SYSTEM_FLAG IS NULL))');
        if ItemType = itView then SQL.Add('and (rdb$view_source is not null)');
        SQL.Add('order by 1');
        Prepare;
        First;
        while not EOF do
        begin
          List.Add(Trim(Fields[0].AsString));
          Next;
        end;
      finally
        Free;
      end;
    end;
end;

I used IB Objects for this code but you can very easy adapt it to your needs. Info.Connection/IB_Connection can be replaced by a TDatabase component and TIB_Cursor by a TQuery component.

Ciao, Mike
0
 
LVL 1

Author Comment

by:rayofunreal
ID: 1362670
Lischke - come from your points :-)
0
 
LVL 1

Author Comment

by:rayofunreal
ID: 1362671
Btw. what for other ? will work it ?
0
 
LVL 10

Accepted Solution

by:
Lischke earned 320 total points
ID: 1362672
Usually all info about a databases structure is stored in system tables (that's what they are for). Of course these tables aren't the same in all DBMS, so you have to find the way to retrieve the information you need for each database system separately.

Ciao, Mike
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question