private void validateStatement(OSelectStatement statement) { if (statement.getProjection() != null) { if (statement.getProjection().getItems().size() > 1) { throw new OCommandExecutionException("Projections cannot be used in live query " + statement); } else if (statement.getProjection().getItems().get(0).isAll()) { throw new OCommandExecutionException("Projections cannot be used in live query " + statement); } } if (statement.getTarget().getItem().getIdentifier() == null && statement.getTarget().getItem().getRids() == null) { throw new OCommandExecutionException("Live queries can only be executed against a Class or on RIDs" + statement); } if (statement.getOrderBy() != null) { throw new OCommandExecutionException("Live queries do not support ORDER BY " + statement); } if (statement.getGroupBy() != null) { throw new OCommandExecutionException("Live queries do not support GROUP BY " + statement); } if (statement.getSkip() != null || statement.getLimit() != null) { throw new OCommandExecutionException("Live queries do not support SKIP/LIMIT " + statement); } }
private void init() { //copying the content, so that it can be manipulated and optimized info = new QueryPlanningInfo(); info.projection = this.statement.getProjection() == null ? null : this.statement.getProjection().copy(); info.projection = translateDistinct(info.projection); info.distinct = info.projection == null ? false : info.projection.isDistinct(); if (info.projection != null) { info.projection.setDistinct(false); } info.target = this.statement.getTarget(); info.whereClause = this.statement.getWhereClause() == null ? null : this.statement.getWhereClause().copy(); info.whereClause = translateLucene(info.whereClause); info.perRecordLetClause = this.statement.getLetClause() == null ? null : this.statement.getLetClause().copy(); info.groupBy = this.statement.getGroupBy() == null ? null : this.statement.getGroupBy().copy(); info.orderBy = this.statement.getOrderBy() == null ? null : this.statement.getOrderBy().copy(); info.unwind = this.statement.getUnwind() == null ? null : this.statement.getUnwind().copy(); info.skip = this.statement.getSkip(); info.limit = this.statement.getLimit(); info.lockRecord = this.statement.getLockRecord(); }