public Comparison(Session session, int compareType, Expression left, Expression right) { this.database = session.getDatabase(); this.left = left; this.right = right; this.compareType = compareType; }
private SortOrder initOrder(Session session) { int size = groupConcatOrderList.size(); int[] index = new int[size]; int[] sortType = new int[size]; for (int i = 0; i < size; i++) { SelectOrderBy o = groupConcatOrderList.get(i); index[i] = i + 1; int order = o.descending ? SortOrder.DESCENDING : SortOrder.ASCENDING; sortType[i] = order; } return new SortOrder(session.getDatabase(), index, sortType, null); }
public DropView(Session session, Schema schema) { super(session, schema); dropAction = session.getDatabase().getSettings().dropRestrict ? AlterTableAddConstraint.RESTRICT : AlterTableAddConstraint.CASCADE; }
public Parser(Session session) { this.database = session.getDatabase(); this.identifiersToUpper = database.getSettings().databaseToUpper; this.session = session; }
/** * Construct a new row list for this session. * * @param session the session */ public RowList(Session session) { this.session = session; maxMemory = session.getDatabase().getMaxOperationMemory(); }
public DropTable(Session session, Schema schema) { super(session, schema); dropAction = session.getDatabase().getSettings().dropRestrict ? AlterTableAddConstraint.RESTRICT : AlterTableAddConstraint.CASCADE; }
@Override public int compare(Value o1, Value o2) { return session.getDatabase().compare(o1, o2); } });
/** * Get the current object id, or get a new id from the database. The object * id is used when creating new database object (CREATE statement). * * @return the object id */ protected int getObjectId() { int id = objectId; if (id == 0) { id = session.getDatabase().allocateObjectId(); } else { objectId = 0; } return id; }
Command(Parser parser, String sql) { this.session = parser.getSession(); this.sql = sql; trace = session.getDatabase().getTrace(Trace.COMMAND); }
@Override public Column getRowIdColumn() { if (session.getDatabase().getSettings().rowId) { return table.getRowIdColumn(); } return null; }
public WorkerFactoryProxy(Session session) { this.target = session.getDatabase().getRepository().getWorkerFactory(); }
public JdbcWorker(Session session, String shardName, String sql, List<Value> params) { super(); this.session = session; this.shardName = shardName; this.sql = sql; this.params = params; this.trace = session.getDatabase().getTrace(Trace.EXECUTOR); this.tx = (JdbcTransaction)session.getTransaction(); this.connProvider = tx.getConnectionProvider(); }
private void updateAggregate0(Session session) { HashMap<Expression, Object> group = select.getCurrentGroup(); AggregateData data = (AggregateData) group.get(this); if (data == null) { switch (type) { case COUNT: case COUNT_ALL: data = AggregateData.create(SUM); break; default: data = AggregateData.create(type); } group.put(this, data); } Value v = select.getCurrentValues().get(this); data.add(session.getDatabase(), dataType, distinct, v); }
protected final void prepare(Session s) { if (isPrepared) { return; } this.session = s; this.database = session.getDatabase(); this.queryExecutor = database.getQueryExecutor(); this.routingHandler = database.getRoutingHandler(); this.queryHandlerFactory = session.getQueryHandlerFactory(); doPrepare(); isPrepared = true; }
private int expandColumnList(TableFilter filter, int index) { Table t = filter.getTable(); String alias = filter.getTableAlias(); Column[] columns = t.getColumns(); for (Column c : columns) { if (filter.isNaturalJoinColumn(c)) { continue; } ExpressionColumn ec = new ExpressionColumn(session.getDatabase(), null, alias, c.getName()); expressions.add(index++, ec); } return index; }
@Override public void createIndexConditions(Session session, TableFilter filter) { if (!(left instanceof ExpressionColumn)) { return; } ExpressionColumn l = (ExpressionColumn) left; if (filter != l.getTableFilter()) { return; } if (session.getDatabase().getSettings().optimizeInList) { filter.addIndexCondition(IndexCondition.getInList(l, valueList)); return; } }
public ConnectionHolder(Session session) { Database database = session.getDatabase(); JdbcRepository repository = (JdbcRepository) database.getRepository(); this.session = session; this.trace = database.getTrace(Trace.TRANSACTION); this.target = repository.getConnectionProvider(); String mode = database.getSettings().transactionMode; this.holderStrategy = transactionMode(mode); connectionMap = New.concurrentHashMap(); }
@Override public Expression[] getExpressionColumns(Session session) { ExpressionColumn[] expr = new ExpressionColumn[list.length]; for (int i = 0; i < list.length; i++) { Expression e = list[i]; Column col = new Column("C" + (i + 1), e.getType(), e.getPrecision(), e.getScale(), e.getDisplaySize()); expr[i] = new ExpressionColumn(session.getDatabase(), col); } return expr; }
private static boolean cancelStatement(Session session, int targetSessionId) { session.getUser().checkAdmin(); Session[] sessions = session.getDatabase().getSessions(); for (Session s : sessions) { if (s.getId() == targetSessionId) { Command c = s.getCurrentCommand(); if (c == null) { return false; } c.cancel(); return true; } } return false; }
private void setEvaluatable(TableFilter join) { if (session.getDatabase().getSettings().nestedJoins) { setEvaluatable(true); return; } // this table filter is now evaluatable - in all sub-joins do { Expression e = join.getJoinCondition(); if (e != null) { e.setEvaluatable(this, true); } TableFilter n = join.getNestedJoin(); if (n != null) { setEvaluatable(n); } join = join.getJoin(); } while (join != null); }