Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7f06fba8
提交
7f06fba8
authored
4月 17, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
97ba2179
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
101 行增加
和
37 行删除
+101
-37
build.bat
h2/build.bat
+1
-1
build.sh
h2/build.sh
+1
-1
changelog.html
h2/src/docsrc/html/changelog.html
+9
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+16
-0
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+6
-1
MultiVersionIndex.java
h2/src/main/org/h2/index/MultiVersionIndex.java
+1
-0
DataPage.java
h2/src/main/org/h2/store/DataPage.java
+4
-2
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+3
-1
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+6
-3
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+13
-8
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+20
-1
test.in.txt
h2/src/test/org/h2/test/test.in.txt
+2
-2
Build.java
h2/src/tools/org/h2/build/Build.java
+1
-1
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+16
-13
CheckTextFiles.java
h2/src/tools/org/h2/build/code/CheckTextFiles.java
+1
-1
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-1
没有找到文件。
h2/build.bat
浏览文件 @
7f06fba8
...
...
@@ -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
h2/build.sh
浏览文件 @
7f06fba8
...
...
@@ -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:t
arget
"
org.h2.build.Build
$@
java
-cp
"bin:
$JAVA_HOME
/lib/tools.jar:t
emp
"
org.h2.build.Build
$@
h2/src/docsrc/html/changelog.html
浏览文件 @
7f06fba8
...
...
@@ -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
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
7f06fba8
...
...
@@ -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
;
...
...
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
7f06fba8
...
...
@@ -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
;
}
}
h2/src/main/org/h2/index/MultiVersionIndex.java
浏览文件 @
7f06fba8
...
...
@@ -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
];
}
...
...
h2/src/main/org/h2/store/DataPage.java
浏览文件 @
7f06fba8
...
...
@@ -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
;
}
...
...
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
7f06fba8
...
...
@@ -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
=
""
;
...
...
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
7f06fba8
...
...
@@ -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
()
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
7f06fba8
...
...
@@ -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:
...
...
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
7f06fba8
...
...
@@ -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"
);
...
...
h2/src/test/org/h2/test/test.in.txt
浏览文件 @
7f06fba8
...
...
@@ -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
...
...
h2/src/tools/org/h2/build/Build.java
浏览文件 @
7f06fba8
...
...
@@ -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
);
...
...
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
7f06fba8
...
...
@@ -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
);
}
...
...
h2/src/tools/org/h2/build/code/CheckTextFiles.java
浏览文件 @
7f06fba8
...
...
@@ -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
);
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
7f06fba8
...
...
@@ -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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论