mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-11-13 12:45:02 -05:00
Can never cache PreparedStatement with bind in lists
This commit is contained in:
parent
bc2250d9f4
commit
9ad437b697
@ -462,6 +462,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
}
|
||||
}
|
||||
final boolean notBindInList = !inListBindParams.isEmpty() && databaseType != JdbcMapper.DatabaseType.BIND;
|
||||
final boolean bindInList = !inListBindParams.isEmpty() && databaseType == JdbcMapper.DatabaseType.BIND;
|
||||
|
||||
final SQLParser parsedSQl = ManualSQLParser.getSQLParser(sql, parser, sqlStatement);
|
||||
// now implementation
|
||||
@ -474,7 +475,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
for (final SpecialVariableElement param : inListBindParams.values())
|
||||
setArray(w, databaseType, arrayNumberTypeName, arrayStringTypeName, param);
|
||||
w.write("\t\t\tps = ");
|
||||
final boolean cachePreparedStatements = sql.cachePreparedStatement().combine(defaultCachePreparedStatements);
|
||||
final boolean cachePreparedStatements = sql.cachePreparedStatement().combine(defaultCachePreparedStatements) && !bindInList;
|
||||
if (cachePreparedStatements) {
|
||||
w.write("this.prepareStatement(");
|
||||
w.write(Integer.toString(cachedPreparedStatements));
|
||||
@ -490,7 +491,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
w.write("\");\n");
|
||||
|
||||
// now bind parameters
|
||||
if(!inListBindParams.isEmpty() && databaseType == JdbcMapper.DatabaseType.BIND) {
|
||||
if(bindInList) {
|
||||
w.write("\t\t\tint psParamCount = 0;\n");
|
||||
for (final VariableElement param : bindParams)
|
||||
setObject(w, "++psParamCount", param);
|
||||
|
Loading…
Reference in New Issue
Block a user