Class JoinsContext

java.lang.Object
com.kingsrook.qqq.backend.core.model.actions.tables.query.JoinsContext

public class JoinsContext extends Object
Helper object used throughout query (and related (count, aggregate, reporting)) actions that need to track joins and aliases.
  • Constructor Details

  • Method Details

    • getQueryJoins

      public List<QueryJoin> getQueryJoins()
      Getter for queryJoins
    • resolveTableNameOrAliasToTableName

      public String resolveTableNameOrAliasToTableName(String nameOrAlias)
      For a given name (whether that's a table name or an alias in the query), get the actual table name (e.g., that could be passed to qInstance.getTable())
    • getFieldAndTableNameOrAlias

      public JoinsContext.FieldAndTableNameOrAlias getFieldAndTableNameOrAlias(String fieldName)
      For a given fieldName, which we expect may start with a tableNameOrAlias + '.', find the QFieldMetaData and the tableNameOrAlias that it corresponds to.
    • hasTable

      public boolean hasTable(String table)
      Check if the given table name exists in the query - but that name may NOT be an alias - it must be an actual table name. e.g., Given: FROM `order` INNER JOIN line_item li hasTable("order") => true hasTable("li") => false hasTable("line_item") => true
    • hasAliasOrTable

      public boolean hasAliasOrTable(String tableOrAlias)
      Check if the given tableOrAlias exists in the query - but note, if a table is in the query, but with an alias, then it would not be found by this method. e.g., Given: FROM `order` INNER JOIN line_item li hasAliasOrTable("order") => false hasAliasOrTable("li") => true hasAliasOrTable("line_item") => false
    • findJoinMetaData

      public QJoinMetaData findJoinMetaData(String baseTableName, String joinTableName, boolean useExposedJoins)