private int calculateArgsSizeWithCollectionArgs() { int startSize = sqlArgs.size(); if (hasCollectionArgs()) { for (Collection<?> collection : collectionArgs) { startSize += (collection.size() - 1); } } return startSize; }
private int calculateArgsSizeWithoutCollectionArgs() { return sqlArgs.size() - (hasCollectionArgs() ? collectionArgs.size() : 0); }
private String getCacheKey() { StringBuilder cacheKey = new StringBuilder(); if (hasCollectionArgs()) { for (Collection<?> collection : collectionArgs) { cacheKey.append(collection.size()).append(":"); } } return cacheKey.toString(); }
private String resolveSqlString(String cacheKey, boolean largeArgMode) { if (hasCollectionArgs()) { if (!largeArgMode) { String cachedResult = compiledSqlCache.get(cacheKey);
private Object[] resolveSqlArguments(String cacheKey, int totalArgSize, boolean largeArgMode) { if (hasCollectionArgs()) { Object[] cachedResult = argArrayCache.get(cacheKey); if (cachedResult == null) { int size = largeArgMode ? calculateArgsSizeWithoutCollectionArgs() : totalArgSize; if (compiledArgs == null || compiledArgs.length != size) { cachedResult = new Object[size]; } else { cachedResult = compiledArgs; } argArrayCache.put(cacheKey, cachedResult); } compiledArgs = cachedResult; populateCompiledArgs(largeArgMode); } else { if (compiledArgs == null) { compiledArgs = sqlArgs.toArray(new Object[sqlArgs.size()]); } } return applyArgumentResolver(compiledArgs); }
public CompiledStatement resolveToCompiledStatement() { String cacheKey = hasCollectionArgs() ? getCacheKey() : null; int totalArgSize = calculateArgsSizeWithCollectionArgs(); boolean largeArgMode = totalArgSize > SqlStatement.MAX_VARIABLE_NUMBER; return new CompiledStatement(resolveSqlString(cacheKey, largeArgMode), resolveSqlArguments(cacheKey, totalArgSize, largeArgMode), needsValidation); }
private int calculateArgsSizeWithCollectionArgs() { int startSize = sqlArgs.size(); if (hasCollectionArgs()) { for (Collection<?> collection : collectionArgs) { startSize += (collection.size() - 1); } } return startSize; }
private int calculateArgsSizeWithoutCollectionArgs() { return sqlArgs.size() - (hasCollectionArgs() ? collectionArgs.size() : 0); }
private String getCacheKey() { StringBuilder cacheKey = new StringBuilder(); if (hasCollectionArgs()) { for (Collection<?> collection : collectionArgs) { cacheKey.append(collection.size()).append(":"); } } return cacheKey.toString(); }
private String resolveSqlString(String cacheKey, boolean largeArgMode) { if (hasCollectionArgs()) { if (!largeArgMode) { String cachedResult = compiledSqlCache.get(cacheKey);
private Object[] resolveSqlArguments(String cacheKey, int totalArgSize, boolean largeArgMode) { if (hasCollectionArgs()) { Object[] cachedResult = argArrayCache.get(cacheKey); if (cachedResult == null) { int size = largeArgMode ? calculateArgsSizeWithoutCollectionArgs() : totalArgSize; if (compiledArgs == null || compiledArgs.length != size) { cachedResult = new Object[size]; } else { cachedResult = compiledArgs; } argArrayCache.put(cacheKey, cachedResult); } compiledArgs = cachedResult; populateCompiledArgs(largeArgMode); } else { if (compiledArgs == null) { compiledArgs = sqlArgs.toArray(new Object[sqlArgs.size()]); } } return applyArgumentResolver(compiledArgs); }
public CompiledStatement resolveToCompiledStatement() { String cacheKey = hasCollectionArgs() ? getCacheKey() : null; int totalArgSize = calculateArgsSizeWithCollectionArgs(); boolean largeArgMode = totalArgSize > SqlStatement.MAX_VARIABLE_NUMBER; return new CompiledStatement(resolveSqlString(cacheKey, largeArgMode), resolveSqlArguments(cacheKey, totalArgSize, largeArgMode), needsValidation); }