mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-11-22 09:02:17 -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 notBindInList = !inListBindParams.isEmpty() && databaseType != JdbcMapper.DatabaseType.BIND;
|
||||||
|
final boolean bindInList = !inListBindParams.isEmpty() && databaseType == JdbcMapper.DatabaseType.BIND;
|
||||||
|
|
||||||
final SQLParser parsedSQl = ManualSQLParser.getSQLParser(sql, parser, sqlStatement);
|
final SQLParser parsedSQl = ManualSQLParser.getSQLParser(sql, parser, sqlStatement);
|
||||||
// now implementation
|
// now implementation
|
||||||
@ -474,7 +475,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
|||||||
for (final SpecialVariableElement param : inListBindParams.values())
|
for (final SpecialVariableElement param : inListBindParams.values())
|
||||||
setArray(w, databaseType, arrayNumberTypeName, arrayStringTypeName, param);
|
setArray(w, databaseType, arrayNumberTypeName, arrayStringTypeName, param);
|
||||||
w.write("\t\t\tps = ");
|
w.write("\t\t\tps = ");
|
||||||
final boolean cachePreparedStatements = sql.cachePreparedStatement().combine(defaultCachePreparedStatements);
|
final boolean cachePreparedStatements = sql.cachePreparedStatement().combine(defaultCachePreparedStatements) && !bindInList;
|
||||||
if (cachePreparedStatements) {
|
if (cachePreparedStatements) {
|
||||||
w.write("this.prepareStatement(");
|
w.write("this.prepareStatement(");
|
||||||
w.write(Integer.toString(cachedPreparedStatements));
|
w.write(Integer.toString(cachedPreparedStatements));
|
||||||
@ -490,7 +491,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
|||||||
w.write("\");\n");
|
w.write("\");\n");
|
||||||
|
|
||||||
// now bind parameters
|
// now bind parameters
|
||||||
if(!inListBindParams.isEmpty() && databaseType == JdbcMapper.DatabaseType.BIND) {
|
if(bindInList) {
|
||||||
w.write("\t\t\tint psParamCount = 0;\n");
|
w.write("\t\t\tint psParamCount = 0;\n");
|
||||||
for (final VariableElement param : bindParams)
|
for (final VariableElement param : bindParams)
|
||||||
setObject(w, "++psParamCount", param);
|
setObject(w, "++psParamCount", param);
|
||||||
|
Loading…
Reference in New Issue
Block a user