public final class SQLFragmentUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.List<SelectObject> |
expandStarColumns(SQLQuery query)
Gets an expanded list of SelectObjects for the given query that has any
wildcard * columns expanded to the underlying table columns.
|
static java.util.Collection<DBObjectID> |
getReferenceIDs(java.lang.String sql,
DBObjectProvider pro) |
static SelectObject[] |
getSelectObjects(SQLQuery query)
Gets the SelectObjects for this query.
|
static Relation |
getTable(FromObject from) |
static java.lang.String |
getTableName(FromObjectUsage usage)
Gets the table name used by the given FromObjectUsage (could be an alias
rather than an actual table's name).
|
static boolean |
hasPKCols(java.util.Collection<java.lang.String> colNames,
FromObject from)
Tests whether the list of columns contains a PK column for the table
referenced by the given given FromObject
|
static java.util.Collection<java.lang.String> |
listBindVariables(java.lang.String sqlText)
Lists the named bind variables (i.e.
|
static java.util.Collection<java.lang.String> |
listColumnNames(SQLFragment expression)
Lists the columns available from the given SQLFragment.
|
static java.util.Collection<Column> |
listColumns(SQLFragment expression)
Deprecated.
- Columns availble from
SQLQueryBuilder.getColumns() |
static java.util.Collection<ColumnUsage> |
listColumnUsages(SQLFragment expression)
Deprecated.
use the generic DBUtil.findChildren method to find children
of a given class underneath the SQLFragment. i.e.
DBUtil.findChildren( expression, ColumnUsage.class ) |
static java.util.Collection<java.lang.String> |
listCommonColumns(FromObject left,
FromObject right)
Lists the names of columns common to both FromObjects.
|
static java.util.Collection<java.lang.String> |
listCommonColumns(JoinObject join)
List the names of columns common to both the left and right side of the
given join.
|
static java.util.Set<java.lang.String> |
listFromObjectNames(SQLQuery query)
Lists the names of the FromObjects that are defined in the given query
(does not include subqueries, just the namespace available in the current
query).
|
static void |
replaceStarColumns(SQLQuery query)
Alters the given SQLQuery so that any asterisk columns are expanded into
multiple select objects.
|
public static SelectObject[] getSelectObjects(SQLQuery query)
It is only expected that this is useful for logic that determines the "columns" to match a given query.
query
- the query to get a list of SelectObjects forpublic static void replaceStarColumns(SQLQuery query)
query
- the query to expand.public static java.util.List<SelectObject> expandStarColumns(SQLQuery query)
public static Relation getTable(FromObject from)
public static java.lang.String getTableName(FromObjectUsage usage)
usage
- the FromObjectUsage to get the table name/alias forpublic static java.util.Set<java.lang.String> listFromObjectNames(SQLQuery query)
public static java.util.Collection<java.lang.String> listCommonColumns(JoinObject join)
public static java.util.Collection<java.lang.String> listCommonColumns(FromObject left, FromObject right)
@Deprecated public static java.util.Collection<Column> listColumns(SQLFragment expression)
SQLQueryBuilder.getColumns()
@Deprecated public static java.util.Collection<ColumnUsage> listColumnUsages(SQLFragment expression)
DBUtil.findChildren( expression, ColumnUsage.class )
public static java.util.Collection<java.lang.String> listColumnNames(SQLFragment expression)
expression
- the expression to querypublic static boolean hasPKCols(java.util.Collection<java.lang.String> colNames, FromObject from)
colNames
- the name of the columns from the used tablefrom
- the FromObject (from which the table is found)public static java.util.Collection<DBObjectID> getReferenceIDs(java.lang.String sql, DBObjectProvider pro)
public static java.util.Collection<java.lang.String> listBindVariables(java.lang.String sqlText)