Subject | Call for ideas - CONNECT BY |
---|---|
Author | paulruizendaal |
Post date | 2004-04-01T21:35:55Z |
Testing with Compiere users has revealed that it uses hierarchical
queries. This is not yet implemented in our Oracle-mode stuff :^(
A hierarchical query is a query on a table with parent-child
relationships between the rows. The stock example is an employee
table where each row has a column with the ID of the direct manager.
Oracle allows to sort a result set such that employees are listed
underneath their manager, using the CONNECT BY <condition> START WITH
<condition> syntax. The connect by condition is of the form <expr> =
PRIOR <expr>, for example "MGR_ID = PRIOR EMP_ID". A patch exists for
PostgreSQL to add this feature. Other rdbm systems (DB2, Sap/MaxDB)
have a similar capability using a more elegant and powerful recursive
view/cursor syntax.
I would like to add the CONNECT BY capability to round out Oracle-
mode Firebird. At my current level of understanding I would think
that the easiest (although probably not the cleanest) way to add
this, is to think of CONNECT BY as a funny sort order and model the
code on the code for ORDER BY <expr>.
I would welcome all input:
- Has anybody looked into this before ?
- Good recommendations as how to implement this ?
- Who can explain the meaning of the current rsb_types to me ?
(they don't look very orthogonal ...)
I guess as part of this effort I could try to convert the RSE module
code to a proper class hierarchy and add a ROWNUM capability.
Paul
queries. This is not yet implemented in our Oracle-mode stuff :^(
A hierarchical query is a query on a table with parent-child
relationships between the rows. The stock example is an employee
table where each row has a column with the ID of the direct manager.
Oracle allows to sort a result set such that employees are listed
underneath their manager, using the CONNECT BY <condition> START WITH
<condition> syntax. The connect by condition is of the form <expr> =
PRIOR <expr>, for example "MGR_ID = PRIOR EMP_ID". A patch exists for
PostgreSQL to add this feature. Other rdbm systems (DB2, Sap/MaxDB)
have a similar capability using a more elegant and powerful recursive
view/cursor syntax.
I would like to add the CONNECT BY capability to round out Oracle-
mode Firebird. At my current level of understanding I would think
that the easiest (although probably not the cleanest) way to add
this, is to think of CONNECT BY as a funny sort order and model the
code on the code for ORDER BY <expr>.
I would welcome all input:
- Has anybody looked into this before ?
- Good recommendations as how to implement this ?
- Who can explain the meaning of the current rsb_types to me ?
(they don't look very orthogonal ...)
I guess as part of this effort I could try to convert the RSE module
code to a proper class hierarchy and add a ROWNUM capability.
Paul