提交 5818aa0b authored 作者: Thomas Mueller's avatar Thomas Mueller

Fix bug with ALLOW_LITERALS=NONE.

上级 f0dd328d
...@@ -82,7 +82,9 @@ Change Log ...@@ -82,7 +82,9 @@ Change Log
</li><li>Fix to org.h2.util.ScriptReader when handling unclosed block comments. </li><li>Fix to org.h2.util.ScriptReader when handling unclosed block comments.
</li><li>Make org.h2.util.ScriptReader throw a better exception when handling broken scripts which generate </li><li>Make org.h2.util.ScriptReader throw a better exception when handling broken scripts which generate
extremely large statements. extremely large statements.
</li><li>Fix bug with ALLOW_LITERALS=NONE, where the periodic analyze table on insert would throw an exception. </li><li>Fix bug with ALLOW_LITERALS=NONE,
where the periodic analyze table on insert would throw an exception.
A similar problem was fixed in the Console tool.
</li><li>Issue 510: Make org.h2.bnf public for consumption by external projects, patch by Nicolas Fortin </li><li>Issue 510: Make org.h2.bnf public for consumption by external projects, patch by Nicolas Fortin
</li><li>Issue 509: Important fix on ValueGeometry, patch by Nicolas Fortin (with some tweaking) </li><li>Issue 509: Important fix on ValueGeometry, patch by Nicolas Fortin (with some tweaking)
Make ValueGeometry#getDimensionCount more reliable. Make ValueGeometry#getDimensionCount more reliable.
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
package org.h2.bnf.context; package org.h2.bnf.context;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
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;
...@@ -141,15 +141,17 @@ public class DbContents { ...@@ -141,15 +141,17 @@ public class DbContents {
if (url != null) { if (url != null) {
isH2 = url.startsWith("jdbc:h2:"); isH2 = url.startsWith("jdbc:h2:");
if (isH2) { if (isH2) {
Statement stat = meta.getConnection().createStatement(); PreparedStatement prep = meta.getConnection().prepareStatement(
ResultSet rs = stat.executeQuery( "SELECT UPPER(VALUE) FROM INFORMATION_SCHEMA.SETTINGS " +
"SELECT UPPER(VALUE) FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME='MODE'"); "WHERE NAME=?");
prep.setString(1, "MODE");
ResultSet rs = prep.executeQuery();
rs.next(); rs.next();
if ("MYSQL".equals(rs.getString(1))) { if ("MYSQL".equals(rs.getString(1))) {
isH2ModeMySQL = true; isH2ModeMySQL = true;
} }
rs.close(); rs.close();
stat.close(); prep.close();
} }
isOracle = url.startsWith("jdbc:oracle:"); isOracle = url.startsWith("jdbc:oracle:");
isPostgreSQL = url.startsWith("jdbc:postgresql:"); isPostgreSQL = url.startsWith("jdbc:postgresql:");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论