rayofunreal
asked on
Get trigger list from database
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
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
hi rayofunreal,
tested in oracle only
meikl
tested in oracle only
meikl
ASKER
Sorry,m this doesn't work with standard BDE :-(
Thanx....
R.
Thanx....
R.
ASKER
I mean Interbase....
Hi rayofunreal,
a SQL Statement (Interbase)
Show Triggers
meikl
a SQL Statement (Interbase)
Show Triggers
meikl
ASKER
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...
Show Triggers ??? I'll try it...
Hi rayofunreal,
you can do it at runtime!
use a tquery-component!
meikl
you can do it at runtime!
use a tquery-component!
meikl
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.Connec tion;
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].As String));
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_Connect ion can be replaced by a TDatabase component and TIB_Cursor by a TQuery component.
Ciao, Mike
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.Connec
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].As
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_Connect
Ciao, Mike
ASKER
Lischke - come from your points :-)
ASKER
Btw. what for other ? will work it ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
All information you want, you can get from the resultset of this query
select * from user_objects
meikl