提交 c2f674d5 authored 作者: Thomas Mueller's avatar Thomas Mueller

Make FindBugs happy

上级 c414e8a0
...@@ -9,6 +9,7 @@ package org.h2.server.web; ...@@ -9,6 +9,7 @@ package org.h2.server.web;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import org.h2.command.Parser; import org.h2.command.Parser;
...@@ -101,12 +102,15 @@ public class DbContents { ...@@ -101,12 +102,15 @@ public class DbContents {
if (url != null) { if (url != null) {
isH2 = url.startsWith("jdbc:h2:"); isH2 = url.startsWith("jdbc:h2:");
if (isH2) { if (isH2) {
ResultSet rs = meta.getConnection().createStatement().executeQuery( Statement stat = meta.getConnection().createStatement();
ResultSet rs = stat.executeQuery(
"SELECT UPPER(VALUE) FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME='MODE'"); "SELECT UPPER(VALUE) FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME='MODE'");
rs.next(); rs.next();
if ("MYSQL".equals(rs.getString(1))) { if ("MYSQL".equals(rs.getString(1))) {
isH2ModeMySQL = true; isH2ModeMySQL = true;
} }
rs.close();
stat.close();
} }
isOracle = url.startsWith("jdbc:oracle:"); isOracle = url.startsWith("jdbc:oracle:");
isPostgreSQL = url.startsWith("jdbc:postgresql:"); isPostgreSQL = url.startsWith("jdbc:postgresql:");
......
...@@ -134,9 +134,9 @@ public class DbContextRule implements Rule { ...@@ -134,9 +134,9 @@ public class DbContextRule implements Rule {
} }
private void addNewTableAlias(Sentence sentence) { private void addNewTableAlias(Sentence sentence) {
String query = sentence.getQuery();
if (SUGGEST_TABLE_ALIAS) { if (SUGGEST_TABLE_ALIAS) {
// good when testing! // good for testing!
String query = sentence.getQuery();
if (query.length() > 3) { if (query.length() > 3) {
return; return;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论