提交 22dc3316 authored 作者: Thomas Mueller's avatar Thomas Mueller

Less classes are loaded when using the database in embedded mode.

上级 bd83d25e
......@@ -184,7 +184,7 @@ public class SysProperties {
* The default escape character for LIKE comparisons. To select no escape
* character, use an empty string.
*/
public static final Character DEFAULT_ESCAPE_CHAR = getEscapeChar(getStringSetting("h2.defaultEscape", "\\"));
public static final String DEFAULT_ESCAPE = getStringSetting("h2.defaultEscape", "\\");
/**
* System property <code>h2.defaultMaxOperationMemory</code> (default:
......@@ -743,7 +743,8 @@ public class SysProperties {
private static String getProperty(String name) {
try {
return System.getProperty(name);
} catch (SecurityException e) {
} catch (Exception e) {
// SecurityException
// applets may not do that - ignore
return null;
}
......@@ -835,8 +836,4 @@ public class SysProperties {
return getBooleanSetting(H2_PAGE_STORE, PAGE_STORE);
}
private static Character getEscapeChar(String s) {
return s == null || s.length() == 0 ? null : s.charAt(0);
}
}
......@@ -29,6 +29,7 @@ import org.h2.value.ValueString;
public class CompareLike extends Condition {
private static final int MATCH = 0, ONE = 1, ANY = 2;
private static final Character DEFAULT_ESCAPE_CHAR = getEscapeChar(SysProperties.DEFAULT_ESCAPE);
private final CompareMode compareMode;
private Expression left;
......@@ -57,6 +58,10 @@ public class CompareLike extends Condition {
this.escape = escape;
}
private static Character getEscapeChar(String s) {
return s == null || s.length() == 0 ? null : s.charAt(0);
}
public String getSQL() {
String sql;
if (regexp) {
......@@ -121,12 +126,12 @@ public class CompareLike extends Condition {
private Character getEscapeChar(Value e) throws SQLException {
if (e == null) {
return SysProperties.DEFAULT_ESCAPE_CHAR;
return DEFAULT_ESCAPE_CHAR;
}
String es = e.getString();
Character esc;
if (es == null) {
esc = SysProperties.DEFAULT_ESCAPE_CHAR;
esc = DEFAULT_ESCAPE_CHAR;
} else if (es.length() == 0) {
esc = null;
} else if (es.length() > 1) {
......
......@@ -1419,9 +1419,14 @@ public class JdbcConnection extends TraceObject implements Connection {
executingStatement = stat;
}
ResultInterface getGeneratedKeys() throws SQLException {
/**
* INTERNAL
*/
ResultSet getGeneratedKeys(JdbcStatement stat, int id) throws SQLException {
getGeneratedKeys = prepareCommand("CALL SCOPE_IDENTITY()", getGeneratedKeys);
return getGeneratedKeys.executeQuery(0, false);
ResultInterface result = getGeneratedKeys.executeQuery(0, false);
ResultSet rs = new JdbcResultSet(this, stat, result, id, false, true, false);
return rs;
}
/**
......
......@@ -661,9 +661,7 @@ public class JdbcStatement extends TraceObject implements Statement {
debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "getGeneratedKeys()");
}
checkClosed();
ResultInterface result = conn.getGeneratedKeys();
ResultSet rs = new JdbcResultSet(conn, this, result, id, false, true, false);
return rs;
return conn.getGeneratedKeys(this, id);
} catch (Exception e) {
throw logAndConvert(e);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论