Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get trigger list from database

Posted on 1999-01-21
11
Medium Priority
?
235 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
  • 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

877 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