public Type getDataType() { return ( (SqlNode) getOperand() ).getDataType(); }
/** * Returns the full path of the node. * * @return the full path of the node. */ @Override public String getPath() { if ( path == null ) { FromReferenceNode lhs = getLhs(); if ( lhs == null ) { path = getText(); } else { SqlNode rhs = (SqlNode) lhs.getNextSibling(); path = lhs.getPath() + "." + rhs.getOriginalText(); } } return path; }
/** * Resolves the left hand side of the DOT. * * @throws SemanticException */ @Override public void resolveFirstChild() throws SemanticException { FromReferenceNode lhs = (FromReferenceNode) getFirstChild(); SqlNode property = (SqlNode) lhs.getNextSibling(); // Set the attributes of the property reference expression. String propName = property.getText(); propertyName = propName; // If the uresolved property path isn't set yet, just use the property name. if ( propertyPath == null ) { propertyPath = propName; } // Resolve the LHS fully, generate implicit joins. Pass in the property name so that the resolver can // discover foreign key (id) properties. lhs.resolve( true, true, null, this ); setFromElement( lhs.getFromElement() ); // The 'from element' that the property is in. checkSubclassOrSuperclassPropertyReference( lhs, propName ); }
if (exprList.getNumberOfChildren() == 4 || (exprList.getNumberOfChildren() == 3 && ast.getType() != HqlSqlTokenTypes.IDENT)) { Statement[] args = new Statement[exprList.getNumberOfChildren()]; for (int i = 0; i < args.length; i++) { args[i] = generateExpression(traverser, dotNodeResolver, containingMethod);
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; }
/** * Returns the full path of the node. * * @return the full path of the node. */ @Override public String getPath() { if ( path == null ) { FromReferenceNode lhs = getLhs(); if ( lhs == null ) { path = getText(); } else { SqlNode rhs = ( SqlNode ) lhs.getNextSibling(); path = lhs.getPath() + "." + rhs.getOriginalText(); } } return path; }
/** * Resolves the left hand side of the DOT. * * @throws SemanticException */ @Override public void resolveFirstChild() throws SemanticException { FromReferenceNode lhs = ( FromReferenceNode ) getFirstChild(); SqlNode property = ( SqlNode ) lhs.getNextSibling(); // Set the attributes of the property reference expression. String propName = property.getText(); propertyName = propName; // If the uresolved property path isn't set yet, just use the property name. if ( propertyPath == null ) { propertyPath = propName; } // Resolve the LHS fully, generate implicit joins. Pass in the property name so that the resolver can // discover foreign key (id) properties. lhs.resolve( true, true, null, this ); setFromElement( lhs.getFromElement() ); // The 'from element' that the property is in. checkSubclassOrSuperclassPropertyReference( lhs, propName ); }
private static Type extractDataType(Node operand) { if ( operand instanceof SqlNode ) { return ( (SqlNode) operand ).getDataType(); } if ( operand instanceof ExpectedTypeAwareNode ) { return ( (ExpectedTypeAwareNode) operand ).getExpectedType(); } return null; }
/** * Returns the full path of the node. * * @return the full path of the node. */ @Override public String getPath() { if ( path == null ) { FromReferenceNode lhs = getLhs(); if ( lhs == null ) { path = getText(); } else { SqlNode rhs = ( SqlNode ) lhs.getNextSibling(); path = lhs.getPath() + "." + rhs.getOriginalText(); } } return path; }
/** * Resolves the left hand side of the DOT. * * @throws SemanticException */ @Override public void resolveFirstChild() throws SemanticException { FromReferenceNode lhs = ( FromReferenceNode ) getFirstChild(); SqlNode property = ( SqlNode ) lhs.getNextSibling(); // Set the attributes of the property reference expression. String propName = property.getText(); propertyName = propName; // If the uresolved property path isn't set yet, just use the property name. if ( propertyPath == null ) { propertyPath = propName; } // Resolve the LHS fully, generate implicit joins. Pass in the property name so that the resolver can // discover foreign key (id) properties. lhs.resolve( true, true, null, this ); setFromElement( lhs.getFromElement() ); // The 'from element' that the property is in. checkSubclassOrSuperclassPropertyReference( lhs, propName ); }
public Type getFirstArgumentType() { AST argument = getFirstChild(); while ( argument != null ) { if ( argument instanceof SqlNode ) { final Type type = ( (SqlNode) argument ).getDataType(); if ( type != null ) { return type; } argument = argument.getNextSibling(); } } return null; }
@Override public Type getFirstArgumentType() { AST argument = getFirstChild(); while ( argument != null ) { if ( argument instanceof SqlNode ) { final Type type = ( (SqlNode) argument ).getDataType(); if ( type != null ) { return type; } argument = argument.getNextSibling(); } } return null; }
public Type findFunctionReturnType(String functionName, SQLFunction sqlFunction, AST firstArgument) { // determine the type of the first argument... Type argumentType = null; if ( firstArgument != null ) { if ( "cast".equals( functionName ) ) { argumentType = sfi.getTypeResolver().heuristicType( firstArgument.getNextSibling().getText() ); } else if ( SqlNode.class.isInstance( firstArgument ) ) { argumentType = ( (SqlNode) firstArgument ).getDataType(); } } return sqlFunction.getReturnType( argumentType, sfi ); }
private void collectionProperty(AST path, AST name) throws SemanticException { if ( path == null ) { throw new SemanticException( "Collection function " + name.getText() + " has no path!" ); } SqlNode expr = (SqlNode) path; Type type = expr.getDataType(); LOG.debugf( "collectionProperty() : name=%s type=%s", name, type ); resolveCollectionProperty( expr ); }
final Node rhs = getRightHandOperand(); final Type lhType = ( lhs instanceof SqlNode ) ? ( (SqlNode) lhs ).getDataType() : null; final Type rhType = ( rhs instanceof SqlNode ) ? ( (SqlNode) rhs ).getDataType() : null;
expectedType = ( (SqlNode) fixture ).getDataType(); expectedType = ( (SqlNode) low ).getDataType(); expectedType = ( (SqlNode) high ).getDataType();
final Type lhType = ( lhs instanceof SqlNode ) ? ( (SqlNode) lhs ).getDataType() : null; final Type rhType = ( rhs instanceof SqlNode ) ? ( (SqlNode) rhs ).getDataType() : null;
@Override public Type getDataType() { // option is used to hold each WHEN/ELSE in turn AST option = getFirstChild(); while ( option != null ) { final AST result; if ( option.getType() == HqlSqlTokenTypes.WHEN ) { result = option.getFirstChild().getNextSibling(); } else if ( option.getType() == HqlSqlTokenTypes.ELSE ) { result = option.getFirstChild(); } else { throw new QueryException( "Unexpected node type :" + ASTUtil.getTokenTypeName( HqlSqlTokenTypes.class, option.getType() ) + "; expecting WHEN or ELSE" ); } if ( SqlNode.class.isInstance( result ) ) { final Type nodeDataType = ( (SqlNode) result ).getDataType(); if ( nodeDataType != null ) { return nodeDataType; } } option = option.getNextSibling(); } return null; }
public Type getDataType() { final AST expression = getFirstChild(); // option is used to hold each WHEN/ELSE in turn AST option = expression.getNextSibling(); while ( option != null ) { final AST result; if ( option.getType() == HqlSqlTokenTypes.WHEN ) { result = option.getFirstChild().getNextSibling(); } else if ( option.getType() == HqlSqlTokenTypes.ELSE ) { result = option.getFirstChild(); } else { throw new QueryException( "Unexpected node type :" + ASTUtil.getTokenTypeName( HqlSqlTokenTypes.class, option.getType() ) + "; expecting WHEN or ELSE" ); } if ( SqlNode.class.isInstance( result ) ) { final Type nodeDataType = ( (SqlNode) result ).getDataType(); if ( nodeDataType != null ) { return nodeDataType; } } option = option.getNextSibling(); } return null; }
Type lhsType = ( (SqlNode) lhs ).getDataType(); AST inListChild = inList.getFirstChild(); while ( inListChild != null ) {