|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.datatools.modelbase.sql.query.helper.ValueExpressionHelper
This class provides a set of utility methods for dealing with Value Expression objects.
Constructor Summary | |
ValueExpressionHelper()
|
Method Summary | |
static void |
addExpressionsToList(java.util.List columnList,
QueryValueExpression aValueExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Determines whether a given value expression is already a column expression and if so, adds it to the passed in list. |
static QueryValueExpression |
cloneQueryValueExpression(QueryValueExpression valueExpr)
Returns a copy of the given valueExpr using
EcoreUtil#copy(org.eclipse.emf.ecore.EObject) . |
static DataType |
copyDataType(DataType dataType)
Returns a copy of the given datatype using
EcoreUtil#copy(org.eclipse.emf.ecore.EObject) . |
static void |
copyDataType(QueryValueExpression aSourceExpr,
QueryValueExpression aTargetExpr)
Attempts to copy the datatype from one given value expression to another using EcoreUtil#copy(org.eclipse.emf.ecore.EObject) . |
static java.util.List |
getColumnsFromSearchCondition(QuerySearchCondition aSearchCond)
CHECK IMPLEMENTATION! CODE UNTESTED! Method to obtain the column expressions from a SearchCondition |
static java.util.List |
getColumnsFromValueExpression(QueryValueExpression valueExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Method to obtain the column expressions from a generic ValueExpression Note that only the value expressions listed below can contain columns within them. |
static java.util.List |
getTableNamesFromExpression(QueryValueExpression valueExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Method to obtain the string table name/s from a ValueExpression |
static java.util.List |
getTableRefsFromExpression(QueryValueExpression valueExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Method to obtain the table references from a ValueExpression |
static java.util.List |
getVECaseColumns(ValueExpressionCase aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Extracts and returns a list of column reference objects from the given ValueExpressionCase object. |
static java.util.List |
getVECastColumns(ValueExpressionCast aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Method to obtain the column expressions from a ValueExpressionCast |
static java.util.List |
getVECombinedColumns(ValueExpressionCombined combined)
CHECK IMPLEMENTATION! CODE UNTESTED! Method to obtain the column expressions from a ValueExpressionCombined |
static java.util.List |
getVEFunctionColumns(ValueExpressionFunction funcExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Method to obtain the column expressions from a ValueExpressionFunction |
static java.util.List |
getVELabeledDurationColumns(ValueExpressionLabeledDuration labeledDurExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Method to obtain the column expressions from a ValueExpressionLabeledDuration |
static DataType |
numericDataTypePromotion(DataType left,
DataType right)
Do the numeric data type promotion |
static Column |
resolveColumnFromValueExpression(ValueExpressionColumn aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Determine the Column that corresponds to this column expression if there is one that the given columnExpr is derived from. |
static DataType |
resolveCombinedDataType(DataType aDataType,
DataType anotherDataType)
CHANGE IMPLEMENTATION! CODE INCORRECT! returns the given aDataType , if not null , or
the given anotherDataType . |
static void |
resolveTablesInValueExpression(QueryValueExpression valExpr,
java.util.List tables)
CHECK IMPLEMENTATION! CODE UNTESTED! Substitutes the tables in the given table list into the given Value Expression in place of the one it currently has. |
static void |
resolveValueExpressionCaseDatatype(ValueExpressionCase aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype of the given Case value expression. |
static void |
resolveValueExpressionCastDatatype(ValueExpressionCast aCastValueExpr)
Deprecated. redundant method |
static void |
resolveValueExpressionColumnDatatype(ValueExpressionColumn aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype of the given column value expression. |
static void |
resolveValueExpressionCombined(ValueExpressionCombined aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype of the given "Combined" value expression. |
static void |
resolveValueExpressionConcatDatatype(QueryValueExpression aValExpr,
QueryValueExpression aLeftValExpr,
QueryValueExpression aRightValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype (DataType) of the given "concatenated" value expression. |
static void |
resolveValueExpressionConcatDatatype(QueryValueExpression aValExpr,
QueryValueExpression aLeftValExpr,
QueryValueExpression aRightValExpr,
java.util.List aTableRefList,
Database aDB)
Deprecated. use resolveValueExpressionConcatDatatype(QueryValueExpression, QueryValueExpression, QueryValueExpression) instead |
static void |
resolveValueExpressionDatatype(QueryValueExpression valExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype (DataType) of the given value expression. |
static void |
resolveValueExpressionDatatypeRecursively(QueryValueExpression aValueExpr)
Tries to recursively determine and set the datatype (DataType) of the given value expression. |
static void |
resolveValueExpressionDefaultValueDatatype(ValueExpressionDefaultValue aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype of the given "default" value expression. |
static void |
resolveValueExpressionFunctionDatatype(ValueExpressionFunction aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype of the given function value expression. |
static void |
resolveValueExpressionLabeledDurationDatatype(ValueExpressionLabeledDuration aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype of the given labeled duration value expression. |
static void |
resolveValueExpressionListDatatypes(java.util.List aValExprList)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype (DataType) of each of the ValueExpressions in the given list of value expression objects. |
static void |
resolveValueExpressionNullValueDatatype(ValueExpressionNullValue aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype of the given "null" value expression. |
static void |
resolveValueExpressionSimpleDatatype(ValueExpressionSimple aValExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype of the given simple value expression. |
static void |
resolveValueExpressionVariableDatatype(ValueExpressionVariable aVarExpr)
CHECK IMPLEMENTATION! CODE UNTESTED! Tries to determine and set the datatype of the given variable value expression, using the given list of table references. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ValueExpressionHelper()
Method Detail |
public static QueryValueExpression cloneQueryValueExpression(QueryValueExpression valueExpr)
valueExpr
using
EcoreUtil#copy(org.eclipse.emf.ecore.EObject)
.
valueExpr
-
valueExpr
public static void copyDataType(QueryValueExpression aSourceExpr, QueryValueExpression aTargetExpr)
EcoreUtil#copy(org.eclipse.emf.ecore.EObject)
.
The type is not copied if the source expression does not exist or
its datatype is not set.
aSourceExpr
- the value expression whose datatype we want to copyaTargetExpr
- the value expression whose datatype we want to setpublic static DataType copyDataType(DataType dataType)
datatype
using
EcoreUtil#copy(org.eclipse.emf.ecore.EObject)
.
dataType
-
datatype
public static java.util.List getTableNamesFromExpression(QueryValueExpression valueExpr)
public static java.util.List getTableRefsFromExpression(QueryValueExpression valueExpr)
public static java.util.List getColumnsFromSearchCondition(QuerySearchCondition aSearchCond)
aSearchCond
- QuerySearchCondition whose columns we need to get
public static void addExpressionsToList(java.util.List columnList, QueryValueExpression aValueExpr)
aValueExpr
- QueryValueExpression whose columns will be added to the listpublic static java.util.List getColumnsFromValueExpression(QueryValueExpression valueExpr)
valueExpr
- QueryValueExpression whose columns we need to get
public static java.util.List getVEFunctionColumns(ValueExpressionFunction funcExpr)
public static java.util.List getVECombinedColumns(ValueExpressionCombined combined)
public static java.util.List getVECastColumns(ValueExpressionCast aValExpr)
public static java.util.List getVECaseColumns(ValueExpressionCase aValExpr)
aValExpr
- the CASE expression to process
public static java.util.List getVELabeledDurationColumns(ValueExpressionLabeledDuration labeledDurExpr)
public static Column resolveColumnFromValueExpression(ValueExpressionColumn aValExpr)
public static void resolveTablesInValueExpression(QueryValueExpression valExpr, java.util.List tables)
valExpr
- the QueryValueExpression whose table need to be resolvedtables
- List of TableReference tablespublic static void resolveValueExpressionColumnDatatype(ValueExpressionColumn aValExpr)
aValExpr
- a value expression to resolvepublic static void resolveValueExpressionCaseDatatype(ValueExpressionCase aValExpr)
aValExpr
- a value expression to resolvepublic static void resolveValueExpressionCastDatatype(ValueExpressionCast aCastValueExpr)
aCastValueExpr
- a value expression to resolvepublic static void resolveValueExpressionCombined(ValueExpressionCombined aValExpr)
aValExpr
- a value expression to resolvepublic static DataType numericDataTypePromotion(DataType left, DataType right)
left
- right
-
public static DataType resolveCombinedDataType(DataType aDataType, DataType anotherDataType)
aDataType
, if not null
, or
the given anotherDataType
.
Tries to determine the datatype that can contain values of both given
DataType
s aDataType
and
anotherDataType
, useful for example for the result columns
of a QueryCombined
aDataType
- one DataType
anotherDataType
- another DataType
DataType
public static void resolveValueExpressionConcatDatatype(QueryValueExpression aValExpr, QueryValueExpression aLeftValExpr, QueryValueExpression aRightValExpr, java.util.List aTableRefList, Database aDB)
resolveValueExpressionConcatDatatype(QueryValueExpression, QueryValueExpression, QueryValueExpression)
instead
aTableRefList
- the current list of From clause table referencesaDB
- a RDBDatabase object containing datatype informationpublic static void resolveValueExpressionConcatDatatype(QueryValueExpression aValExpr, QueryValueExpression aLeftValExpr, QueryValueExpression aRightValExpr)
public static void resolveValueExpressionDatatype(QueryValueExpression valExpr)
public static void resolveValueExpressionDatatypeRecursively(QueryValueExpression aValueExpr)
aValueExpr
- a value expression to resolvepublic static void resolveValueExpressionDefaultValueDatatype(ValueExpressionDefaultValue aValExpr)
aValExpr
- a value expression to resolvepublic static void resolveValueExpressionFunctionDatatype(ValueExpressionFunction aValExpr)
aValExpr
- a value expression to resolvepublic static void resolveValueExpressionLabeledDurationDatatype(ValueExpressionLabeledDuration aValExpr)
aValExpr
- a value expression to resolvepublic static void resolveValueExpressionListDatatypes(java.util.List aValExprList)
public static void resolveValueExpressionNullValueDatatype(ValueExpressionNullValue aValExpr)
aValExpr
- a value expression to resolvepublic static void resolveValueExpressionSimpleDatatype(ValueExpressionSimple aValExpr)
aValExpr
- a value expression to resolvepublic static void resolveValueExpressionVariableDatatype(ValueExpressionVariable aVarExpr)
aVarExpr
- a value expression to resolve
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |