Class JoinsContext
java.lang.Object
com.kingsrook.qqq.backend.core.model.actions.tables.query.JoinsContext
Helper object used throughout query (and related (count, aggregate, reporting))
actions that need to track joins and aliases.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionJoinsContext
(QInstance instance, String tableName, List<QueryJoin> queryJoins, QQueryFilter filter) Constructor -
Method Summary
Modifier and TypeMethodDescriptionfindJoinMetaData
(String baseTableName, String joinTableName, boolean useExposedJoins) 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.Getter for queryJoinsboolean
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.boolean
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.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())
-
Constructor Details
-
JoinsContext
public JoinsContext(QInstance instance, String tableName, List<QueryJoin> queryJoins, QQueryFilter filter) throws QException Constructor- Throws:
QException
-
-
Method Details
-
getQueryJoins
-
resolveTableNameOrAliasToTableName
-
getFieldAndTableNameOrAlias
For a given fieldName, which we expect may start with a tableNameOrAlias + '.', find the QFieldMetaData and the tableNameOrAlias that it corresponds to. -
hasTable
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
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)
-