#23 - Polishing.

Formatting.
Made Tests simpler and stricter by using `containsExactly`.
Added @Test annotation to ignored database specific tests so they actually show up as ignored.

Original pull request: #47.
This commit is contained in:
Jens Schauder
2019-01-10 13:59:36 +01:00
committed by Mark Paluch
parent b43b11936f
commit 29f1edce0e
4 changed files with 23 additions and 18 deletions

View File

@@ -36,14 +36,18 @@ import org.springframework.data.r2dbc.dialect.BindMarkersFactory;
*/
public class NamedParameterExpander {
/** Default maximum number of entries for the SQL cache: 256. */
/**
* Default maximum number of entries for the SQL cache: 256.
*/
public static final int DEFAULT_CACHE_LIMIT = 256;
private volatile int cacheLimit = DEFAULT_CACHE_LIMIT;
private final Log logger = LogFactory.getLog(getClass());
/** Cache of original SQL String to ParsedSql representation. */
/**
* Cache of original SQL String to ParsedSql representation.
*/
@SuppressWarnings("serial") private final Map<String, ParsedSql> parsedSqlCache = new LinkedHashMap<String, ParsedSql>(
DEFAULT_CACHE_LIMIT, 0.75f, true) {
@Override
@@ -101,8 +105,10 @@ public class NamedParameterExpander {
}
synchronized (this.parsedSqlCache) {
ParsedSql parsedSql = this.parsedSqlCache.get(sql);
if (parsedSql == null) {
parsedSql = NamedParameterUtils.parseSqlStatement(sql);
this.parsedSqlCache.put(sql, parsedSql);
}