hash |= (hash >>> 8);
hash &= 0x000000ff;
CacheID cid = new CacheID(new ParseInfo(), fullName + hash, context.getVdbName(),
context.getVdbVersion(), context.getConnectionID(), context.getUserName());
cid.setParameters(vals);
CachedResults results = cache.get(cid);
if (results != null) {
TupleBuffer buffer = results.getResults();
return buffer.createIndexedTupleSource();
}
//construct a query with a no cache hint
//note that it's safe to use the stringified form of the parameters because
//it's not possible to use xml/clob/blob/object
CacheHint hint = proc.getCacheHint();
proc.setCacheHint(null);
Option option = new Option();
option.setNoCache(true);
option.addNoCacheGroup(fullName);
proc.setOption(option);
Determinism determinismLevel = context.resetDeterminismLevel();
QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(proc.toString(), fullName.toUpperCase(), context);
qp.setNonBlocking(true);
qp.getContext().setDataObjects(null);
BatchCollector bc = qp.createBatchCollector();
TupleBuffer tb = bc.collectTuples();
CachedResults cr = new CachedResults();
cr.setResults(tb, qp.getProcessorPlan());
cr.setHint(hint);
if (hint != null && hint.getDeterminism() != null) {
LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Cache hint modified the query determinism from ",determinismLevel, " to ", hint.getDeterminism() }); //$NON-NLS-1$ //$NON-NLS-2$
determinismLevel = hint.getDeterminism();
}
cache.put(cid, determinismLevel, cr, hint != null?hint.getTtl():null);