private Type prepareLhs() throws SemanticException { FromReferenceNode lhs = getLhs(); lhs.prepareForDot( propertyName ); return getDataType(); }
private Type[] resolveConstructorArgumentTypes() throws SemanticException { SelectExpression[] argumentExpressions = collectSelectExpressions(); if ( argumentExpressions == null ) { // return an empty Type array return new Type[] {}; } Type[] types = new Type[argumentExpressions.length]; for ( int x = 0; x < argumentExpressions.length; x++ ) { types[x] = argumentExpressions[x].getDataType(); } return types; }
@Override protected AST createFromElement(String path, AST alias, AST propertyFetch) throws SemanticException { FromElement fromElement = currentFromClause.addFromElement( path, alias ); fromElement.setAllPropertyFetch( propertyFetch != null ); return fromElement; }
private String[] getColumns() throws QueryException { if ( columns == null ) { // Use the table fromElement and the property name to get the array of column names. String tableAlias = getLhs().getFromElement().getTableAlias(); columns = getFromElement().toColumns( tableAlias, propertyPath, false ); } return columns; }
private FromElement initializeJoin( String path, FromElement destination, JoinSequence joinSequence, String[] columns, FromElement origin, boolean manyToMany) { destination.setType( JOIN_FRAGMENT ); destination.setJoinSequence( joinSequence ); destination.setColumns( columns ); destination.setOrigin( origin, manyToMany ); fromClause.addJoinByPathMap( path, destination ); return destination; }
@SuppressWarnings("SimplifiableIfStatement") private boolean isReturnableEntity(SelectExpression selectExpression) throws SemanticException { FromElement fromElement = selectExpression.getFromElement(); boolean isFetchOrValueCollection = fromElement != null && ( fromElement.isFetch() || fromElement.isCollectionOfValuesOrComponents() ); if ( isFetchOrValueCollection ) { return false; } else { return selectExpression.isReturnableEntity(); } }
private boolean checkSubclassOrSuperclassPropertyReference(FromReferenceNode lhs, String propertyName) { if ( lhs != null && !( lhs instanceof IndexNode ) ) { final FromElement source = lhs.getFromElement(); if ( source != null ) { source.handlePropertyBeingDereferenced( lhs.getDataType(), propertyName ); } } return false; } }
/** * Retrieve this insert statement's select-clause. * * @return The select-clause. */ public SelectClause getSelectClause() { return ( (QueryNode) getIntoClause().getNextSibling() ).getSelectClause(); }
@Override public Type getDataType() { return ( (SelectExpression) getSelectClause().getFirstSelectExpression() ).getDataType(); }
private String collectionTableAlias() { return getFromElement().getCollectionTableAlias() != null ? getFromElement().getCollectionTableAlias() : getFromElement().getTableAlias(); }
/** * Performs detailed semantic validation on this insert statement tree. * * @throws QueryException Indicates validation failure. */ public void validate() throws QueryException { getIntoClause().validateTypes( getSelectClause() ); }
/** * Figure out the type of the binary expression by looking at * the types of the operands. Sometimes we don't know both types, * if, for example, one is a parameter. */ @Override public Type getDataType() { if ( super.getDataType() == null ) { super.setDataType( resolveDataType() ); } return super.getDataType(); }
private static Type extractDataType(Node operand) { if ( operand instanceof SqlNode ) { return ( (SqlNode) operand ).getDataType(); } if ( operand instanceof ExpectedTypeAwareNode ) { return ( (ExpectedTypeAwareNode) operand ).getExpectedType(); } return null; }
private void renderScalarSelects(SelectExpression[] se, FromClause currentFromClause) throws SemanticException { if ( !currentFromClause.isSubQuery() ) { for ( int i = 0; i < se.length; i++ ) { SelectExpression expr = se[i]; expr.setScalarColumn( i ); // Create SQL_TOKEN nodes for the columns. } } }
public void initializeEntity( FromClause fromClause, String className, EntityPersister persister, EntityType type, String classAlias, String tableAlias) { doInitialize( fromClause, tableAlias, className, classAlias, persister, type ); this.sequence = fromClause.nextFromElementCounter(); initialized = true; }
@Override public void setScalarColumn(int i) throws SemanticException { SelectExpression[] selectExpressions = collectSelectExpressions(); // Invoke setScalarColumnText on each constructor argument. for ( int j = 0; j < selectExpressions.length; j++ ) { SelectExpression selectExpression = selectExpressions[j]; selectExpression.setScalarColumn( j ); } }
private void initAliases(SelectExpression[] selectExpressions) { if ( aggregatedSelectExpression == null ) { aliases = new String[selectExpressions.length]; for ( int i = 0; i < selectExpressions.length; i++ ) { aliases[i] = selectExpressions[i].getAlias(); } } else { aliases = aggregatedSelectExpression.getAggregatedAliases(); } }
@Override public void setText(String s) { if ( isResolved() ) { return; } super.setText( s ); }
@Override public void setScalarColumnText(int i) throws SemanticException { SelectExpression[] selectExpressions = collectSelectExpressions(); // Invoke setScalarColumnText on each constructor argument. for ( int j = 0; j < selectExpressions.length; j++ ) { SelectExpression selectExpression = selectExpressions[j]; selectExpression.setScalarColumnText( j ); } }
protected Type extractDataType(Node operand) { Type type = null; if ( operand instanceof SqlNode ) { type = ( (SqlNode) operand ).getDataType(); } if ( type == null && operand instanceof ExpectedTypeAwareNode ) { type = ( (ExpectedTypeAwareNode) operand ).getExpectedType(); } return type; }