use of org.jooq.impl.CacheType.CACHE_PARSING_CONNECTION in project jOOQ by jOOQ.
the class ParsingConnection method translate.
static final Rendered translate(Configuration configuration, String sql, Param<?>... bindValues) {
log.debug("Translating from", sql);
Rendered result = null;
Supplier<CacheValue> miss = () -> {
log.debug("Translation cache miss", sql);
return new CacheValue(configuration, sql, bindValues);
};
Settings settings = configuration.settings();
if (CACHE_PARSING_CONNECTION.category.predicate.test(settings) && bindValues.length > 0) {
switch(getParamType(settings)) {
case INLINED:
case NAMED_OR_INLINED:
result = miss.get().rendered(bindValues);
break;
}
}
if (result == null)
result = Cache.run(configuration, miss, CACHE_PARSING_CONNECTION, () -> Cache.key(sql, map(nonNull(bindValues), f -> f.getDataType()))).rendered(bindValues);
log.debug("Translating to", result.sql);
return result;
}
Aggregations