提交 1e6db840 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Avoid unused variable warning in JdbcDatabaseMetaData.getTables()

上级 537da599
...@@ -144,9 +144,10 @@ public class JdbcDatabaseMetaData extends TraceObject implements ...@@ -144,9 +144,10 @@ public class JdbcDatabaseMetaData extends TraceObject implements
} }
checkClosed(); checkClosed();
String tableType; String tableType;
if (types != null && types.length > 0) { int typesLength = types != null ? types.length : 0;
if (typesLength > 0) {
StatementBuilder buff = new StatementBuilder("TABLE_TYPE IN("); StatementBuilder buff = new StatementBuilder("TABLE_TYPE IN(");
for (String ignored : types) { for (int i = 0; i < typesLength; i++) {
buff.appendExceptFirst(", "); buff.appendExceptFirst(", ");
buff.append('?'); buff.append('?');
} }
...@@ -218,7 +219,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements ...@@ -218,7 +219,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements
prep.setString(10, "\\"); prep.setString(10, "\\");
prep.setString(11, getPattern(tableNamePattern)); prep.setString(11, getPattern(tableNamePattern));
prep.setString(12, "\\"); prep.setString(12, "\\");
for (int i = 0; types != null && i < types.length; i++) { for (int i = 0; i < typesLength; i++) {
prep.setString(13 + i, types[i]); prep.setString(13 + i, types[i]);
} }
return prep.executeQuery(); return prep.executeQuery();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论