return rtn; else if ( operand.getType() == HqlSqlTokenTypes.VECTOR_EXPR ) { String[] rtn = new String[operand.getNumberOfChildren()]; int x = 0; AST node = operand.getFirstChild(); while ( node != null ) { rtn[x++] = node.getText(); String nodeText = operand.getText(); if ( nodeText.startsWith( "(" ) ) { nodeText = nodeText.substring( 1 );
if ( expressionType != null ) { if ( expressionType.isEntityType() ) { throw new QueryException( "Expression to CAST cannot be an entity : " + expressionNode.getText() ); throw new QueryException( "Expression to CAST cannot be a composite : " + expressionNode.getText() ); throw new QueryException( "Expression to CAST cannot be a collection : " + expressionNode.getText() ); this.typeNode = (IdentNode) expressionNode.getNextSibling(); if ( typeNode == null ) { throw new QueryException( "Could not resolve requested type for CAST" ); throw new QueryException( "CAST target type cannot be an entity : " + expressionNode.getText() ); throw new QueryException( "CAST target type cannot be a composite : " + expressionNode.getText() ); throw new QueryException( "CAST target type cannot be a collection : " + expressionNode.getText() );
@Override protected void out(AST n) { if ( n instanceof Node ) { out( ( (Node) n ).getRenderText( sessionFactory ) ); } else { super.out( n ); } if ( n instanceof ParameterNode ) { collectedParameters.add( ( (ParameterNode) n ).getHqlParameterSpecification() ); } else if ( n instanceof ParameterContainer ) { if ( ( (ParameterContainer) n ).hasEmbeddedParameters() ) { ParameterSpecification[] specifications = ( (ParameterContainer) n ).getEmbeddedParameters(); if ( specifications != null ) { collectedParameters.addAll( Arrays.asList( specifications ) ); } } } }
AST inListChild = inList.getFirstChild(); while ( inListChild != null ) { if ( ExpectedTypeAwareNode.class.isAssignableFrom( inListChild.getClass() ) ) { final Node rhsNode = (Node) inList.getFirstChild(); if ( !isNodeAcceptable( rhsNode ) ) { return; else if ( rhsNode.getType() == HqlTokenTypes.VECTOR_EXPR ) { rhsColumnSpan = rhsNode.getNumberOfChildren();
lhsColumnSpan ); Node rhsNode = (Node) getInList().getFirstChild(); if ( rhsNode != null && rhsNode.getNextSibling() == null ) { ); andElementsNodeList.add( group ); rhsNode = (Node) rhsNode.getNextSibling();
public void setText(String s) { super.setText( s ); if ( s != null && s.length() > 0 && originalText == null ) { originalText = s; } }
/** * Retrieve the text to be used for rendering this particular node. * * @param sessionFactory The session factory * @return The text to use for rendering */ public String getRenderText(SessionFactoryImplementor sessionFactory) { // The basic implementation is to simply use the node's text return getText(); }
/** * this is possible for parameter lists and explicit lists. It is completely unreasonable for sub-queries. */ private boolean isNodeAcceptable(Node rhsNode) { return rhsNode == null /* empty IN list */ || rhsNode instanceof LiteralNode || rhsNode instanceof ParameterNode || rhsNode.getType() == HqlTokenTypes.VECTOR_EXPR; }
public static AST createAST(int type, String text, AST ... childAsts) { AST ast = new Node(); ast.setType(type); ast.setText(text); for (AST childAst : childAsts) { if (childAst != null) { ast.addChild(childAst); } } return ast; }
AST inListChild = inList.getFirstChild(); while ( inListChild != null ) { if ( ExpectedTypeAwareNode.class.isAssignableFrom( inListChild.getClass() ) ) { return; int lhsColumnSpan = lhsType.getColumnSpan( sessionFactory ); Node rhsNode = (Node) inList.getFirstChild(); if ( !isNodeAcceptable( rhsNode ) ) return; int rhsColumnSpan = 0; if ( rhsNode.getType() == HqlTokenTypes.VECTOR_EXPR ) { rhsColumnSpan = rhsNode.getNumberOfChildren(); } else { Type rhsType = extractDataType( rhsNode );
String[] lhsElementTexts = extractMutationTexts( getLeftHandOperand(), lhsColumnSpan ); Node rhsNode = (Node) getInList().getFirstChild(); if ( rhsNode != null && rhsNode.getNextSibling() == null ) { String[] rhsElementTexts = extractMutationTexts( rhsNode, rhsColumnSpan ); rhsEmbeddedCompositeParameterSpecification, and ); andElementsNodeList.add( and ); rhsNode = (Node) rhsNode.getNextSibling();
@Override public void setText(String s) { // for some reason the antlr.CommonAST initialization routines force // this method to get called twice. The first time with an empty string if ( StringHelper.isNotEmpty( s ) ) { constantExpression = s; constantValue = ReflectHelper.getConstantValue( s, factory ); heuristicType = factory.getTypeResolver().heuristicType( constantValue.getClass().getName() ); super.setText( s ); } }
/** * Retrieve the text to be used for rendering this particular node. * * @param sessionFactory The session factory * @return The text to use for rendering */ public String getRenderText(SessionFactoryImplementor sessionFactory) { // The basic implementation is to simply use the node's text return getText(); }
/** * this is possible for parameter lists and explicit lists. It is completely unreasonable for sub-queries. */ private boolean isNodeAcceptable( Node rhsNode ) { return rhsNode instanceof LiteralNode || rhsNode instanceof ParameterNode || rhsNode.getType() == HqlTokenTypes.VECTOR_EXPR; } /**
else if ( operand.getType() == HqlSqlTokenTypes.VECTOR_EXPR ) { final String[] rtn = new String[ operand.getNumberOfChildren() ]; AST node = operand.getFirstChild(); int x = 0; while ( node != null ) { String nodeText = operand.getText(); if ( nodeText.startsWith( "(" ) ) { nodeText = nodeText.substring( 1 );
AST inListChild = inList.getFirstChild(); while ( inListChild != null ) { if ( ExpectedTypeAwareNode.class.isAssignableFrom( inListChild.getClass() ) ) { return; int lhsColumnSpan = lhsType.getColumnSpan( sessionFactory ); Node rhsNode = (Node) inList.getFirstChild(); if ( !isNodeAcceptable( rhsNode ) ) return; int rhsColumnSpan = 0; if ( rhsNode.getType() == HqlTokenTypes.VECTOR_EXPR ) { rhsColumnSpan = rhsNode.getNumberOfChildren(); } else { Type rhsType = extractDataType( rhsNode );
String[] lhsElementTexts = extractMutationTexts( getLeftHandOperand(), lhsColumnSpan ); Node rhsNode = (Node) getInList().getFirstChild(); if ( rhsNode != null && rhsNode.getNextSibling() == null ) { String[] rhsElementTexts = extractMutationTexts( rhsNode, rhsColumnSpan ); rhsEmbeddedCompositeParameterSpecification, and ); andElementsNodeList.add( and ); rhsNode = (Node) rhsNode.getNextSibling();
public void setText(String s) { super.setText( s ); if ( s != null && s.length() > 0 && originalText == null ) { originalText = s; } }
/** * Retrieve the text to be used for rendering this particular node. * * @param sessionFactory The session factory * @return The text to use for rendering */ public String getRenderText(SessionFactoryImplementor sessionFactory) { // The basic implementation is to simply use the node's text return getText(); }
/** * this is possible for parameter lists and explicit lists. It is completely unreasonable for sub-queries. */ private boolean isNodeAcceptable( Node rhsNode ) { return rhsNode instanceof LiteralNode || rhsNode instanceof ParameterNode || rhsNode.getType() == HqlTokenTypes.VECTOR_EXPR; } /**