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