public ExpState initialize(Select sel, ExpContext ctx, int flags) { if (_path != null) { _path.addVariableAction(this); return _path.initialize(sel, ctx, flags | JOIN_REL); } return ExpState.NULL; }
public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { Column col = getColumns(state)[index]; appendTo(sel, state, sql, col); }
public ExpState initialize(Select sel, ExpContext ctx, int flags) { ExpState state = _path.initialize(sel, ctx, JOIN_REL); // it's difficult to get calls on non-pc fields to always return null // without screwing up the SQL, to just don't let users call it on // non-pc fields at all ClassMapping cls = _path.getClassMapping(state); if (cls == null || cls.getEmbeddingMapping() != null) throw new UserException(_loc.get("bad-getobjectid", _path.getFieldMapping(state))); return state; }
public Expression bindKeyVariable(Value var, Value val) { // handle the strange case of using a constant path to bind a // variable; in these cases the variable acts like an unbound // variable that we limit by using an IN clause on the constant // value collection if (val instanceof Const) { PCPath path = new PCPath(_type, (Variable) var); path.setMetaData(var.getMetaData()); return new InKeyExpression(path, (Const) val); } return new BindVariableExpression((Variable) var, (PCPath) val, true); }
public void groupBy(Select sel, ExpContext ctx, ExpState state) { ClassMapping mapping = getClassMapping(state); PathExpState pstate = (PathExpState) state; if (mapping == null || !pstate.joinedRel) sel.groupBy(getColumns(state), sel.outer(pstate.joins)); else { int subs = (_type == UNBOUND_VAR) ? Select.SUBS_JOINABLE : Select.SUBS_ANY_JOINABLE; sel.groupBy(mapping, subs, ctx.store, ctx.fetch, sel.outer(pstate.joins)); } }
public void acceptVisit(ExpressionVisitor visitor) { visitor.enter(this); _path.acceptVisit(visitor); visitor.exit(this); } }
/** * Constructor. Provide the map value to operate on. */ public MapKey(Val key) { ((PCPath) key).getKey(); _key = key; }
public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { if (_path != null) _path.calculateValue(sel, ctx, state, other, otherState); }
public FieldMapping getFieldMapping() { return (isPath()) ? ((PCPath) _val).getFieldMapping(_state) : null; }
public Column[] getColumns(ExpState state) { PathExpState pstate = (PathExpState) state; if (pstate.cols == null) pstate.cols = calculateColumns(pstate); return pstate.cols; }
public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { _path.appendTo(sel, ctx, state, sql, index); }
/** * Return the oid columns. */ public Column[] getColumns(ExpState state) { return _path.getClassMapping(state).getPrimaryKeyColumns(); }
public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { if (other instanceof PCPath) ((ConstExpState) state).cols = ((PCPath) other). getColumns(otherState); }
public ExpState initialize(Select sel, ExpContext ctx, int flags) { ExpState state = _path.initialize(sel, ctx, JOIN_REL); // it's difficult to get calls on non-pc fields to always return null // without screwing up the SQL, to just don't let users call it on // non-pc fields at all ClassMapping cls = _path.getClassMapping(state); if (cls == null || cls.getEmbeddingMapping() != null) throw new UserException(_loc.get("bad-getobjectid", _path.getFieldMapping(state))); return state; }
public Expression bindKeyVariable(Value var, Value val) { // handle the strange case of using a constant path to bind a // variable; in these cases the variable acts like an unbound // variable that we limit by using an IN clause on the constant // value collection if (val instanceof Const) { PCPath path = new PCPath(_type, (Variable) var); path.setMetaData(var.getMetaData()); return new InKeyExpression(path, (Const) val); } return new BindVariableExpression((Variable) var, (PCPath) val, true); }
public void groupBy(Select sel, ExpContext ctx, ExpState state) { ClassMapping mapping = getClassMapping(state); PathExpState pstate = (PathExpState) state; if (mapping == null || !pstate.joinedRel) sel.groupBy(getColumns(state), sel.outer(pstate.joins)); else { int subs = (_type == UNBOUND_VAR) ? Select.SUBS_JOINABLE : Select.SUBS_ANY_JOINABLE; sel.groupBy(mapping, subs, ctx.store, ctx.fetch, sel.outer(pstate.joins)); } }
public void acceptVisit(ExpressionVisitor visitor) { visitor.enter(this); _path.acceptVisit(visitor); visitor.exit(this); } }
/** * Constructor. Provide the map value to operate on. */ public MapEntry(Val key, Val val) { ((PCPath) key).getKey(); _key = key; _val = val; }
public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { if (_path != null) _path.calculateValue(sel, ctx, state, other, otherState); }