提交 7f06fba8 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 97ba2179
......@@ -4,4 +4,4 @@ if exist bin/org/h2/build/Build.class goto buildOK
if not exist bin mkdir bin
javac -sourcepath src/tools -d bin src/tools/org/h2/build/*.java
:buildOK
java -cp "bin;%JAVA_HOME%/lib/tools.jar;target" org.h2.build.Build %1 %2 %3 %4 %5
\ No newline at end of file
java -cp "bin;%JAVA_HOME%/lib/tools.jar;temp" org.h2.build.Build %1 %2 %3 %4 %5
\ No newline at end of file
......@@ -8,4 +8,4 @@ if [ ! -f "bin/org/h2/build/Build.class" ] ; then
fi
javac -sourcepath src/tools -d bin src/tools/org/h2/build/*.java
fi
java -cp "bin:$JAVA_HOME/lib/tools.jar:target" org.h2.build.Build $@
java -cp "bin:$JAVA_HOME/lib/tools.jar:temp" org.h2.build.Build $@
......@@ -14,7 +14,15 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>The autocomplete in the H2 Console has been improved a bit.
<ul><li>Multi version concurrency (MVCC): when a row was updated,
and the updated column was not indexed, this update was visible sometimes
for other sessions even if it was not committed.
</li><li>Calling SHUTDOWN on one connection and starting a query on
another connection concurrently could result in a Java level deadlock.
</li><li>New system property h2.enableAnonymousSSL (default: true) to enable
anonymous SSL connections.
</li><li>The precision if SUBSTR is now calculated if possible.
</li><li>The autocomplete in the H2 Console has been improved a bit.
</li><li>The tools in the H2 Console are now translatable.
</li><li>The servlet and lucene jar files are now automatically downloaded when building.
</li><li>The code switch tool has been replaced by a simpler tool called
......
......@@ -1614,6 +1614,22 @@ public class Function extends Expression implements FunctionCall {
displaySize = Integer.MAX_VALUE;
break;
}
case SUBSTRING:
case SUBSTR: {
precision = args[0].getPrecision();
if (args[1].isConstant()) {
// if only two arguments are used,
// subtract offset from first argument length
precision -= args[1].getValue(session).getLong() - 1;
}
if (args.length == 3 && args[2].isConstant()) {
// if the third argument is constant it is at most this value
precision = Math.min(precision, args[2].getValue(session).getLong());
}
precision = Math.max(0, precision);
displaySize = MathUtils.convertLongToInt(precision);
break;
}
default:
dataType = info.dataType;
precision = 0;
......
......@@ -36,6 +36,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
protected Table table;
protected IndexType indexType;
protected long rowCount;
protected boolean isMultiVersion;
public void initBaseIndex(Table table, int id, String name, IndexColumn[] indexColumns, IndexType indexType) {
initSchemaObjectBase(table.getSchema(), id, name, Trace.INDEX);
......@@ -249,7 +250,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
int k1 = rowData.getPos();
int k2 = compare.getPos();
if (k1 == k2) {
if (database.isMultiVersion()) {
if (isMultiVersion) {
int v1 = rowData.getVersion();
int v2 = compare.getVersion();
return v1 == v2 ? 0 : v1 < v2 ? 1 : -1;
......@@ -340,5 +341,9 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
public void commit(int operation, Row row) throws SQLException {
}
public void setMultiVersion(boolean multiVersion) {
this.isMultiVersion = multiVersion;
}
}
......@@ -38,6 +38,7 @@ public class MultiVersionIndex implements Index {
this.table = table;
IndexType deltaIndexType = IndexType.createNonUnique(false);
this.delta = new TreeIndex(table, -1, "DELTA", base.getIndexColumns(), deltaIndexType);
delta.setMultiVersion(true);
this.sync = base.getDatabase();
this.firstColumn = base.getColumns()[0];
}
......
......@@ -478,14 +478,16 @@ public abstract class DataPage {
int objectId = readInt();
long precision = 0;
boolean compression = false;
// -2 is for historical reasons (-1 didn't store precision)
// -1: historical (didn't store precision)
// -2: regular
// -3: regular, but not linked (in this case: including file name)
if (smallLen == -2 || smallLen == -3) {
precision = readLong();
compression = readByte() == 1;
}
ValueLob lob = ValueLob.open(dataType, handler, tableId, objectId, precision, compression);
if (smallLen == -3) {
lob.setFileName(readString());
lob.setFileName(readString(), false);
}
return lob;
}
......
......@@ -156,7 +156,9 @@ public class TableLink extends Table {
try {
rs = meta.getPrimaryKeys(null, null, originalTable);
} catch (SQLException e) {
// Some ODBC bridge drivers don't support it.
// Some ODBC bridge drivers don't support it:
// some combinations of "DataDirect SequeLink(R) for JDBC"
// http://www.datadirect.com/index.ssp
rs = null;
}
String pkName = "";
......
......@@ -446,8 +446,10 @@ public class ValueLob extends Value {
if (!linked) {
this.tableId = tabId;
String live = getFileName(handler, tableId, objectId);
tempFile.stopAutoDelete();
tempFile = null;
if (tempFile != null) {
tempFile.stopAutoDelete();
tempFile = null;
}
renameFile(handler, fileName, live);
fileName = live;
linked = true;
......@@ -695,8 +697,9 @@ public class ValueLob extends Value {
}
}
public void setFileName(String fileName) {
public void setFileName(String fileName, boolean linked) {
this.fileName = fileName;
this.linked = linked;
}
public int getMemory() {
......
......@@ -159,6 +159,19 @@ java org.h2.test.TestAll timer
/*
fix ee te
drop table t1;
drop table t2;
create table t1 (id int primary key);
@LOOP 1000 insert into t1 values(?);
create table t2 (id int primary key);
@LOOP 1000 insert into t2 values(?);
explain select count(*) from t1 where t1.id in ( select t2.id from t2 );
select count(*) from t1 where t1.id in ( select t2.id from t2 );
select count(*) from t1 inner join t2 on t1.id = t2.id;
test case for out of memory (try to corrupt the database using out of memory)
analyzer configuration option for the fulltext search
......@@ -210,14 +223,6 @@ Add where required // TODO: change in version 1.1
http://www.w3schools.com/sql/
History:
Multi version concurrency (MVCC): when a row was updated,
and the updated column was not indexed,
this update was visible sometimes for other sessions even if it was
not committed
Calling SHUTDOWN on one connection and starting a query on
another connection concurrently could result in a Java level deadlock.
New system property h2.enableAnonymousSSL (default: true) to enable
anonymous SSL connections.
Roadmap:
......
......@@ -40,7 +40,7 @@ public class TestResultSet extends TestBase {
stat = conn.createStatement();
testFindColumn();
testSubstringPrecision();
testColumnLength();
testArray();
testLimitMaxRows();
......@@ -63,6 +63,25 @@ public class TestResultSet extends TestBase {
conn.close();
}
private void checkPrecision(int expected, String sql) throws Exception {
ResultSetMetaData meta = stat.executeQuery(sql).getMetaData();
check(expected, meta.getPrecision(1));
}
private void testSubstringPrecision() throws Exception {
trace("testSubstringPrecision");
stat.execute("CREATE TABLE TEST(ID INT, NAME VARCHAR(10))");
stat.execute("INSERT INTO TEST VALUES(1, 'Hello'), (2, 'WorldPeace')");
checkPrecision(9, "SELECT SUBSTR(NAME, 2) FROM TEST");
checkPrecision(10, "SELECT SUBSTR(NAME, ID) FROM TEST");
checkPrecision(4, "SELECT SUBSTR(NAME, 2, 4) FROM TEST");
checkPrecision(0, "SELECT SUBSTR(NAME, 12, 4) FROM TEST");
checkPrecision(3, "SELECT SUBSTR(NAME, 8, 4) FROM TEST");
checkPrecision(4, "SELECT SUBSTR(NAME, 7, 4) FROM TEST");
checkPrecision(8, "SELECT SUBSTR(NAME, 3, ID*0) FROM TEST");
stat.execute("DROP TABLE TEST");
}
private void testFindColumn() throws Exception {
trace("testFindColumn");
......
......@@ -1543,8 +1543,8 @@ CREATE ALIAS PARSE_INT2 FOR "java.lang.Integer.parseInt(java.lang.String, int)";
> ok
select min(SUBSTRING(random_uuid(), 15,1)='4') from system_range(1, 10);
> MIN(SUBSTRING(RANDOM_UUID(), 15, 1) = '4')
> ------------------------------------------
> MIN(CAST(SUBSTRING(RANDOM_UUID(), 15, 1) AS VARCHAR(1)) = '4')
> --------------------------------------------------------------
> TRUE
> rows: 1
......
......@@ -22,11 +22,11 @@ public class Build extends BuildBase {
public void all() {
jarSmall();
javadoc();
docs();
}
public void docs() {
javadoc();
copy("docs", getFiles("src/docsrc/index.html"), "src/docsrc");
java("org.h2.build.code.CheckJavadoc", null);
java("org.h2.build.code.CheckTextFiles", null);
......
......@@ -59,19 +59,22 @@ public class BuildBase {
break;
}
out.println("Running target " + a);
try {
try {
m.invoke(this, new Object[0]);
} catch (InvocationTargetException e) {
throw e.getTargetException();
}
} catch (Throwable e) {
throw new Error(e);
}
invoke(m, this, new Object[0]);
}
}
out.println("Done in " + (System.currentTimeMillis() - time) + " ms");
}
private Object invoke(Method m, Object instance, Object[] args) {
try {
try {
return m.invoke(instance, args);
} catch (InvocationTargetException e) {
throw e.getCause();
}
} catch (Throwable e) {
throw e instanceof Error ? ((Error) e) : new Error(e);
}
}
protected void all() {
......@@ -146,7 +149,7 @@ public class BuildBase {
try {
Class clazz = Class.forName("com.sun.tools.javadoc.Main");
Method execute = clazz.getMethod("execute", new Class[] { String[].class });
result = ((Integer) execute.invoke(null, new Object[] { args })).intValue();
result = ((Integer) invoke(execute, null, new Object[] { args })).intValue();
} catch (Exception e) {
result = exec("javadoc", args);
}
......@@ -384,7 +387,7 @@ public class BuildBase {
Class clazz = Class.forName("com.sun.tools.javac.Main");
Method compile = clazz.getMethod("compile", new Class[] { String[].class });
Object instance = clazz.newInstance();
result = ((Integer) compile.invoke(instance, new Object[] { args })).intValue();
result = ((Integer) invoke(compile, instance, new Object[] { args })).intValue();
} catch (Exception e) {
e.printStackTrace();
result = exec("javac", args);
......@@ -401,7 +404,7 @@ public class BuildBase {
}
try {
Method main = Class.forName(className).getMethod("main", new Class[] { String[].class });
main.invoke(null, new Object[] { args });
invoke(main, null, new Object[] { args });
} catch (Exception e) {
throw new Error(e);
}
......
......@@ -91,7 +91,7 @@ public class CheckTextFiles {
}
}
if (ignore == check) {
throw new Error("Unknown suffix: " + suffix + " for file: " + name);
throw new Error("Unknown suffix: " + suffix + " for file: " + file.getAbsolutePath());
}
if (check) {
checkOrFixFile(file, autoFix, checkLicense);
......
......@@ -494,4 +494,4 @@ delays guess downloaded jars advantages interrupt javen sourcepath unneeded
compressibility ext crc enumerate components mkdir jant downloading mismatch
timebomb thinks technotes chmod overloading javase flux solves fastest
quickstarter bridge bpm trust guides improvements customizing easiest
workflow
\ No newline at end of file
workflow seque
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论