Monday 15 July 2013

java - Figure out what Tables a JOOQ Function depends on -


I was trying to join some of my JOOQ queries dynamically, when only to include the selection statement area Those tables are required because of the query so I have to know that the given field depends on which basis.

It's easy for TableField.getTable () via TableField .

It is also easier for the function - with Function.getArguments () I could run till the future tree till all I Can not access TableField Nodes of the leaf.

Unfortunately for me, however, the function class package is private.

I also have any static utilities JOOQ which can detect this for me.

Find out if there is any way to reduce dirty rezeps against SQL generated in this way, or a timid reflection.

The "official" way to do this type of SQL conversion will be done using SPI and in the lifeline query submission , By adding them to the select section, by adding them to the most appropriate FROM section.

This is the only way to do not access the arguments of the things that add together the internal function types of logic through regexes or reflections.

By saying: Be careful with doing this

You have to take care of any of these things (which is probably impossible):

  • What happens when you join yourself in a table?
  • How do you or do not join both internal or external tables?
  • How do you know that you can already reuse a table from the FROM section, or if you want to reconnect it again
  • If you have many possible ways to connect with them through foreign keys, how do you know the "optimal" path of Table B from Table A?

No comments:

Post a Comment