Class JoinHelper.RefDef

  • Enclosing class:
    JoinHelper

    protected static class JoinHelper.RefDef
    extends java.lang.Object
    • Field Detail

      • _signature

        protected final java.lang.String _signature
    • Constructor Detail

    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • signature

        protected static java.lang.String signature​(Base ref,
                                                    java.lang.String as)
      • getCompatibleRefDef

        protected ForeignKey getCompatibleRefDef​(ParserSession PS,
                                                 View V,
                                                 java.util.List<JoinHelper.RefDef> refs)
        The auto-join logic for Tilda is to look for the nearest previously referenced table and check if there is an FK either forward or backward. For example:
        • TableA.a1
        • TableA.a2
        • TableB.b1
        • TableB.b2
        • TableC.c1
        • TableC.c2
        First, TableA is the main FROM for the resulting view. Then we look at TableB and only search backward. So we check against A to see if TableB has a foreign key to A or the reverse, A has an FK to B. Then we look at TableC and we check first for FKs between C and B, before checking C vs A. We should pick the first match that comes up.
        Parameters:
        PS -
        V -
        refs -
        Returns: