private void handleReturn(ODeleteExecutionPlan result, OCommandContext ctx, boolean returnBefore, boolean profilingEnabled) { if (!returnBefore) { result.chain(new CountStep(ctx, profilingEnabled)); } }
public ODeleteExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { ODeleteEdgeExecutionPlanner planner = new ODeleteEdgeExecutionPlanner(this); ODeleteExecutionPlan result = planner.createExecutionPlan(ctx, enableProfiling); result.setStatement(this.originalStatement); return result; }
@Override public OResultSet execute(ODatabase db, Object[] args, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); Map<Object, Object> params = new HashMap<>(); if (args != null) { for (int i = 0; i < args.length; i++) { params.put(i, args[i]); } } ctx.setInputParameters(params); ODeleteExecutionPlan executionPlan = createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }
public ODeleteExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { ODeleteExecutionPlan result = new ODeleteExecutionPlan(ctx); if (handleIndexAsTarget(result, fromClause.getItem().getIndex(), whereClause, ctx)) { if (limit != null) { throw new OCommandExecutionException("Cannot apply a LIMIT on a delete from index"); } if (returnBefore) { throw new OCommandExecutionException("Cannot apply a RETURN BEFORE on a delete from index"); } } else { handleTarget(result, ctx, this.fromClause, this.whereClause, enableProfiling); handleLimit(result, ctx, this.limit, enableProfiling); } handleCastToVertex(result, ctx, enableProfiling); handleDelete(result, ctx, enableProfiling); handleReturn(result, ctx, this.returnBefore, enableProfiling); return result; }
@Override public OResultSet execute(ODatabase db, Object[] args, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); Map<Object, Object> params = new HashMap<>(); if (args != null) { for (int i = 0; i < args.length; i++) { params.put(i, args[i]); } } ctx.setInputParameters(params); ODeleteExecutionPlan executionPlan = createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }
public ODeleteExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { ODeleteExecutionPlan result = new ODeleteExecutionPlan(ctx); if (handleIndexAsTarget(result, fromClause.getItem().getIndex(), whereClause, ctx,enableProfiling)) { if (limit != null) { throw new OCommandExecutionException("Cannot apply a LIMIT on a delete from index"); } if (unsafe) { throw new OCommandExecutionException("Cannot apply a UNSAFE on a delete from index"); } if (returnBefore) { throw new OCommandExecutionException("Cannot apply a RETURN BEFORE on a delete from index"); } handleReturn(result, ctx, this.returnBefore, enableProfiling); } else { handleTarget(result, ctx, this.fromClause, this.whereClause, enableProfiling); handleUnsafe(result, ctx, this.unsafe, enableProfiling); handleLimit(result, ctx, this.limit, enableProfiling); handleDelete(result, ctx, enableProfiling); handleReturn(result, ctx, this.returnBefore, enableProfiling); } return result; }
private void handleUnsafe(ODeleteExecutionPlan result, OCommandContext ctx, boolean unsafe, boolean profilingEnabled) { if (!unsafe) { result.chain(new CheckSafeDeleteStep(ctx, profilingEnabled)); } }
@Override public OResultSet execute(ODatabase db, Map params, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); ctx.setInputParameters(params); ODeleteExecutionPlan executionPlan = createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }
public ODeleteExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { ODeleteVertexExecutionPlanner planner = new ODeleteVertexExecutionPlanner(this); ODeleteExecutionPlan result = planner.createExecutionPlan(ctx, enableProfiling); result.setStatement(this.originalStatement); return result; }
public ODeleteExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { ODeleteExecutionPlan result = new ODeleteExecutionPlan(ctx); if (leftExpression != null || rightExpression != null) { handleGlobalLet(result, new OIdentifier("$__ORIENT_DELETE_EDGE_fromV"), leftExpression, ctx, enableProfiling); handleGlobalLet(result, new OIdentifier("$__ORIENT_DELETE_EDGE_toV"), rightExpression, ctx, enableProfiling); handleFetchFromTo(result, ctx, "$__ORIENT_DELETE_EDGE_fromV", "$__ORIENT_DELETE_EDGE_toV", className, targetClusterName, enableProfiling); handleWhere(result, ctx, whereClause, enableProfiling); } else if (whereClause != null) { OFromClause fromClause = new OFromClause(-1); OFromItem item = new OFromItem(-1); if (className == null) { item.setIdentifier(new OIdentifier("E")); } else { item.setIdentifier(className); } fromClause.setItem(item); handleTarget(result, ctx, fromClause, this.whereClause, enableProfiling); } else { handleTargetClass(result, ctx, className, enableProfiling); handleTargetCluster(result, ctx, targetClusterName, enableProfiling); handleTargetRids(result, ctx, rids, enableProfiling); } handleLimit(result, ctx, this.limit, enableProfiling); handleCastToEdge(result, ctx, enableProfiling); handleDelete(result, ctx, enableProfiling); handleReturn(result, ctx, enableProfiling); return result; }
private void handleUnsafe(ODeleteExecutionPlan result, OCommandContext ctx, boolean unsafe, boolean profilingEnabled) { if (!unsafe) { result.chain(new CheckSafeDeleteStep(ctx, profilingEnabled)); } }
@Override public OResultSet execute(ODatabase db, Map params, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); ctx.setInputParameters(params); ODeleteExecutionPlan executionPlan = createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }
public ODeleteExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { ODeleteExecutionPlanner planner = new ODeleteExecutionPlanner(this); ODeleteExecutionPlan result = planner.createExecutionPlan(ctx, enableProfiling); result.setStatement(this.originalStatement); return result; }
private void handleReturn(ODeleteExecutionPlan result, OCommandContext ctx, boolean returnBefore, boolean profilingEnabled) { if (!returnBefore) { result.chain(new CountStep(ctx, profilingEnabled)); } }
@Override public OResultSet execute(ODatabase db, Map params, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); ctx.setInputParameters(params); ODeleteExecutionPlan executionPlan = createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }
private void handleWhere(ODeleteExecutionPlan result, OCommandContext ctx, OWhereClause whereClause, boolean profilingEnabled) { if (whereClause != null) { result.chain(new FilterStep(whereClause, ctx, profilingEnabled)); } }
@Override public OResultSet syncPull(OCommandContext ctx, int nRecords) throws OTimeoutException { if (!executed) { if (plan instanceof OInsertExecutionPlan) { ((OInsertExecutionPlan) plan).executeInternal(); } else if (plan instanceof ODeleteExecutionPlan) { ((ODeleteExecutionPlan) plan).executeInternal(); } else if (plan instanceof OUpdateExecutionPlan) { ((OUpdateExecutionPlan) plan).executeInternal(); } else if (plan instanceof ODDLExecutionPlan) { ((ODDLExecutionPlan) plan).executeInternal((OBasicCommandContext) ctx); } else if (plan instanceof OSingleOpExecutionPlan) { ((OSingleOpExecutionPlan) plan).executeInternal((OBasicCommandContext) ctx); } executed = true; } return plan.fetchNext(nRecords); }
private void handleFetchFromTo(ODeleteExecutionPlan result, OCommandContext ctx, String fromAlias, String toAlias, OIdentifier targetClass, OIdentifier targetCluster, boolean profilingEnabled) { if (fromAlias != null && toAlias != null) { result.chain(new FetchEdgesFromToVerticesStep(fromAlias, toAlias, targetClass, targetCluster, ctx, profilingEnabled)); } else if (toAlias != null) { result.chain(new FetchEdgesToVerticesStep(toAlias, targetClass, targetCluster, ctx, profilingEnabled)); } }
private void handleGlobalLet(ODeleteExecutionPlan result, OIdentifier name, OExpression expression, OCommandContext ctx, boolean profilingEnabled) { if (expression != null) { result.chain(new GlobalLetExpressionStep(name, expression, ctx, profilingEnabled)); } } }
private void handleCastToEdge(ODeleteExecutionPlan plan, OCommandContext ctx, boolean profilingEnabled) { plan.chain(new CastToEdgeStep(ctx, profilingEnabled)); }