Subject Re: [firebird-support] Detecting dependancies
Author Milan Babuskov
Robert martin wrote:
> The following SQL will list all the dependencies in the ClientCustom table
>
> SELECT DISTINCT dep.RDB$Field_Name AS FieldName
> FROM RDB$Dependencies dep
> WHERE UPPER(dep.RDB$Depended_On_Name) = 'CLIENTCUSTOM'
>
> Is this safe to use?

No. UPPER is a bad idea. If someone uses quoted identifiers, then the
case would matter. Also, the above select does not give you all the
dependencies.

> In my results I get the field I knew was in use by
> a stored procedure which is good. However I also get a dependency with
> no field name, what does this mean?

It is not so simple. If you know C++, you can take a look at
FlameRobin's code that reads the dependencies between objects. Function
MetadataItem::getDependencies() in file metadataitem.cpp is the one you
need.

>>Is there a way to
>>
>>a) Detect a dependency and not alter the field.

Yes.

>>b) Easily disable a stored procedure and later re-enable.

Yes.

Alter procedure to have an empty body (comment all the code inside with
/* */) and later just remove the comments.

--
Milan Babuskov
http://www.flamerobin.org