protected OIdentifier getNextAlias() { OIdentifier result = new OIdentifier(GENERATED_ALIAS_PREFIX + (nextAliasId++)); result.internalAlias = true; return result; }
public OIdentifier getNextAlias() { OIdentifier result = new OIdentifier(GENERATED_ALIAS_PREFIX + (nextAliasId++)); result.internalAlias = true; return result; }
public OIdentifier getDefaultAlias() { return new OIdentifier(String.valueOf(value)); }
public void setAlias(String alias) { boolean found = false; for (OMatchFilterItem item : items) { if (item.alias != null) { item.alias = new OIdentifier(alias); found = true; break; } } if (!found) { OMatchFilterItem newItem = new OMatchFilterItem(-1); newItem.alias = new OIdentifier(alias); items.add(newItem); } }
public OIdentifier getProjectionAlias() { if (alias != null) { return alias; } OIdentifier result; if (all) { result = new OIdentifier("*"); } else { result = expression.getDefaultAlias(); } return result; }
public OIdentifier getDefaultAlias() { OIdentifier identifier; if (isBaseIdentifier()) { identifier = new OIdentifier(((OBaseExpression) mathExpression).identifier.getSuffix().identifier.getStringValue()); } else { identifier = new OIdentifier(this.toString()); } return identifier; }
public static OIdentifier deserialize(OResult fromResult) { OIdentifier identifier = new OIdentifier(-1); identifier.value = fromResult.getProperty("value"); identifier.quoted = fromResult.getProperty("quoted"); return identifier; }
private OSelectStatement buildSelectStatement(String className, OWhereClause oWhereClause) { OSelectStatement stm = new OSelectStatement(-1); stm.whereClause = oWhereClause; stm.target = new OFromClause(-1); stm.target.item = new OFromItem(-1); stm.target.item.identifier = new OIdentifier(className); return stm; }
@Override public void translateLuceneOperator() { if (operator instanceof OLuceneOperator) { OExpression newLeft = new OExpression(-1); newLeft.mathExpression = new OBaseExpression(-1); OBaseIdentifier identifirer = new OBaseIdentifier(-1); ((OBaseExpression) newLeft.mathExpression).identifier = identifirer; identifirer.levelZero = new OLevelZeroIdentifier(-1); OFunctionCall function = new OFunctionCall(-1); identifirer.levelZero.functionCall = function; function.name = new OIdentifier("search_fields"); function.params = new ArrayList<>(); function.params.add(fieldNamesToStrings(left)); function.params.add(right); left = newLeft; operator = new OEqualsCompareOperator(-1); right = new OExpression(-1); right.booleanValue = true; } }
targetClass = new OIdentifier("E"); } else { OClass clazz = db.getMetadata().getSchema().getClassByClusterId(db.getClusterIdByName(targetClusterName.getStringValue())); if (clazz != null) { targetClass = new OIdentifier(clazz.getName()); } else { targetClass = new OIdentifier("E"); handleGlobalLet(result, new OIdentifier("$__ORIENT_CREATE_EDGE_fromV"), leftExpression, ctx, enableProfiling); handleGlobalLet(result, new OIdentifier("$__ORIENT_CREATE_EDGE_toV"), rightExpression, ctx, enableProfiling); new CreateEdgesStep(targetClass, targetClusterName, uniqueIndexName, new OIdentifier("$__ORIENT_CREATE_EDGE_fromV"), new OIdentifier("$__ORIENT_CREATE_EDGE_toV"), wait, retry, batch, ctx, enableProfiling));
info.projectionAfterOrderBy.setItems(new ArrayList<>()); for (String alias : info.projection.getAllAliases()) { info.projectionAfterOrderBy.getItems().add(projectionFromAlias(new OIdentifier(alias)));
public OUpdateExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { OForEachExecutionPlan plan = new OForEachExecutionPlan(ctx); int nextProg = ++FOREACH_VARIABLE_PROGR; if (FOREACH_VARIABLE_PROGR < 0) { FOREACH_VARIABLE_PROGR = 0; } OIdentifier varName = new OIdentifier("$__ORIENTDB_FOREACH_VAR_" + nextProg); plan.chain(new GlobalLetExpressionStep(varName, loopValues, ctx, enableProfiling)); plan.chain(new ForEachStep(loopVariable, new OExpression(varName), statements, ctx, enableProfiling)); return plan; }
private OSelectStatement createSelectStatement(String targetClass, String targetCluster, ORid targetRid, OWhereClause filter) { OSelectStatement prefetchStm = new OSelectStatement(-1); prefetchStm.setWhereClause(filter); OFromClause from = new OFromClause(-1); OFromItem fromItem = new OFromItem(-1); if (targetRid != null) { fromItem.setRids(Collections.singletonList(targetRid)); } else if (targetClass != null) { fromItem.setIdentifier(new OIdentifier(targetClass)); } else if (targetCluster != null) { fromItem.setCluster(new OCluster(targetCluster)); } from.setItem(fromItem); prefetchStm.setTarget(from); return prefetchStm; }
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; }
OProjectionItem newProj = new OProjectionItem(-1); if (item.getAlias() != null) { newProj.setExpression(new OExpression(new OIdentifier(item.getAlias()), item.getModifier())); } else if (item.getRecordAttr() != null) { ORecordAttribute attr = new ORecordAttribute(-1); newProj.setExpression(exp); OIdentifier newAlias = new OIdentifier("_$$$ORDER_BY_ALIAS$$$_" + (nextAliasCount++)); newProj.setAlias(newAlias); item.setAlias(newAlias.getStringValue());
OProjectionItem newItem = new OProjectionItem(-1); newItem.setExpression(exp); OIdentifier groupByAlias = new OIdentifier("_$$$GROUP_BY_ALIAS$$$_" + (i++)); newItem.setAlias(groupByAlias); if (info.preAggregateProjection == null) {
select.getTarget().setItem(new OFromItem(-1)); if (clazz != null) { select.getTarget().getItem().setIdentifier(new OIdentifier(clazz)); } else if (cluster != null) { select.getTarget().getItem().setCluster(new OCluster(cluster));
public OCreateVertexExecutionPlanner(OCreateVertexStatement statement) { this.targetClass = statement.getTargetClass() == null ? null : statement.getTargetClass().copy(); this.targetClusterName = statement.getTargetClusterName() == null ? null : statement.getTargetClusterName().copy(); this.targetCluster = statement.getTargetCluster() == null ? null : statement.getTargetCluster().copy(); if (this.targetClass == null && this.targetCluster == null && this.targetClusterName == null) { this.targetClass = new OIdentifier("V"); } this.insertBody = statement.getInsertBody() == null ? null : statement.getInsertBody().copy(); this.returnStatement = statement.getReturnStatement() == null ? null : statement.getReturnStatement().copy(); }
private OSelectStatement indexChainToStatement(OModifier modifier, OClass clazz, OExpression right, OCommandContext ctx) { OClass queryClass = clazz; OSelectStatement result = new OSelectStatement(-1); result.target = new OFromClause(-1); result.target.setItem(new OFromItem(-1)); result.target.getItem().identifier = new OIdentifier(queryClass.getName()); result.whereClause = new OWhereClause(-1); OBinaryCondition base = new OBinaryCondition(-1); result.whereClause.baseExpression = new ONotBlock(-1); ((ONotBlock) result.whereClause.baseExpression).sub = base; ((ONotBlock) result.whereClause.baseExpression).negate = false; base.left = new OExpression(-1); base.left.mathExpression = new OBaseExpression(-1); ((OBaseExpression) base.left.mathExpression).identifier = new OBaseIdentifier(modifier.suffix.identifier); ((OBaseExpression) base.left.mathExpression).modifier = modifier.next == null ? null : modifier.next.copy(); base.operator = new OEqualsCompareOperator(-1); base.right = right.copy(); return result; } }
public OInsertExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { OInsertExecutionPlan result = new OInsertExecutionPlan(ctx); if (targetIndex != null) { result.chain(new InsertIntoIndexStep(targetIndex, insertBody, ctx, enableProfiling)); } else { if (selectStatement != null) { handleInsertSelect(result, this.selectStatement, ctx, enableProfiling); } else { handleCreateRecord(result, this.insertBody, ctx, enableProfiling); } handleTargetClass(result, targetClass, ctx, enableProfiling); handleSetFields(result, insertBody, ctx, enableProfiling); if (targetCluster != null) { String name = targetCluster.getClusterName(); if (name == null) { name = ctx.getDatabase().getClusterNameById(targetCluster.getClusterNumber()); } handleSave(result, new OIdentifier(name), ctx, enableProfiling); } else { handleSave(result, targetClusterName, ctx, enableProfiling); } handleReturn(result, returnStatement, ctx, enableProfiling); } return result; }