public Object newCompilationKey() { JDBCFetchConfiguration fetch = (JDBCFetchConfiguration) ctx .getFetchConfiguration(); return fetch.getJoinSyntax(); }
/** * Scans metadata to find out if a replicated class is the candidate. */ boolean containsReplicated(QueryContext query) { Class<?> candidate = query.getCandidateType(); DistributedConfiguration conf = (DistributedConfiguration)query.getStoreContext() .getConfiguration(); if (candidate != null) { return conf.isReplicated(candidate); } ClassMetaData[] metas = query.getAccessPathMetaDatas(); if (metas == null || metas.length < 1) return false; for (ClassMetaData meta : metas) if (conf.isReplicated(meta.getDescribedType())) return true; return false; }
public Executor newDataStoreExecutor(ClassMetaData meta, boolean subs) { return new DataStoreExecutor(this, meta, subs, _parser, ctx.getCompilation()); }
void populate(ExpressionStoreQuery query) { QueryContext ctx = query.getContext(); // if the owning query's context does not have // any candidate class, then set it here if (ctx.getCandidateType() == null) { if (_candidateType == null) _candidateType = new JPQLExpressionBuilder (null, query, this).getCandidateType(); ctx.setCandidateType(_candidateType, true); } }
public int getOperation(StoreQuery q) { return _select ? OP_SELECT : (q.getContext().getCandidateType() != null || q.getContext().getResultType() != null || q.getContext().getResultMappingName() != null || q.getContext().getResultMappingScope() != null) ? OP_SELECT : OP_UPDATE; }
public void enter(Value val) { if (!val.isVariable()) return; throw new UnsupportedException(_loc.get("inmem-agg-proj-var", _ctx.getCandidateType(), _ctx.getQueryString())); } }
if (q.getCandidateCollection() != null) return null; if (q.getResultType() != null && packed) return null; Class<?>[] types = q.getProjectionTypes(); for (int i = 0; i < types.length; i++) { switch (JavaTypes.getTypeCode(types[i])) { case JavaTypes.OBJECT: if (!ImplHelper.isManagedType( q.getStoreContext().getConfiguration(), types[i])) return null; break; ClassMetaData[] metas = q.getAccessPathMetaDatas(); if (metas.length == 0) return null; StoreContext ctx = q.getStoreContext(); if (intersects(accessPathClassNames, ctx.getPersistedTypes()) || intersects(accessPathClassNames, ctx.getUpdatedTypes()) key._accessPathClassNames = accessPathClassNames; key._timeout = timeout; key._query = q.getQueryString(); if (key._query == null && parsed != null) {
paramMap = Collections.EMPTY_MAP; else { Map paramTypes = q.getContext().getOrderedParameterTypes(); paramMap = new HashMap((int) (params.length * 1.33 + 1)); int idx = 0; FetchConfiguration fetch = q.getContext().getFetchConfiguration(); StoreContext sctx = q.getContext().getStoreContext(); ResultObjectProvider rop; Object[] args; Collection coll = q.getContext().getCandidateCollection(); if (coll == null) { Extent ext = q.getContext().getQuery(). getCandidateExtent(); itr = ext.iterator();
JDBCStore store = ((SQLStoreQuery) q).getStore(); DBDictionary dict = store.getDBDictionary(); String sql = q.getContext().getQueryString(); Connection conn = store.getConnection(); JDBCFetchConfiguration fetch = (JDBCFetchConfiguration) q.getContext().getFetchConfiguration(); rop = new MappedQueryResultObjectProvider(_resultMapping, store, fetch, res); else if (q.getContext().getCandidateType() != null) rop = new GenericResultObjectProvider((ClassMapping) _meta, store, fetch, res); else rop = new SQLProjectionResultObjectProvider(store, fetch, res, q.getContext().getResultType()); } catch (SQLException se) { if (stmnt != null)
JDBCFetchConfiguration fetch = (JDBCFetchConfiguration)q.getContext().getFetchConfiguration(); rop = new PreparedProjectionResultObjectProvider(cachedSelect, getQueryExpressions(), new QueryExpressionsState[]{state}, ctx, res); } else if (q.getContext().getCandidateType() != null) { rop = new PreparedResultObjectProvider(cachedSelect, (ClassMapping) _meta, store, fetch, res); } else { rop = new SQLProjectionResultObjectProvider(store, fetch, (ResultSetResult)res, q.getContext().getResultType());
/** * Parse the parameter declarations. */ private LinkedMap bindParameterTypes() { ctx.lock(); try { if (_params != null) return _params; String params = ctx.getParameterDeclaration(); if (params == null) return EMPTY_PARAMS; List decs = Filters.parseDeclaration(params, ',', "parameters"); if (_params == null) _params = new LinkedMap((int) (decs.size() / 2 * 1.33 + 1)); String name; Class cls; for (int i = 0; i < decs.size(); i += 2) { name = (String) decs.get(i); cls = ctx.classForName(name, null); if (cls == null) throw new UserException(_loc.get("bad-param-type", name)); _params.put(decs.get(i + 1), cls); } return _params; } finally { ctx.unlock(); } }
paramMap = Collections.EMPTY_MAP; else { Map paramTypes = q.getContext().getParameterTypes(); paramMap = new HashMap((int) (params.length * 1.33 + 1)); int idx = 0; FetchConfiguration fetch = q.getContext().getFetchConfiguration(); StoreContext sctx = q.getContext().getStoreContext(); ResultObjectProvider rop; Object[] args; Collection coll = q.getContext().getCandidateCollection(); if (coll == null) { Extent ext = q.getContext().getQuery(). getCandidateExtent(); itr = ext.iterator();
public Executor newDataStoreExecutor(ClassMetaData meta, boolean subs) { ParallelExecutor ex = new ParallelExecutor(this, meta, subs, _parser, ctx.getCompilation()); FetchConfiguration fetch = getContext().getFetchConfiguration(); DistributedStoreManager store = (DistributedStoreManager)getContext() .getStoreContext().getStoreManager().getInnermostDelegate(); List<SliceStoreManager> targets = store.getTargets(fetch); for (StoreQuery q:_queries) { if (targets.contains(((JDBCStoreQuery)q).getStore())) ex.addExecutor(q.newDataStoreExecutor(meta, subs)); } return ex; }
/** * Return a key for the given query, or null if it is not cacheable. */ static QueryKey newInstance(QueryContext q, boolean packed, Map<Object,Object> args, Class<?> candidate, boolean subs, long startIdx, long endIdx, Object parsed) { QueryKey key = createKey(q, packed, candidate, subs, startIdx, endIdx, parsed); if (key != null && (args == null || args.isEmpty() || setParams(key, q.getStoreContext(), new HashMap<Object,Object>(args)))) return key; return null; }
public Executor newDataStoreExecutor(ClassMetaData meta, boolean subs) { boolean parallel = !getContext().getStoreContext().getBroker() .getMultithreaded(); ParallelExecutor ex = new ParallelExecutor(this, meta, subs, _parser, ctx.getCompilation(), parallel); for (StoreQuery q : _queries) { ex.addExecutor(q.newDataStoreExecutor(meta, subs)); } return ex; }
if (userParams == null || userParams.isEmpty()) return StoreQuery.EMPTY_OBJECTS; String sql = q.getContext().getQueryString(); List<Integer> paramOrder = new ArrayList<Integer>(); try { q.getContext().getQuery().setQuery(sql); return result;
return; String methName = q.getContext().getQueryString(); if (StringUtils.isEmpty(methName)) throw new UserException(_loc.get("no-method")); cls = _meta.getDescribedType(); else { cls = q.getContext().classForName(methName.substring(0, dotIdx), null); if (cls == null)
public void populate(Object parsed, ExpressionStoreQuery query) { CriteriaQueryImpl<?> c = (CriteriaQueryImpl<?>) parsed; query.invalidateCompilation(); query.getContext().setCandidateType(c.getRoot().getJavaType(), true); query.setQuery(parsed); }
public Object newCompilation() { if (_parsed != null) return _parsed; return _parser.parse(ctx.getQueryString(), this); }
public Class classForName(String name, String[] imports) { return ctx.classForName(name, imports); }