提交 4f64bcd2 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Replace conditions that check Constants.VERSION_MINOR with constants

上级 82ffee2e
...@@ -329,10 +329,10 @@ public class DbSettings extends SettingsBase { ...@@ -329,10 +329,10 @@ public class DbSettings extends SettingsBase {
/** /**
* Database setting <code>MV_STORE</code> * Database setting <code>MV_STORE</code>
* (default: false for version 1.3, true for version 1.4).<br /> * (default: true).<br />
* Use the MVStore storage engine. * Use the MVStore storage engine.
*/ */
public boolean mvStore = get("MV_STORE", Constants.VERSION_MINOR >= 4); public boolean mvStore = get("MV_STORE", true);
/** /**
* Database setting <code>COMPRESS</code> * Database setting <code>COMPRESS</code>
......
...@@ -332,12 +332,11 @@ public class SysProperties { ...@@ -332,12 +332,11 @@ public class SysProperties {
/** /**
* System property <code>h2.oldStyleOuterJoin</code> * System property <code>h2.oldStyleOuterJoin</code>
* (default: true for version 1.3, false for version 1.4).<br /> * (default: false).<br />
* Limited support for the old-style Oracle outer join with "(+)". * Limited support for the old-style Oracle outer join with "(+)".
*/ */
public static final boolean OLD_STYLE_OUTER_JOIN = public static final boolean OLD_STYLE_OUTER_JOIN =
Utils.getProperty("h2.oldStyleOuterJoin", Utils.getProperty("h2.oldStyleOuterJoin", false);
Constants.VERSION_MINOR < 4);
/** /**
* System property {@code h2.oldResultSetGetObject}, {@code true} by default. * System property {@code h2.oldResultSetGetObject}, {@code true} by default.
...@@ -439,13 +438,12 @@ public class SysProperties { ...@@ -439,13 +438,12 @@ public class SysProperties {
/** /**
* System property <code>h2.sortBinaryUnsigned</code> * System property <code>h2.sortBinaryUnsigned</code>
* (default: false with version 1.3, true with version 1.4).<br /> * (default: true).<br />
* Whether binary data should be sorted in unsigned mode * Whether binary data should be sorted in unsigned mode
* (0xff is larger than 0x00). * (0xff is larger than 0x00).
*/ */
public static final boolean SORT_BINARY_UNSIGNED = public static final boolean SORT_BINARY_UNSIGNED =
Utils.getProperty("h2.sortBinaryUnsigned", Utils.getProperty("h2.sortBinaryUnsigned", true);
Constants.VERSION_MINOR >= 4);
/** /**
* System property <code>h2.sortNullsHigh</code> (default: false).<br /> * System property <code>h2.sortNullsHigh</code> (default: false).<br />
...@@ -493,13 +491,12 @@ public class SysProperties { ...@@ -493,13 +491,12 @@ public class SysProperties {
/** /**
* System property <code>h2.implicitRelativePath</code> * System property <code>h2.implicitRelativePath</code>
* (default: true for version 1.3, false for version 1.4).<br /> * (default: false).<br />
* If disabled, relative paths in database URLs need to be written as * If disabled, relative paths in database URLs need to be written as
* jdbc:h2:./test instead of jdbc:h2:test. * jdbc:h2:./test instead of jdbc:h2:test.
*/ */
public static final boolean IMPLICIT_RELATIVE_PATH = public static final boolean IMPLICIT_RELATIVE_PATH =
Utils.getProperty("h2.implicitRelativePath", Utils.getProperty("h2.implicitRelativePath", false);
Constants.VERSION_MINOR < 4);
/** /**
* System property <code>h2.urlMap</code> (default: null).<br /> * System property <code>h2.urlMap</code> (default: null).<br />
......
...@@ -286,7 +286,7 @@ java org.h2.test.TestAll timer ...@@ -286,7 +286,7 @@ java org.h2.test.TestAll timer
/** /**
* Whether the MVStore storage is used. * Whether the MVStore storage is used.
*/ */
public boolean mvStore = Constants.VERSION_MINOR >= 4; public boolean mvStore = true;
/** /**
* If the test should run with many rows. * If the test should run with many rows.
......
...@@ -20,7 +20,7 @@ import java.util.List; ...@@ -20,7 +20,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.h2.api.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.engine.Constants; import org.h2.engine.SysProperties;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase; import org.h2.test.TestBase;
...@@ -1265,23 +1265,21 @@ public class TestCases extends TestBase { ...@@ -1265,23 +1265,21 @@ public class TestCases extends TestBase {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
ResultSet rs; ResultSet rs;
// test the default (SIGNED) // test the SIGNED mode
if (Constants.VERSION_MINOR < 4) { stat.execute("SET BINARY_COLLATION SIGNED");
stat.execute("create table bin( x binary(1) );"); stat.execute("create table bin( x binary(1) );");
stat.execute("insert into bin(x) values (x'09'),(x'0a'),(x'99'),(x'aa');"); stat.execute("insert into bin(x) values (x'09'),(x'0a'),(x'99'),(x'aa');");
rs = stat.executeQuery("select * from bin order by x;"); rs = stat.executeQuery("select * from bin order by x;");
rs.next(); rs.next();
assertEquals("99", rs.getString(1)); assertEquals("99", rs.getString(1));
rs.next(); rs.next();
assertEquals("aa", rs.getString(1)); assertEquals("aa", rs.getString(1));
rs.next(); rs.next();
assertEquals("09", rs.getString(1)); assertEquals("09", rs.getString(1));
rs.next(); rs.next();
assertEquals("0a", rs.getString(1)); assertEquals("0a", rs.getString(1));
stat.execute("drop table bin"); stat.execute("drop table bin");
} // test UNSIGNED mode (default)
// test UNSIGNED mode
stat.execute("SET BINARY_COLLATION UNSIGNED"); stat.execute("SET BINARY_COLLATION UNSIGNED");
stat.execute("create table bin( x binary(1) );"); stat.execute("create table bin( x binary(1) );");
stat.execute("insert into bin(x) values (x'09'),(x'0a'),(x'99'),(x'aa');"); stat.execute("insert into bin(x) values (x'09'),(x'0a'),(x'99'),(x'aa');");
...@@ -1294,6 +1292,9 @@ public class TestCases extends TestBase { ...@@ -1294,6 +1292,9 @@ public class TestCases extends TestBase {
assertEquals("99", rs.getString(1)); assertEquals("99", rs.getString(1));
rs.next(); rs.next();
assertEquals("aa", rs.getString(1)); assertEquals("aa", rs.getString(1));
stat.execute("drop table bin");
stat.execute("SET BINARY_COLLATION "
+ (SysProperties.SORT_BINARY_UNSIGNED ? "UNSIGNED" : "SIGNED"));
conn.close(); conn.close();
} }
......
...@@ -45,7 +45,7 @@ public class TestSpaceReuse extends TestBase { ...@@ -45,7 +45,7 @@ public class TestSpaceReuse extends TestBase {
conn.createStatement().execute("delete from t"); conn.createStatement().execute("delete from t");
conn.close(); conn.close();
String fileName = getBaseDir() + "/spaceReuse"; String fileName = getBaseDir() + "/spaceReuse";
if (Constants.VERSION_MINOR >= 4) { if (config.mvStore) {
fileName += Constants.SUFFIX_MV_FILE; fileName += Constants.SUFFIX_MV_FILE;
} else { } else {
fileName += Constants.SUFFIX_PAGE_FILE; fileName += Constants.SUFFIX_PAGE_FILE;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论