@Override public final boolean hasWhereClause() { AST whereClause = locateWhereClause(); return whereClause != null && whereClause.getNumberOfChildren() > 0; }
/** * Interprets the {@code WHERE} clause from the user-defined update/delete query * * @param whereClause The user-defined {@code WHERE} clause * * @return The bulk-id-ready {@code WHERE} clause representation */ @SuppressWarnings("unchecked") protected ProcessedWhereClause processWhereClause(AST whereClause) { if ( whereClause.getNumberOfChildren() != 0 ) { // If a where clause was specified in the update/delete query, use it to limit the // ids that will be returned and inserted into the id table... try { SqlGenerator sqlGenerator = new SqlGenerator( sessionFactory ); sqlGenerator.whereClause( whereClause ); String userWhereClause = sqlGenerator.getSQL().substring( 7 ); // strip the " where " List<ParameterSpecification> idSelectParameterSpecifications = sqlGenerator.getCollectedParameters(); return new ProcessedWhereClause( userWhereClause, idSelectParameterSpecifications ); } catch ( RecognitionException e ) { throw new HibernateException( "Unable to generate id select for DML operation", e ); } } else { return ProcessedWhereClause.NO_WHERE_CLAUSE; } }
); if ( statement.getWhereClause().getNumberOfChildren() == 0 ) { statement.getWhereClause().setFirstChild( discrimNode );
if ( type == EQ || type == NE ) { boolean negated = type == NE; if ( x.getNumberOfChildren() == 2 ) { AST a = x.getFirstChild(); AST b = a.getNextSibling();
boolean explicitSelect = select != null && select.getNumberOfChildren() > 0;
/** * @see RestrictableStatement#hasWhereClause */ public final boolean hasWhereClause() { AST whereClause = locateWhereClause(); return whereClause != null && whereClause.getNumberOfChildren() > 0; }
/** * @see RestrictableStatement#hasWhereClause */ public final boolean hasWhereClause() { AST whereClause = locateWhereClause(); return whereClause != null && whereClause.getNumberOfChildren() > 0; }
/** * @see RestrictableStatement#hasWhereClause */ public final boolean hasWhereClause() { AST whereClause = locateWhereClause(); return whereClause != null && whereClause.getNumberOfChildren() > 0; }
/** * Returns an array of SelectExpressions gathered from the children of the given parent AST node. * * @return an array of SelectExpressions gathered from the children of the given parent AST node. */ public SelectExpression[] collectSelectExpressions() { // Get the first child to be considered. Sub-classes may do this differently in order to skip nodes that // are not select expressions (e.g. DISTINCT). AST firstChild = getFirstSelectExpression(); AST parent = this; ArrayList list = new ArrayList( parent.getNumberOfChildren() ); for ( AST n = firstChild; n != null; n = n.getNextSibling() ) { if ( n instanceof SelectExpression ) { list.add( n ); } else { throw new IllegalStateException( "Unexpected AST: " + n.getClass().getName() + " " + new ASTPrinter( SqlTokenTypes.class ).showAsString( n, "" ) ); } } return ( SelectExpression[] ) list.toArray( new SelectExpression[list.size()] ); }
/** * Returns an array of SelectExpressions gathered from the children of the given parent AST node. * * @return an array of SelectExpressions gathered from the children of the given parent AST node. */ public SelectExpression[] collectSelectExpressions() { // Get the first child to be considered. Sub-classes may do this differently in order to skip nodes that // are not select expressions (e.g. DISTINCT). AST firstChild = getFirstSelectExpression(); AST parent = this; ArrayList list = new ArrayList( parent.getNumberOfChildren() ); for ( AST n = firstChild; n != null; n = n.getNextSibling() ) { if ( n instanceof SelectExpression ) { list.add( n ); } else { throw new IllegalStateException( "Unexpected AST: " + n.getClass().getName() + " " + new ASTPrinter( SqlTokenTypes.class ).showAsString( n, "" ) ); } } return ( SelectExpression[] ) list.toArray( new SelectExpression[list.size()] ); }
/** * Returns an array of SelectExpressions gathered from the children of the given parent AST node. * * @return an array of SelectExpressions gathered from the children of the given parent AST node. */ SelectExpression[] collectSelectExpressions() { // Get the first child to be considered. Sub-classes may do this differently in order to skip nodes that // are not select expressions (e.g. DISTINCT). AST firstChild = getFirstSelectExpression(); AST parent = this; ArrayList list = new ArrayList( parent.getNumberOfChildren() ); for ( AST n = firstChild; n != null; n = n.getNextSibling() ) { if ( n instanceof SelectExpression ) { list.add( n ); } else { throw new IllegalStateException( "Unexpected AST: " + n.getClass().getName() + " " + new ASTPrinter( SqlTokenTypes.class ).showAsString( n, "" ) ); } } return ( SelectExpression[] ) list.toArray( new SelectExpression[list.size()] ); }
/** * Returns an array of SelectExpressions gathered from the children of the given parent AST node. * * @return an array of SelectExpressions gathered from the children of the given parent AST node. */ public SelectExpression[] collectSelectExpressions() { // Get the first child to be considered. Sub-classes may do this differently in order to skip nodes that // are not select expressions (e.g. DISTINCT). AST firstChild = getFirstSelectExpression(); AST parent = this; ArrayList list = new ArrayList( parent.getNumberOfChildren() ); for ( AST n = firstChild; n != null; n = n.getNextSibling() ) { if ( n instanceof SelectExpression ) { list.add( n ); } else { throw new IllegalStateException( "Unexpected AST: " + n.getClass().getName() + " " + new ASTPrinter( SqlTokenTypes.class ).showAsString( n, "" ) ); } } return ( SelectExpression[] ) list.toArray( new SelectExpression[list.size()] ); }
if ( statement.getWhereClause().getNumberOfChildren() == 0 ) { statement.getWhereClause().setFirstChild( discrimNode );
); if ( statement.getWhereClause().getNumberOfChildren() == 0 ) { statement.getWhereClause().setFirstChild( discrimNode );
); if ( statement.getWhereClause().getNumberOfChildren() == 0 ) { statement.getWhereClause().setFirstChild( discrimNode );
if ( type == EQ || type == NE ) { boolean negated = type == NE; if ( x.getNumberOfChildren() == 2 ) { AST a = x.getFirstChild(); AST b = a.getNextSibling();
if ( type == EQ || type == NE ) { boolean negated = type == NE; if ( x.getNumberOfChildren() == 2 ) { AST a = x.getFirstChild(); AST b = a.getNextSibling();
if ( whereClause.getNumberOfChildren() != 0 ) {
if ( type == EQ || type == NE ) { boolean negated = type == NE; if ( x.getNumberOfChildren() == 2 ) { AST a = x.getFirstChild(); AST b = a.getNextSibling();
if ( type == EQ || type == NE ) { boolean negated = type == NE; if ( x.getNumberOfChildren() == 2 ) { AST a = x.getFirstChild(); AST b = a.getNextSibling();