Subject Struggling with RDB$DEPENDENCIES table
Author

I'm building a Firebird DB Admin tool, like FlameRobin (bc FlameRobin doesn't work on Windows Server 2016 Essentials)


I'm 80% done and have everything working except I'm struggling with something that shd be quite simple.  I've searched the Internet and found nothing to help me except the Firebird System Tables help that details the structure of the RDB$DEPENDENCIES table, which shd be super helpful, but actually isn't.


I'm trying to recreate the "<object> Depends On" and "Objects that Depend on <object>" grids from Flame Robin.  I want to present the user with a simpler TDBGrid, showing just two columns, Column 1) the object type (trigger, procedure, table, etc.) and Column 2) the object name.  The user can then click on the row and see the associated fields involved with the dependency in a TMemo.


I can't even get started because I'm unable to tease out the relationships between RDB$DEPENDENCIES.DEPENDENT_NAME and  RDB$DEPENDENCIES.DEPENDED_ON_NAME

 ... probably bc these columns "could" reference several different tables and you have to go through more than one JOIN to get the info you want. (Hint, compare what you see in FlameRobin with what you see in the RDB$DEPENDENCIES table.  Not the same.


I suspect I need 4 SQL statements.. (and I need help with each)


SQL 1)  List of things (object type and name) that my selected object depends ON

SQL 2)  The fields associated with the selected row in SQL 1 above

SQL 3)  List of things (object type and name) that my depend on my selected object

SQL 4)  The fields associated with the selected row in SQL 3 above


Any help will be greatly appreciated.  Target Platform is both FB SQL Dia 2 and 3