@Override protected void optionalSpace() { int c = getLastChar(); switch ( c ) { case -1: return; case ' ': return; case ')': return; case '(': return; default: out( " " ); } }
@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 ) ); } } } }
@Override protected void endFunctionTemplate(AST node) { FunctionNode functionNode = (FunctionNode) node; SQLFunction sqlFunction = functionNode.getSQLFunction(); if ( sqlFunction == null ) { super.endFunctionTemplate( node ); } else { final Type functionType = functionNode.getFirstArgumentType(); // this function has a registered SQLFunction -> redirect output and catch the arguments FunctionArgumentsCollectingWriter functionArguments = (FunctionArgumentsCollectingWriter) writer; writer = outputStack.removeFirst(); out( sqlFunction.render( functionType, functionArguments.getArgs(), sessionFactory ) ); } }
@Override protected void nestedFromFragment(AST d, AST parent) { // check a set of parent/child nodes in the from-clause tree // to determine if a comma is required between them if ( d != null && hasText( d ) ) { if ( parent != null && hasText( parent ) ) { // again, both should be FromElements FromElement left = (FromElement) parent; FromElement right = (FromElement) d; if ( right.getRealOrigin() == left ) { // right represents a joins originating from left... if ( right.getJoinSequence() != null && right.getJoinSequence().isThetaStyle() ) { writeCrossJoinSeparator(); } else { out( " " ); } } else { // not so sure this is even valid subtree. but if it was, it'd // represent two unrelated table references... writeCrossJoinSeparator(); } } out( d ); } }
@Override protected void optionalSpace() { int c = getLastChar(); switch ( c ) { case -1: return; case ' ': return; case ')': return; case '(': return; default: out( " " ); } }
@Override protected void optionalSpace() { int c = getLastChar(); switch ( c ) { case -1: return; case ' ': return; case ')': return; case '(': return; default: out( " " ); } }
@Override protected void nestedFromFragment(AST d, AST parent) { // check a set of parent/child nodes in the from-clause tree // to determine if a comma is required between them if ( d != null && hasText( d ) ) { if ( parent != null && hasText( parent ) ) { // again, both should be FromElements FromElement left = ( FromElement ) parent; FromElement right = ( FromElement ) d; if ( right.getRealOrigin() == left ) { // right represents a joins originating from left... if ( right.getJoinSequence() != null && right.getJoinSequence().isThetaStyle() ) { out( ", " ); } else { out( " " ); } } else { // not so sure this is even valid subtree. but if it was, it'd // represent two unrelated table references... out( ", " ); } } out( d ); } } }
@Override protected void nestedFromFragment(AST d, AST parent) { // check a set of parent/child nodes in the from-clause tree // to determine if a comma is required between them if ( d != null && hasText( d ) ) { if ( parent != null && hasText( parent ) ) { // again, both should be FromElements FromElement left = ( FromElement ) parent; FromElement right = ( FromElement ) d; if ( right.getRealOrigin() == left ) { // right represents a joins originating from left... if ( right.getJoinSequence() != null && right.getJoinSequence().isThetaStyle() ) { out( ", " ); } else { out( " " ); } } else { // not so sure this is even valid subtree. but if it was, it'd // represent two unrelated table references... out( ", " ); } } out( d ); } } }
@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 ) ); } } } }
@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 ) ); } } } }
@Override protected void endFunctionTemplate(AST node) { FunctionNode functionNode = ( FunctionNode ) node; SQLFunction sqlFunction = functionNode.getSQLFunction(); if ( sqlFunction == null ) { super.endFunctionTemplate( node ); } else { final Type functionType = functionNode.getFirstArgumentType(); // this function has a registered SQLFunction -> redirect output and catch the arguments FunctionArguments functionArguments = ( FunctionArguments ) writer; writer = outputStack.removeFirst(); out( sqlFunction.render( functionType, functionArguments.getArgs(), sessionFactory ) ); } }
@Override protected void endFunctionTemplate(AST node) { FunctionNode functionNode = ( FunctionNode ) node; SQLFunction sqlFunction = functionNode.getSQLFunction(); if ( sqlFunction == null ) { super.endFunctionTemplate( node ); } else { final Type functionType = functionNode.getFirstArgumentType(); // this function has a registered SQLFunction -> redirect output and catch the arguments FunctionArguments functionArguments = ( FunctionArguments ) writer; writer = outputStack.removeFirst(); out( sqlFunction.render( functionType, functionArguments.getArgs(), sessionFactory ) ); } }