I am searching for a specific line in my database and wanted to know if there is a function in ibexpert to look up for all dependencies of a field.
Is it possible to search for all dependencies of a field
1.8k Views Asked by ebug38 At
2
There are 2 best solutions below
1
On
I don't know IBExpert, but generically in Firebird, you can find dependencies in the system table RDB$DEPENDENCIES. It won't tell you exactly on which line of code a field is used, but it will help you identify in what object it is used. Then it is a matter of inspecting the source code of that specific object to see where it's used.
The table RDB$DEPENDENCIES has the following columns (in Firebird 2.5):
RDB$DEPENDENT_NAME- The name of the 'dependent' (the object using the dependency), eg a stored procedure nameRDB$DEPENDED_ON_NAME- The name of the dependency (eg table name)RDB$FIELD_NAME- The field name of a dependency (eg table column); can beNULLfor non-field dependenciesRDB$DEPENDENT_TYPE- Type of the dependent (eg 0 = relation (table or view), seeRDB$TYPESwithRDB$FIELD_NAME = 'RDB$OBJECT_TYPEfor possible values)RDB$DEPENDED_ON_TYPE- Type of the dependency (column dependencies have type 0 andRDB$FIELD_NAMEnot null, table/view dependencies have type 0 andRDB$FIELD_NAMEnull.
As an example, you can use the following query:
select dep.*, tt.RDB$TYPE_NAME as DEPENDENT_OBJECT_TYPE, dt.RDB$TYPE_NAME as DEPENDED_ON_OBJECT_TYPE
from RDB$DEPENDENCIES dep
inner join RDB$TYPES tt
on tt.RDB$TYPE = dep.RDB$DEPENDENT_TYPE
and tt.RDB$FIELD_NAME = 'RDB$OBJECT_TYPE'
inner join RDB$TYPES dt
on dt.RDB$TYPE = dep.RDB$DEPENDED_ON_TYPE
and dt.RDB$FIELD_NAME = 'RDB$OBJECT_TYPE'
When field is selected in table click on "Field dependencies" tab.