private static Context clone(Context orig, Context parent) { Context myParent = null; if (parent == null) { Context origParent = orig.getParent(); if (origParent != null) myParent = clone(orig.getParent(), null); } else myParent = parent; Context newCtx = new Context(orig.parsed, null, myParent); newCtx.from = orig.from; newCtx.meta = orig.meta; newCtx.schemaAlias = orig.schemaAlias; newCtx.setSchemas(orig.getSchemas()); newCtx.setVariables(orig.getVariables()); newCtx.cloneFrom = orig; Object select = orig.getSelect(); if (select != null) newCtx.setSelect(((SelectImpl)select).clone(newCtx)); newCtx.subquery = orig.subquery; List<Context> subsels = orig.getSubselContexts(); if (subsels != null) { for (Context subsel : subsels) newCtx.addSubselContext(clone(subsel, newCtx)); } return newCtx; } }
private static Context clone(Context orig, Context parent) { Context myParent = null; if (parent == null) { Context origParent = orig.getParent(); if (origParent != null) myParent = clone(orig.getParent(), null); } else myParent = parent; Context newCtx = new Context(orig.parsed, null, myParent); newCtx.from = orig.from; newCtx.meta = orig.meta; newCtx.schemaAlias = orig.schemaAlias; newCtx.setSchemas(orig.getSchemas()); newCtx.setVariables(orig.getVariables()); newCtx.cloneFrom = orig; Object select = orig.getSelect(); if (select != null) newCtx.setSelect(((SelectImpl)select).clone(newCtx)); newCtx.subquery = orig.subquery; List<Context> subsels = orig.getSubselContexts(); if (subsels != null) { for (Context subsel : subsels) newCtx.addSubselContext(clone(subsel, newCtx)); } return newCtx; } }
private static Context clone(Context orig, Context parent) { Context myParent = null; if (parent == null) { Context origParent = orig.getParent(); if (origParent != null) myParent = clone(orig.getParent(), null); } else myParent = parent; Context newCtx = new Context(orig.parsed, null, myParent); newCtx.from = orig.from; newCtx.meta = orig.meta; newCtx.schemaAlias = orig.schemaAlias; newCtx.setSchemas(orig.getSchemas()); newCtx.setVariables(orig.getVariables()); newCtx.cloneFrom = orig; Object select = orig.getSelect(); if (select != null) newCtx.setSelect(((SelectImpl)select).clone(newCtx)); newCtx.subquery = orig.subquery; List<Context> subsels = orig.getSubselContexts(); if (subsels != null) { for (Context subsel : subsels) newCtx.addSubselContext(clone(subsel, newCtx)); } return newCtx; } }
private static Context clone(Context orig, Context parent) { Context myParent = null; if (parent == null) { Context origParent = orig.getParent(); if (origParent != null) myParent = clone(orig.getParent(), null); } else myParent = parent; Context newCtx = new Context(orig.parsed, null, myParent); newCtx.from = orig.from; newCtx.meta = orig.meta; newCtx.schemaAlias = orig.schemaAlias; newCtx.setSchemas(orig.getSchemas()); newCtx.setVariables(orig.getVariables()); newCtx.cloneFrom = orig; Object select = orig.getSelect(); if (select != null) newCtx.setSelect(((SelectImpl)select).clone(newCtx)); newCtx.subquery = orig.subquery; List<Context> subsels = orig.getSubselContexts(); if (subsels != null) { for (Context subsel : subsels) newCtx.addSubselContext(clone(subsel, newCtx)); } return newCtx; } }
/** * Adds a join condition to the given expression. * * @param node the node to check * @param inner whether or not the join should be an inner join * @param exp an existing expression to AND, or null if none * @return the Expression with the join condition added */ private Expression addJoin(JPQLNode node, boolean inner, Expression exp) { // the type will be the declared type for the field JPQLNode firstChild = firstChild(node); Path path = null; if (firstChild.id == JJTQUALIFIEDPATH) path = (Path) getQualifiedPath(firstChild); else path = getPath(firstChild, false, inner); JPQLNode alias = node.getChildCount() >= 2 ? right(node) : null; // OPENJPA-15 support subquery's from clause do not start with // identification_variable_declaration() if (inner && ctx().getParent() != null && ctx().schemaAlias == null) { return getSubquery(alias.text, path, exp); } return addJoin(path, alias, exp); }
/** * Adds a join condition to the given expression. * * @param node the node to check * @param inner whether or not the join should be an inner join * @param exp an existing expression to AND, or null if none * @return the Expression with the join condition added */ private Expression addJoin(JPQLNode node, boolean inner, Expression exp) { // the type will be the declared type for the field JPQLNode firstChild = firstChild(node); Path path = null; if (firstChild.id == JJTQUALIFIEDPATH) path = (Path) getQualifiedPath(firstChild); else path = getPath(firstChild, false, inner); JPQLNode alias = node.getChildCount() >= 2 ? right(node) : null; // OPENJPA-15 support subquery's from clause do not start with // identification_variable_declaration() if (inner && ctx().getParent() != null && ctx().schemaAlias == null) { return getSubquery(alias.text, path, exp); } return addJoin(path, alias, exp); }
/** * Adds a join condition to the given expression. * * @param node the node to check * @param inner whether or not the join should be an inner join * @param exp an existing expression to AND, or null if none * @return the Expression with the join condition added */ private Expression addJoin(JPQLNode node, boolean inner, Expression exp) { // the type will be the declared type for the field JPQLNode firstChild = firstChild(node); Path path = null; if (firstChild.id == JJTQUALIFIEDPATH) path = (Path) getQualifiedPath(firstChild); else path = getPath(firstChild, false, inner); JPQLNode alias = node.getChildCount() >= 2 ? right(node) : null; // OPENJPA-15 support subquery's from clause do not start with // identification_variable_declaration() if (inner && ctx().getParent() != null && ctx().schemaAlias == null) { return getSubquery(alias.text, path, exp); } return addJoin(path, alias, exp); }
/** * Adds a join condition to the given expression. * * @param node the node to check * @param inner whether or not the join should be an inner join * @param exp an existing expression to AND, or null if none * @return the Expression with the join condition added */ private Expression addJoin(JPQLNode node, boolean inner, Expression exp) { // the type will be the declared type for the field JPQLNode firstChild = firstChild(node); Path path = null; if (firstChild.id == JJTQUALIFIEDPATH) path = (Path) getQualifiedPath(firstChild); else path = getPath(firstChild, false, inner); JPQLNode alias = node.getChildCount() >= 2 ? right(node) : null; // OPENJPA-15 support subquery's from clause do not start with // identification_variable_declaration() if (inner && ctx().getParent() != null && ctx().schemaAlias == null) { return getSubquery(alias.text, path, exp); } return addJoin(path, alias, exp); }
if (ctx().getParent() != null && ctx().getVariable(path.getSchemaAlias()) == null) { path.setSubqueryContext(ctx(), name);
if (ctx().getParent() != null && ctx().getVariable(path.getSchemaAlias()) == null) { path.setSubqueryContext(ctx(), name);
if (c.ctx().getParent() != null && c.ctx().getVariable(parentPath.getSchemaAlias()) == null) parentPath.setSubqueryContext(c.ctx(), parentPath.getSchemaAlias());
if (ctx().getParent() != null && ctx().getVariable(path.getSchemaAlias()) == null) { path.setSubqueryContext(ctx(), name);
if (ctx().getParent() != null && ctx().getVariable(path.getSchemaAlias()) == null) { path.setSubqueryContext(ctx(), name);
if (c.ctx().getParent() != null && c.ctx().getVariable(parentPath.getSchemaAlias()) == null) parentPath.setSubqueryContext(c.ctx(), parentPath.getSchemaAlias());
if (c.ctx().getParent() != null && c.ctx().getVariable(parentPath.getSchemaAlias()) == null) parentPath.setSubqueryContext(c.ctx(), parentPath.getSchemaAlias());
if (c.ctx().getParent() != null && c.ctx().getVariable(parentPath.getSchemaAlias()) == null) parentPath.setSubqueryContext(c.ctx(), parentPath.getSchemaAlias());