Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2585b4ea
提交
2585b4ea
authored
14 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Various smaller changes (FindBugs)
上级
8b1510e3
隐藏空白字符变更
内嵌
并排
正在显示
54 个修改的文件
包含
181 行增加
和
89 行删除
+181
-89
CreateView.java
h2/src/main/org/h2/command/ddl/CreateView.java
+1
-1
Constants.java
h2/src/main/org/h2/engine/Constants.java
+1
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+4
-8
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+1
-1
DbStarter.java
h2/src/main/org/h2/server/web/DbStarter.java
+4
-1
FileLock.java
h2/src/main/org/h2/store/FileLock.java
+1
-1
LobStorage.java
h2/src/main/org/h2/store/LobStorage.java
+2
-5
Page.java
h2/src/main/org/h2/store/Page.java
+3
-4
PageStreamTrunk.java
h2/src/main/org/h2/store/PageStreamTrunk.java
+1
-1
CreateCluster.java
h2/src/main/org/h2/tools/CreateCluster.java
+3
-1
Recover.java
h2/src/main/org/h2/tools/Recover.java
+1
-1
MathUtils.java
h2/src/main/org/h2/util/MathUtils.java
+1
-0
Compact.java
h2/src/test/org/h2/samples/Compact.java
+1
-0
DirectInsert.java
h2/src/test/org/h2/samples/DirectInsert.java
+3
-0
FileFunctions.java
h2/src/test/org/h2/samples/FileFunctions.java
+1
-0
Function.java
h2/src/test/org/h2/samples/Function.java
+6
-5
FunctionMultiReturn.java
h2/src/test/org/h2/samples/FunctionMultiReturn.java
+3
-1
HelloWorld.java
h2/src/test/org/h2/samples/HelloWorld.java
+1
-0
InitDatabaseFromJar.java
h2/src/test/org/h2/samples/InitDatabaseFromJar.java
+5
-1
SQLInjection.java
h2/src/test/org/h2/samples/SQLInjection.java
+11
-0
SecurePassword.java
h2/src/test/org/h2/samples/SecurePassword.java
+7
-0
ShowProgress.java
h2/src/test/org/h2/samples/ShowProgress.java
+2
-0
TriggerPassData.java
h2/src/test/org/h2/samples/TriggerPassData.java
+1
-0
TriggerSample.java
h2/src/test/org/h2/samples/TriggerSample.java
+2
-0
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+1
-3
Database.java
h2/src/test/org/h2/test/bench/Database.java
+1
-1
TestCluster.java
h2/src/test/org/h2/test/db/TestCluster.java
+1
-1
TestFullText.java
h2/src/test/org/h2/test/db/TestFullText.java
+1
-1
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+2
-2
TestOptimizations.java
h2/src/test/org/h2/test/db/TestOptimizations.java
+2
-2
TestQueryCache.java
h2/src/test/org/h2/test/db/TestQueryCache.java
+3
-2
TestRecursiveQueries.java
h2/src/test/org/h2/test/db/TestRecursiveQueries.java
+1
-1
TestRights.java
h2/src/test/org/h2/test/db/TestRights.java
+2
-2
TestTransaction.java
h2/src/test/org/h2/test/db/TestTransaction.java
+0
-2
UpdateTest.java
h2/src/test/org/h2/test/jaqu/UpdateTest.java
+2
-2
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+6
-6
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+2
-1
TestUpdatableResultSet.java
h2/src/test/org/h2/test/jdbc/TestUpdatableResultSet.java
+1
-1
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+7
-6
TestJoin.java
h2/src/test/org/h2/test/synth/TestJoin.java
+1
-1
Value.java
h2/src/test/org/h2/test/synth/sql/Value.java
+6
-6
test-1.3.txt
h2/src/test/org/h2/test/test-1.3.txt
+57
-0
Parser.java
h2/src/test/org/h2/test/trace/Parser.java
+5
-5
Player.java
h2/src/test/org/h2/test/trace/Player.java
+1
-0
TestCache.java
h2/src/test/org/h2/test/unit/TestCache.java
+1
-1
TestJmx.java
h2/src/test/org/h2/test/unit/TestJmx.java
+0
-1
TestNetUtils.java
h2/src/test/org/h2/test/unit/TestNetUtils.java
+1
-1
TestOldVersion.java
h2/src/test/org/h2/test/unit/TestOldVersion.java
+1
-1
TestPageStore.java
h2/src/test/org/h2/test/unit/TestPageStore.java
+1
-1
TestPageStoreCoverage.java
h2/src/test/org/h2/test/unit/TestPageStoreCoverage.java
+1
-0
TestReopen.java
h2/src/test/org/h2/test/unit/TestReopen.java
+2
-1
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+2
-2
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+3
-3
Function.java
h2/src/tools/org/h2/jaqu/Function.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/ddl/CreateView.java
浏览文件 @
2585b4ea
...
...
@@ -177,7 +177,7 @@ public class CreateView extends SchemaCommand {
* work with TableViews directly because they become invalid when we drop
* the parent view.
*/
private
class
DependentView
{
private
static
class
DependentView
{
String
viewName
;
String
createSql
;
String
createForceSql
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
2585b4ea
...
...
@@ -64,7 +64,7 @@ public class Constants {
/**
* The minor version of this database.
*/
public
static
final
int
VERSION_MINOR
=
3
;
public
static
final
int
VERSION_MINOR
=
2
;
// Build.getLuceneVersion() uses an ugly hack to read this value
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Function.java
浏览文件 @
2585b4ea
...
...
@@ -102,8 +102,6 @@ public class Function extends Expression implements FunctionCall {
private
static
final
HashMap
<
String
,
FunctionInfo
>
FUNCTIONS
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
Integer
>
DATE_PART
=
New
.
hashMap
();
private
static
final
SimpleDateFormat
FORMAT_DAYNAME
=
new
SimpleDateFormat
(
"EEEE"
,
Locale
.
ENGLISH
);
private
static
final
SimpleDateFormat
FORMAT_MONTHNAME
=
new
SimpleDateFormat
(
"MMMM"
,
Locale
.
ENGLISH
);
private
static
final
char
[]
SOUNDEX_INDEX
=
new
char
[
128
];
protected
Expression
[]
args
;
...
...
@@ -605,9 +603,8 @@ public class Function extends Expression implements FunctionCall {
result
=
ValueString
.
get
(
StringUtils
.
xmlText
(
v0
.
getString
()));
break
;
case
DAY_NAME:
{
synchronized
(
FORMAT_DAYNAME
)
{
result
=
ValueString
.
get
(
FORMAT_DAYNAME
.
format
(
v0
.
getDateNoCopy
()));
}
SimpleDateFormat
dayName
=
new
SimpleDateFormat
(
"EEEE"
,
Locale
.
ENGLISH
);
result
=
ValueString
.
get
(
dayName
.
format
(
v0
.
getDateNoCopy
()));
break
;
}
case
DAY_OF_MONTH:
...
...
@@ -629,9 +626,8 @@ public class Function extends Expression implements FunctionCall {
result
=
ValueInt
.
get
(
DateTimeUtils
.
getDatePart
(
v0
.
getDateNoCopy
(),
Calendar
.
MONTH
));
break
;
case
MONTH_NAME:
{
synchronized
(
FORMAT_MONTHNAME
)
{
result
=
ValueString
.
get
(
FORMAT_MONTHNAME
.
format
(
v0
.
getDateNoCopy
()));
}
SimpleDateFormat
monthName
=
new
SimpleDateFormat
(
"MMMM"
,
Locale
.
ENGLISH
);
result
=
ValueString
.
get
(
monthName
.
format
(
v0
.
getDateNoCopy
()));
break
;
}
case
QUARTER:
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
2585b4ea
...
...
@@ -1142,7 +1142,7 @@ public class JdbcConnection extends TraceObject implements Connection {
*/
String
translateSQL
(
String
sql
,
boolean
escapeProcessing
)
{
if
(
sql
==
null
)
{
throw
DbException
.
getInvalidValueException
(
"SQL"
,
sq
l
);
throw
DbException
.
getInvalidValueException
(
"SQL"
,
nul
l
);
}
if
(!
escapeProcessing
)
{
return
sql
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/DbStarter.java
浏览文件 @
2585b4ea
...
...
@@ -8,6 +8,7 @@ package org.h2.server.web;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.Statement
;
import
javax.servlet.ServletContext
;
import
javax.servlet.ServletContextEvent
;
...
...
@@ -70,7 +71,9 @@ public class DbStarter implements ServletContextListener {
public
void
contextDestroyed
(
ServletContextEvent
servletContextEvent
)
{
try
{
conn
.
createStatement
().
execute
(
"SHUTDOWN"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SHUTDOWN"
);
stat
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/FileLock.java
浏览文件 @
2585b4ea
...
...
@@ -276,7 +276,7 @@ public class FileLock implements Runnable {
// lock file modified in the future -
// wait for a bit longer than usual
try
{
Thread
.
sleep
(
2
*
sleep
);
Thread
.
sleep
(
2
*
(
long
)
sleep
);
}
catch
(
Exception
e
)
{
trace
.
debug
(
e
,
"sleep"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/LobStorage.java
浏览文件 @
2585b4ea
...
...
@@ -100,6 +100,7 @@ public class LobStorage {
rs
=
stat
.
executeQuery
(
"SELECT MAX(BLOCK) FROM "
+
LOB_DATA
);
rs
.
next
();
nextBlock
=
rs
.
getLong
(
1
)
+
1
;
stat
.
close
();
}
catch
(
SQLException
e
)
{
throw
DbException
.
convert
(
e
);
}
...
...
@@ -602,11 +603,7 @@ public class LobStorage {
PreparedStatement
prep
=
prepare
(
"UPDATE "
+
LOBS
+
" SET TABLE = ? WHERE ID = ?"
);
prep
.
setInt
(
1
,
table
);
prep
.
setLong
(
2
,
lobId
);
int
updateCount
=
prep
.
executeUpdate
();
if
(
updateCount
!=
1
)
{
// can be zero when recovering
// throw DbException.throwInternalError("count: " + updateCount);
}
prep
.
executeUpdate
();
}
catch
(
SQLException
e
)
{
throw
DbException
.
convert
(
e
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/Page.java
浏览文件 @
2585b4ea
...
...
@@ -100,10 +100,9 @@ public abstract class Page extends CacheObject {
* @return the (new) array
*/
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
[]
insert
(
T
[]
old
,
int
oldSize
,
int
pos
,
T
x
)
{
public
static
<
T
>
T
[]
insert
(
T
[]
old
,
int
oldSize
,
int
pos
,
T
x
)
{
T
[]
result
;
if
(
old
!=
null
&&
old
.
length
>
oldSize
)
{
if
(
old
.
length
>
oldSize
)
{
result
=
old
;
}
else
{
// according to a test, this is as fast as "new Row[..]"
...
...
@@ -112,7 +111,7 @@ public abstract class Page extends CacheObject {
System
.
arraycopy
(
old
,
0
,
result
,
0
,
pos
);
}
}
if
(
old
!=
null
&&
old
Size
-
pos
>
0
)
{
if
(
oldSize
-
pos
>
0
)
{
System
.
arraycopy
(
old
,
pos
,
result
,
pos
+
1
,
oldSize
-
pos
);
}
result
[
pos
]
=
x
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/PageStreamTrunk.java
浏览文件 @
2585b4ea
...
...
@@ -115,7 +115,7 @@ public class PageStreamTrunk extends Page {
if
(
index
>=
pageIds
.
length
)
{
return
-
1
;
}
return
pageIds
[
index
++
];
return
pageIds
[
index
];
}
public
void
write
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/CreateCluster.java
浏览文件 @
2585b4ea
...
...
@@ -107,7 +107,9 @@ public class CreateCluster extends Tool {
boolean
exists
=
true
;
try
{
connTarget
=
DriverManager
.
getConnection
(
urlTarget
+
";IFEXISTS=TRUE;CLUSTER="
+
Constants
.
CLUSTERING_ENABLED
,
user
,
password
);
connTarget
.
createStatement
().
execute
(
"DROP ALL OBJECTS DELETE FILES"
);
Statement
stat
=
connTarget
.
createStatement
();
stat
.
execute
(
"DROP ALL OBJECTS DELETE FILES"
);
stat
.
close
();
exists
=
false
;
connTarget
.
close
();
}
catch
(
SQLException
e
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
2585b4ea
...
...
@@ -86,7 +86,7 @@ public class Recover extends Tool implements DataHandler {
/**
* Statistic data
*/
class
Stats
{
static
class
Stats
{
/**
* The empty space in bytes in a data leaf pages.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/MathUtils.java
浏览文件 @
2585b4ea
...
...
@@ -123,6 +123,7 @@ public class MathUtils {
}
}
catch
(
Exception
e
)
{
// nanoTime not found, this is ok (only exists for JDK 1.5 and higher)
out
.
writeUTF
(
e
.
toString
());
}
// memory
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/Compact.java
浏览文件 @
2585b4ea
...
...
@@ -36,6 +36,7 @@ public class Compact {
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World');"
);
stat
.
close
();
conn
.
close
();
System
.
out
.
println
(
"Compacting..."
);
compact
(
"data"
,
"test"
,
"sa"
,
""
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/DirectInsert.java
浏览文件 @
2585b4ea
...
...
@@ -53,6 +53,8 @@ public class DirectInsert {
prep
.
execute
();
}
conn
.
commit
();
prep
.
close
();
stat
.
close
();
conn
.
close
();
}
...
...
@@ -65,6 +67,7 @@ public class DirectInsert {
stat
.
execute
(
"CREATE TABLE TEST2 AS SELECT * FROM TEST"
);
System
.
out
.
printf
(
"%.3f sec.\n"
,
(
System
.
currentTimeMillis
()
-
time
)
/
1000.0
);
stat
.
execute
(
"INSERT INTO TEST2 SELECT * FROM TEST2"
);
stat
.
close
();
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/FileFunctions.java
浏览文件 @
2585b4ea
...
...
@@ -40,6 +40,7 @@ public class FileFunctions {
rs
.
next
();
String
text
=
rs
.
getString
(
1
);
System
.
out
.
println
(
"text: "
+
text
);
stat
.
close
();
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/Function.java
浏览文件 @
2585b4ea
...
...
@@ -51,14 +51,14 @@ public class Function {
PreparedStatement
prep
;
prep
=
conn
.
prepareStatement
(
"SELECT * FROM TABLE(X INT=?, O INT=?) J "
+
"INNER JOIN TEST T ON J.X=T.ID ORDER BY J.O"
);
prep
.
setObject
(
1
,
new
Integer
[]
{
new
Integer
(
30
),
new
Integer
(
20
)
});
prep
.
setObject
(
2
,
new
Integer
[]
{
new
Integer
(
1
),
new
Integer
(
2
)
});
prep
.
setObject
(
1
,
new
Integer
[]
{
30
,
20
});
prep
.
setObject
(
2
,
new
Integer
[]
{
1
,
2
});
rs
=
prep
.
executeQuery
();
while
(
rs
.
next
())
{
System
.
out
.
println
(
rs
.
getInt
(
1
));
}
prep
.
close
();
rs
.
close
();
// Using a custom function like table
stat
.
execute
(
"CREATE ALIAS MATRIX FOR \"org.h2.samples.Function.getMatrix\" "
);
...
...
@@ -69,7 +69,8 @@ public class Function {
while
(
rs
.
next
())
{
System
.
out
.
println
(
rs
.
getInt
(
1
)
+
"/"
+
rs
.
getInt
(
2
));
}
prep
.
close
();
stat
.
close
();
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/FunctionMultiReturn.java
浏览文件 @
2585b4ea
...
...
@@ -69,7 +69,7 @@ public class FunctionMultiReturn {
System
.
out
.
println
(
"(r="
+
r
+
" a="
+
a
+
") : (x="
+
x
+
", y="
+
y
+
")"
);
}
rs
=
conn
.
createStatement
()
.
executeQuery
(
"SELECT R, A, ARRAY_GET(E, 1), ARRAY_GET(E, 2) FROM (SELECT R, A, P2C_A(R, A) E FROM TEST)"
);
rs
=
stat
.
executeQuery
(
"SELECT R, A, ARRAY_GET(E, 1), ARRAY_GET(E, 2) FROM (SELECT R, A, P2C_A(R, A) E FROM TEST)"
);
while
(
rs
.
next
())
{
double
r
=
rs
.
getDouble
(
1
);
double
a
=
rs
.
getDouble
(
2
);
...
...
@@ -77,7 +77,9 @@ public class FunctionMultiReturn {
double
y
=
rs
.
getDouble
(
4
);
System
.
out
.
println
(
"(r="
+
r
+
" a="
+
a
+
") : (x="
+
x
+
", y="
+
y
+
")"
);
}
rs
.
close
();
prep
.
close
();
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/HelloWorld.java
浏览文件 @
2585b4ea
...
...
@@ -41,6 +41,7 @@ public class HelloWorld {
while
(
rs
.
next
())
{
System
.
out
.
println
(
rs
.
getString
(
"name"
));
}
stat
.
close
();
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/InitDatabaseFromJar.java
浏览文件 @
2585b4ea
...
...
@@ -42,6 +42,7 @@ public class InitDatabaseFromJar {
stat
.
execute
(
"CREATE TABLE TEST(NAME VARCHAR)"
);
stat
.
execute
(
"INSERT INTO TEST VALUES('Hello World')"
);
stat
.
execute
(
"SCRIPT TO 'script.sql'"
);
stat
.
close
();
conn
.
close
();
}
...
...
@@ -57,10 +58,13 @@ public class InitDatabaseFromJar {
+
getClass
().
getPackage
().
getName
());
}
else
{
RunScript
.
execute
(
conn
,
new
InputStreamReader
(
in
));
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST"
);
while
(
rs
.
next
())
{
System
.
out
.
println
(
rs
.
getString
(
1
));
}
rs
.
close
();
stat
.
close
();
conn
.
close
();
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/SQLInjection.java
浏览文件 @
2585b4ea
...
...
@@ -212,6 +212,8 @@ public class SQLInjection {
}
else
{
System
.
out
.
println
(
"Access denied!"
);
}
rs
.
close
();
prep
.
close
();
}
/**
...
...
@@ -250,6 +252,8 @@ public class SQLInjection {
}
else
{
System
.
out
.
println
(
"Access denied!"
);
}
rs
.
close
();
prep
.
close
();
}
catch
(
SQLException
e
)
{
System
.
out
.
println
(
e
);
}
...
...
@@ -274,6 +278,8 @@ public class SQLInjection {
}
else
{
System
.
out
.
println
(
"Access denied!"
);
}
rs
.
close
();
prep
.
close
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
}
...
...
@@ -364,9 +370,11 @@ public class SQLInjection {
while
(
rs
.
next
())
{
System
.
out
.
println
(
rs
.
getString
(
1
)
+
": "
+
rs
.
getString
(
2
));
}
rs
.
close
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
}
prep
.
close
();
}
/**
...
...
@@ -402,7 +410,10 @@ public class SQLInjection {
System
.
out
.
println
(
"salt: "
+
rs
.
getString
(
"SALT"
));
System
.
out
.
println
(
"hash: "
+
rs
.
getString
(
"HASH"
));
}
rs
.
close
();
prep
.
close
();
stat
.
execute
(
"SET ALLOW_LITERALS ALL"
);
stat
.
close
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/SecurePassword.java
浏览文件 @
2585b4ea
...
...
@@ -56,11 +56,15 @@ public class SecurePassword {
prep
=
conn
.
prepareStatement
(
"insert into account(name) values(?)"
);
prep
.
setString
(
1
,
"Joe"
);
prep
.
execute
();
prep
.
close
();
prep
=
conn
.
prepareStatement
(
"update account set hash=hash('SHA256', stringtoutf8(salt||?), 10) where name=?"
);
prep
.
setString
(
1
,
"secret"
);
prep
.
setString
(
2
,
"Joe"
);
prep
.
execute
();
prep
.
close
();
prep
=
conn
.
prepareStatement
(
"select * from account where name=? and hash=hash('SHA256', stringtoutf8(salt||?), 10)"
);
prep
.
setString
(
1
,
"Joe"
);
...
...
@@ -69,6 +73,9 @@ public class SecurePassword {
while
(
rs
.
next
())
{
System
.
out
.
println
(
rs
.
getString
(
"name"
));
}
rs
.
close
();
prep
.
close
();
stat
.
close
();
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/ShowProgress.java
浏览文件 @
2585b4ea
...
...
@@ -80,6 +80,8 @@ public class ShowProgress implements DatabaseEventListener {
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:test;DATABASE_EVENT_LISTENER='"
+
getClass
().
getName
()
+
"'"
,
"sa"
,
""
);
time
=
System
.
currentTimeMillis
()
-
time
;
System
.
out
.
println
(
"Done after "
+
time
+
" ms"
);
prep
.
close
();
stat
.
close
();
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/TriggerPassData.java
浏览文件 @
2585b4ea
...
...
@@ -49,6 +49,7 @@ public class TriggerPassData implements Trigger {
stat
.
execute
(
"INSERT INTO TEST VALUES(1)"
);
stat
.
execute
(
"CALL TRIGGER_SET('T1', 'World')"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(2)"
);
stat
.
close
();
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/TriggerSample.java
浏览文件 @
2585b4ea
...
...
@@ -47,6 +47,8 @@ public class TriggerSample {
rs
=
stat
.
executeQuery
(
"SELECT AMOUNT FROM INVOICE_SUM"
);
rs
.
next
();
System
.
out
.
println
(
"The sum is "
+
rs
.
getBigDecimal
(
1
));
rs
.
close
();
stat
.
close
();
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
2585b4ea
...
...
@@ -1150,7 +1150,7 @@ public abstract class TestBase {
*/
protected
void
assertEquals
(
Integer
expected
,
Integer
actual
)
{
if
(
expected
==
null
||
actual
==
null
)
{
assertTrue
(
expected
==
actua
l
);
assertTrue
(
expected
==
null
&&
actual
==
nul
l
);
}
else
{
assertEquals
(
expected
.
intValue
(),
actual
.
intValue
());
}
...
...
@@ -1247,8 +1247,6 @@ public abstract class TestBase {
}
// silly code - makes sure there are no warnings
reserve
[
0
]
=
reserve
[
1
];
// actually it is anyway garbage collected
reserve
=
null
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/Database.java
浏览文件 @
2585b4ea
...
...
@@ -404,7 +404,7 @@ class Database {
*/
void
log
(
String
action
,
String
scale
,
int
value
)
{
if
(
test
.
collect
)
{
results
.
add
(
new
Object
[]
{
action
,
scale
,
new
Integer
(
value
)
});
results
.
add
(
new
Object
[]
{
action
,
scale
,
Integer
.
valueOf
(
value
)
});
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCluster.java
浏览文件 @
2585b4ea
...
...
@@ -216,7 +216,7 @@ public class TestCluster extends TestBase {
// try to connect in standalone mode - should fail
try
{
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:tcp://localhost:"
+
port1
+
"/test"
,
user
,
password
);
DriverManager
.
getConnection
(
"jdbc:h2:tcp://localhost:"
+
port1
+
"/test"
,
user
,
password
);
fail
(
"should not be able to connect in standalone mode"
);
}
catch
(
SQLException
e
)
{
assertKnownException
(
e
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFullText.java
浏览文件 @
2585b4ea
...
...
@@ -389,7 +389,7 @@ public class TestFullText extends TestBase {
conn
=
getConnection
(
"fullText"
);
stat
=
conn
.
createStatement
();
rs
=
stat
.
executeQuery
(
"SELECT * FROM "
+
prefix
+
"SEARCH('World', 0, 0)"
);
stat
.
executeQuery
(
"SELECT * FROM "
+
prefix
+
"SEARCH('World', 0, 0)"
);
stat
.
execute
(
"CALL "
+
prefix
+
"DROP_ALL()"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
2585b4ea
...
...
@@ -380,7 +380,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertEquals
(
"Hello"
,
rs
.
getString
(
2
));
assertFalse
(
rs
.
next
());
rs
=
stat
.
executeQuery
(
"CALL ADD_ROW(2, 'World')"
);
stat
.
executeQuery
(
"CALL ADD_ROW(2, 'World')"
);
stat
.
execute
(
"CREATE ALIAS SELECT_F FOR \""
+
getClass
().
getName
()
+
".select\""
);
rs
=
stat
.
executeQuery
(
"CALL SELECT_F('SELECT * FROM TEST ORDER BY ID')"
);
...
...
@@ -631,7 +631,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
* @return the test array
*/
public
static
Object
[]
getArray
()
{
return
new
Object
[]
{
new
Integer
(
0
)
,
"Hello"
};
return
new
Object
[]
{
0
,
"Hello"
};
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestOptimizations.java
浏览文件 @
2585b4ea
...
...
@@ -496,8 +496,8 @@ public class TestOptimizations extends TestBase {
}
else
{
int
value
=
random
.
nextInt
();
stat
.
execute
(
"insert into test values("
+
i
+
", "
+
value
+
")"
);
map
.
put
(
new
Integer
(
i
),
new
Integer
(
value
)
);
set
.
add
(
new
Integer
(
value
)
);
map
.
put
(
i
,
value
);
set
.
add
(
value
);
}
break
;
case
6
:
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestQueryCache.java
浏览文件 @
2585b4ea
...
...
@@ -31,7 +31,8 @@ public class TestQueryCache extends TestBase {
Connection
conn
=
getConnection
(
"queryCache;QUERY_CACHE_SIZE=10"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int, name varchar) as select x, space(100) from system_range(1, 1000)"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"select count(*) from test t1, test t2"
);
PreparedStatement
prep
;
conn
.
prepareStatement
(
"select count(*) from test t1, test t2"
);
long
time
;
ResultSet
rs
;
long
first
=
0
;
...
...
@@ -42,7 +43,7 @@ public class TestQueryCache extends TestBase {
// stat.execute("drop table x");
time
=
System
.
currentTimeMillis
();
prep
=
conn
.
prepareStatement
(
"select count(*) from test t1, test t2"
);
rs
=
prep
.
executeQuery
();
prep
.
executeQuery
();
rs
=
stat
.
executeQuery
(
"select count(*) from test t1, test t2"
);
rs
.
next
();
int
c
=
rs
.
getInt
(
1
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestRecursiveQueries.java
浏览文件 @
2585b4ea
...
...
@@ -29,7 +29,7 @@ public class TestRecursiveQueries extends TestBase {
public
void
test
()
throws
Exception
{
deleteDb
(
"recursiveQueries"
);
Connection
conn
=
getConnection
(
"recursiveQueries"
);
Statement
stat
=
conn
.
createStatement
()
;
Statement
stat
;
PreparedStatement
prep
,
prep2
;
ResultSet
rs
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestRights.java
浏览文件 @
2585b4ea
...
...
@@ -224,13 +224,13 @@ public class TestRights extends TestBase {
conn
.
close
();
try
{
conn
=
getConnection
(
"rights"
,
"Test"
,
getPassword
(
"abc"
));
getConnection
(
"rights"
,
"Test"
,
getPassword
(
"abc"
));
fail
(
"mixed case user name"
);
}
catch
(
SQLException
e
)
{
assertKnownException
(
e
);
}
try
{
conn
=
getConnection
(
"rights"
,
"TEST"
,
getPassword
(
"abc"
));
getConnection
(
"rights"
,
"TEST"
,
getPassword
(
"abc"
));
fail
(
"wrong password"
);
}
catch
(
SQLException
e
)
{
assertKnownException
(
e
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestTransaction.java
浏览文件 @
2585b4ea
...
...
@@ -146,7 +146,6 @@ public class TestTransaction extends TestBase {
if
(!
config
.
memory
)
{
conn
.
close
();
conn
=
getConnection
(
"transaction"
);
stat
=
conn
.
createStatement
();
}
stat
=
conn
.
createStatement
();
try
{
...
...
@@ -194,7 +193,6 @@ public class TestTransaction extends TestBase {
if
(!
config
.
memory
)
{
conn
.
close
();
conn
=
getConnection
(
"transaction"
);
stat
=
conn
.
createStatement
();
}
stat
=
conn
.
createStatement
();
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jaqu/UpdateTest.java
浏览文件 @
2585b4ea
...
...
@@ -56,7 +56,7 @@ public class UpdateTest extends TestBase {
Product
p2
=
new
Product
();
Product
pChang2
=
db
.
from
(
p2
).
where
(
p2
.
productName
).
is
(
"Chang"
).
selectFirst
();
assertEquals
(
19.5
,
pChang2
.
unitPrice
);
assertEquals
(
new
Integer
(
16
),
pChang2
.
unitsInStock
);
assertEquals
(
16
,
pChang2
.
unitsInStock
.
intValue
()
);
// undo update
pChang
.
unitPrice
=
19.0
;
...
...
@@ -90,7 +90,7 @@ public class UpdateTest extends TestBase {
Product
p2
=
new
Product
();
Product
pChang2
=
db
.
from
(
p2
).
where
(
p2
.
productName
).
is
(
"Chang"
).
selectFirst
();
assertEquals
(
19.5
,
pChang2
.
unitPrice
);
assertEquals
(
new
Integer
(
16
),
pChang2
.
unitsInStock
);
assertEquals
(
16
,
pChang2
.
unitsInStock
.
intValue
()
);
// undo update
pChang
.
unitPrice
=
19.0
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
2585b4ea
...
...
@@ -400,12 +400,12 @@ public class TestPreparedStatement extends TestBase {
stat
.
execute
(
"CREATE TABLE TEST(ID INT, DATA BINARY, JAVA OTHER)"
);
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(?, ?, ?)"
);
prep
.
setInt
(
1
,
1
);
prep
.
setObject
(
2
,
new
Integer
(
11
)
);
prep
.
setObject
(
2
,
11
);
prep
.
setObject
(
3
,
null
);
prep
.
execute
();
prep
.
setInt
(
1
,
2
);
prep
.
setObject
(
2
,
new
Integer
(
101
)
,
Types
.
OTHER
);
prep
.
setObject
(
3
,
new
Integer
(
103
)
,
Types
.
OTHER
);
prep
.
setObject
(
2
,
101
,
Types
.
OTHER
);
prep
.
setObject
(
3
,
103
,
Types
.
OTHER
);
prep
.
execute
();
PreparedStatement
p2
=
conn
.
prepareStatement
(
"SELECT * FROM TEST ORDER BY ID"
);
ResultSet
rs
=
p2
.
executeQuery
();
...
...
@@ -678,7 +678,7 @@ public class TestPreparedStatement extends TestBase {
// some databases don't allow calling setObject with null (no data type)
prep
.
executeUpdate
();
prep
.
setInt
(
1
,
9
);
prep
.
setObject
(
2
,
new
Integer
(-
4
)
,
Types
.
VARCHAR
);
prep
.
setObject
(
2
,
-
4
,
Types
.
VARCHAR
);
prep
.
executeUpdate
();
prep
.
setInt
(
1
,
10
);
prep
.
setObject
(
2
,
"5"
,
Types
.
INTEGER
);
...
...
@@ -797,7 +797,7 @@ public class TestPreparedStatement extends TestBase {
assertTrue
(
rs
.
getObject
(
1
).
equals
(
new
Boolean
(
true
)));
assertTrue
(
rs
.
getObject
(
2
).
equals
(
"Abc"
));
assertTrue
(
rs
.
getObject
(
3
).
equals
(
new
BigDecimal
(
"10.2"
)));
assertTrue
(
rs
.
getObject
(
4
).
equals
(
new
Byte
((
byte
)
0xff
)
));
assertTrue
(
rs
.
getObject
(
4
).
equals
(
(
byte
)
0xff
));
assertTrue
(
rs
.
getObject
(
5
).
equals
(
new
Short
(
Short
.
MAX_VALUE
)));
assertTrue
(
rs
.
getObject
(
6
).
equals
(
new
Integer
(
Integer
.
MIN_VALUE
)));
assertTrue
(
rs
.
getObject
(
7
).
equals
(
new
Long
(
Long
.
MAX_VALUE
)));
...
...
@@ -809,7 +809,7 @@ public class TestPreparedStatement extends TestBase {
assertTrue
(
rs
.
getObject
(
12
).
equals
(
java
.
sql
.
Timestamp
.
valueOf
(
"2001-02-03 04:05:06.123456789"
)));
assertTrue
(
rs
.
getObject
(
13
).
equals
(
java
.
sql
.
Timestamp
.
valueOf
(
"2001-02-03 00:00:00"
)));
assertEquals
(
new
byte
[]
{
10
,
20
,
30
},
(
byte
[])
rs
.
getObject
(
14
));
assertTrue
(
rs
.
getObject
(
15
).
equals
(
new
Character
(
'a'
)
));
assertTrue
(
rs
.
getObject
(
15
).
equals
(
'a'
));
assertTrue
(
rs
.
getObject
(
16
).
equals
(
java
.
sql
.
Date
.
valueOf
(
"2001-01-02"
)));
assertTrue
(
rs
.
getObject
(
17
)
==
null
&&
rs
.
wasNull
());
assertTrue
(
rs
.
getObject
(
18
).
equals
(
new
Double
(
3.725
)));
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
2585b4ea
...
...
@@ -1066,8 +1066,9 @@ public class TestResultSet extends TestBase {
prep
.
setObject
(
2
,
new
Object
[]
{
new
Integer
(
1
),
new
Integer
(
2
)
});
prep
.
execute
();
prep
.
setInt
(
1
,
2
);
prep
.
setObject
(
2
,
new
Object
[]
{
new
Integer
(
11
),
new
Integer
(
12
)
});
prep
.
setObject
(
2
,
new
Object
[]
{
11
,
12
});
prep
.
execute
();
prep
.
close
();
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST ORDER BY ID"
);
rs
.
next
();
assertEquals
(
1
,
rs
.
getInt
(
1
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestUpdatableResultSet.java
浏览文件 @
2585b4ea
...
...
@@ -275,7 +275,7 @@ public class TestUpdatableResultSet extends TestBase {
rs
.
updateDouble
(
"DB"
,
1.725
);
rs
.
updateFloat
(
"R"
,
(
float
)
2.5
);
rs
.
updateLong
(
"L"
,
Long
.
MAX_VALUE
);
rs
.
updateObject
(
"O_I"
,
new
Integer
(
10
)
);
rs
.
updateObject
(
"O_I"
,
10
);
rs
.
updateShort
(
"SH"
,
Short
.
MIN_VALUE
);
// auml, ouml, uuml
rs
.
updateCharacterStream
(
"CL"
,
new
StringReader
(
"\u00ef\u00f6\u00fc"
),
0
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
2585b4ea
...
...
@@ -85,6 +85,7 @@ public class TestCrashAPI extends TestBase implements Runnable {
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
maxWait
++;
// ignore
}
}
...
...
@@ -409,17 +410,17 @@ public class TestCrashAPI extends TestBase implements Runnable {
private
Object
getRandomParam
(
Class
<?>
type
)
{
if
(
type
==
int
.
class
)
{
return
new
Integer
(
random
.
getRandomInt
()
);
return
random
.
getRandomInt
(
);
}
else
if
(
type
==
byte
.
class
)
{
return
new
Byte
((
byte
)
random
.
getRandomInt
()
);
return
(
byte
)
random
.
getRandomInt
(
);
}
else
if
(
type
==
short
.
class
)
{
return
new
Short
((
short
)
random
.
getRandomInt
()
);
return
(
short
)
random
.
getRandomInt
(
);
}
else
if
(
type
==
long
.
class
)
{
return
new
Long
(
random
.
getRandomLong
()
);
return
random
.
getRandomLong
(
);
}
else
if
(
type
==
float
.
class
)
{
return
new
Float
(
random
.
getRandomDouble
()
);
return
(
float
)
random
.
getRandomDouble
(
);
}
else
if
(
type
==
boolean
.
class
)
{
return
new
Boolean
(
random
.
nextBoolean
()
);
return
random
.
nextBoolean
(
);
}
else
if
(
type
==
double
.
class
)
{
return
new
Double
(
random
.
getRandomDouble
());
}
else
if
(
type
==
String
.
class
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestJoin.java
浏览文件 @
2585b4ea
...
...
@@ -141,7 +141,7 @@ public class TestJoin extends TestBase {
String
sql
=
buff
.
toString
();
Object
[]
params
=
new
Object
[
paramCount
];
for
(
int
j
=
0
;
j
<
paramCount
;
j
++)
{
params
[
j
]
=
random
.
nextInt
(
4
)
==
1
?
null
:
new
Integer
(
random
.
nextInt
(
10
)
-
3
)
;
params
[
j
]
=
random
.
nextInt
(
4
)
==
1
?
null
:
random
.
nextInt
(
10
)
-
3
;
}
try
{
execute
(
sql
,
params
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/sql/Value.java
浏览文件 @
2585b4ea
...
...
@@ -79,11 +79,11 @@ public class Value {
}
private
static
Double
randomDouble
(
TestSynth
config
)
{
return
new
Double
(
config
.
random
().
getInt
(
100
)
/
10
.)
;
return
config
.
random
().
getInt
(
100
)
/
10
.
;
}
private
static
Long
randomLong
(
TestSynth
config
)
{
return
new
Long
(
config
.
random
().
getInt
(
1000
));
return
Long
.
valueOf
(
config
.
random
().
getInt
(
1000
));
}
private
static
Time
randomTime
(
TestSynth
config
)
{
...
...
@@ -147,10 +147,10 @@ public class Value {
switch
(
type
)
{
case
Types
.
REAL
:
case
Types
.
DOUBLE
:
data
=
new
Double
(
rs
.
getDouble
(
index
)
);
data
=
rs
.
getDouble
(
index
);
break
;
case
Types
.
BIGINT
:
data
=
new
Long
(
rs
.
getLong
(
index
)
);
data
=
rs
.
getLong
(
index
);
break
;
case
Types
.
DECIMAL
:
case
Types
.
NUMERIC
:
...
...
@@ -179,7 +179,7 @@ public class Value {
data
=
rs
.
getTimestamp
(
index
);
break
;
case
Types
.
INTEGER
:
data
=
new
Integer
(
rs
.
getInt
(
index
)
);
data
=
rs
.
getInt
(
index
);
break
;
case
Types
.
NULL
:
data
=
null
;
...
...
@@ -260,7 +260,7 @@ public class Value {
}
else
{
value
=
config
.
random
().
getRandomInt
();
}
return
new
Integer
(
value
)
;
return
value
;
}
private
static
byte
[]
randomBytes
(
TestSynth
config
,
int
max
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/test-1.3.txt
浏览文件 @
2585b4ea
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table test(d date, t time, ts timestamp);
> ok
insert into test values(date '2001-01-01', time '01:00:00', timestamp '2010-01-01 00:00:00');
> update count: 1
select ts + t x from test;
> X
> ---------------------
> 2010-01-01 01:00:00.0
> rows: 1
select ts + t + t - t x from test;
> X
> ---------------------
> 2010-01-01 01:00:00.0
> rows: 1
select ts + 0.5 * t + t - t x from test;
> X
> ---------------------
> 2010-01-01 00:30:00.0
> rows: 1
select ts + t / 0.5 x from test;
> X
> ---------------------
> 2010-01-01 02:00:00.0
> rows: 1
select d + t, t + d - t x from test;
> T + D X
> --------------------- ---------------------
> 2001-01-01 01:00:00.0 2001-01-01 00:00:00.0
> rows: 1
select 1 + d + 1, d - 1, 2 + ts + 2, ts - 2 from test;
> DATEADD('DAY', 1, DATEADD('DAY', 1, D)) DATEADD('DAY', -1, D) DATEADD('DAY', 2, DATEADD('DAY', 2, TS)) DATEADD('DAY', -2, TS)
> --------------------------------------- --------------------- ---------------------------------------- ----------------------
> 2001-01-03 00:00:00.0 2000-12-31 00:00:00.0 2010-01-05 00:00:00.0 2009-12-30 00:00:00.0
> rows: 1
select 1 + d + t + 1 from test;
> DATEADD('DAY', 1, (T + DATEADD('DAY', 1, D)))
> ---------------------------------------------
> 2001-01-03 01:00:00.0
> rows: 1
select ts - t - 2 from test;
> DATEADD('DAY', -2, (TS - T))
> ----------------------------
> 2009-12-29 23:00:00.0
> rows: 1
drop table test;
> ok
create table test(id int primary key);
> ok
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/trace/Parser.java
浏览文件 @
2585b4ea
...
...
@@ -183,16 +183,16 @@ class Parser {
}
else
if
(
tokenType
==
NUMBER
)
{
String
number
=
readToken
().
toLowerCase
();
if
(
number
.
endsWith
(
"f"
))
{
Float
v
=
new
Float
(
Float
.
parseFloat
(
number
)
);
Float
v
=
Float
.
parseFloat
(
number
);
return
new
Arg
(
float
.
class
,
v
);
}
else
if
(
number
.
endsWith
(
"d"
)
||
number
.
indexOf
(
"e"
)
>=
0
||
number
.
indexOf
(
"."
)
>=
0
)
{
Double
v
=
new
Double
(
Double
.
parseDouble
(
number
)
);
Double
v
=
Double
.
parseDouble
(
number
);
return
new
Arg
(
double
.
class
,
v
);
}
else
if
(
number
.
endsWith
(
"L"
)
||
number
.
endsWith
(
"l"
))
{
Long
v
=
new
Long
(
Long
.
parseLong
(
number
.
substring
(
0
,
number
.
length
()
-
1
)
));
Long
v
=
Long
.
parseLong
(
number
.
substring
(
0
,
number
.
length
()
-
1
));
return
new
Arg
(
long
.
class
,
v
);
}
else
{
Integer
v
=
new
Integer
(
Integer
.
parseInt
(
number
)
);
Integer
v
=
Integer
.
parseInt
(
number
);
return
new
Arg
(
int
.
class
,
v
);
}
}
else
if
(
tokenType
==
NAME
)
{
...
...
@@ -241,7 +241,7 @@ class Parser {
read
(
"short"
);
read
(
")"
);
String
number
=
readToken
();
return
new
Arg
(
short
.
class
,
new
Short
(
Short
.
parseShort
(
number
)
));
return
new
Arg
(
short
.
class
,
Short
.
parseShort
(
number
));
}
else
{
throw
new
RuntimeException
(
"Value expected, got: "
+
readToken
()
+
" in "
+
line
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/trace/Player.java
浏览文件 @
2585b4ea
...
...
@@ -110,6 +110,7 @@ public class Player {
}
runLine
(
line
.
trim
());
}
reader
.
close
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestCache.java
浏览文件 @
2585b4ea
...
...
@@ -115,7 +115,7 @@ public class TestCache extends TestBase implements CacheWriter {
/**
* A simple cache object
*/
class
Obj
extends
CacheObject
{
static
class
Obj
extends
CacheObject
{
Obj
(
int
pos
)
{
setPos
(
pos
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestJmx.java
浏览文件 @
2585b4ea
...
...
@@ -101,7 +101,6 @@ public class TestJmx extends TestBase {
conn
.
close
();
conn
=
getConnection
(
"jmx;jmx=true"
);
stat
=
conn
.
createStatement
();
name
=
new
ObjectName
(
"org.h2:name=JMX,*"
);
Set
<
ObjectName
>
set
=
mbeanServer
.
queryNames
(
name
,
null
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestNetUtils.java
浏览文件 @
2585b4ea
...
...
@@ -89,7 +89,7 @@ public class TestNetUtils extends TestBase {
/**
* A worker thread to test connecting.
*/
private
class
ConnectWorker
extends
Thread
{
private
static
class
ConnectWorker
extends
Thread
{
private
final
boolean
ssl
;
private
final
AtomicInteger
counter
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestOldVersion.java
浏览文件 @
2585b4ea
...
...
@@ -49,7 +49,7 @@ public class TestOldVersion extends TestBase {
Server
server
=
org
.
h2
.
tools
.
Server
.
createTcpServer
(
"-tcpPort"
,
"9001"
);
server
.
start
();
try
{
conn
=
driver
.
connect
(
"jdbc:h2:tcp://localhost:9001/mem:test"
,
null
);
driver
.
connect
(
"jdbc:h2:tcp://localhost:9001/mem:test"
,
null
);
}
catch
(
SQLException
e
)
{
assertEquals
(
ErrorCode
.
DRIVER_VERSION_ERROR_2
,
e
.
getErrorCode
());
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestPageStore.java
浏览文件 @
2585b4ea
...
...
@@ -715,7 +715,7 @@ public class TestPageStore extends TestBase implements DatabaseEventListener {
Random
random
=
new
Random
(
seed
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
int
op
=
random
.
nextInt
(
3
);
Integer
x
=
new
Integer
(
random
.
nextInt
(
100
)
);
Integer
x
=
random
.
nextInt
(
100
);
switch
(
op
)
{
case
0
:
if
(!
rows
.
contains
(
x
))
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestPageStoreCoverage.java
浏览文件 @
2585b4ea
...
...
@@ -247,6 +247,7 @@ public class TestPageStoreCoverage extends TestBase {
f
.
setFileLength
(
16
);
// create a new database
conn
=
getConnection
(
"pageStore"
);
conn
.
close
();
deleteDb
(
"pageStore"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestReopen.java
浏览文件 @
2585b4ea
...
...
@@ -153,7 +153,8 @@ public class TestReopen extends TestBase implements Recorder {
database
.
removeSession
(
null
);
}
catch
(
Exception
e
)
{
int
errorCode
=
0
;
if
(
e
instanceof
SQLException
)
{
if
(
e
instanceof
DbException
)
{
e
=
((
DbException
)
e
).
getSQLException
();
errorCode
=
((
SQLException
)
e
).
getErrorCode
();
}
if
(
errorCode
==
ErrorCode
.
WRONG_USER_OR_PASSWORD
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
2585b4ea
...
...
@@ -668,7 +668,7 @@ public class TestTools extends TestBase {
"-baseDir"
,
getBaseDir
(),
"-tcpPort"
,
"9192"
).
start
();
try
{
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:tcp://localhost:9192/test2"
,
"sa"
,
""
);
DriverManager
.
getConnection
(
"jdbc:h2:tcp://localhost:9192/test2"
,
"sa"
,
""
);
fail
(
"should not be able to create new db"
);
}
catch
(
SQLException
e
)
{
assertKnownException
(
e
);
...
...
@@ -707,7 +707,7 @@ public class TestTools extends TestBase {
conn
.
close
();
try
{
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:tcp://localhost:9192/../test"
,
"sa"
,
""
);
DriverManager
.
getConnection
(
"jdbc:h2:tcp://localhost:9192/../test"
,
"sa"
,
""
);
fail
(
"Should throw an exception!"
);
}
catch
(
Throwable
e
)
{
// Expected
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
2585b4ea
...
...
@@ -220,10 +220,10 @@ public class BuildBase {
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
line
.
length
()
==
0
)
{
line
=
last
;
}
else
if
(
line
.
equals
(
"exit"
)
||
line
.
equals
(
"quit"
))
{
if
(
line
==
null
||
line
.
equals
(
"exit"
)
||
line
.
equals
(
"quit"
))
{
break
;
}
else
if
(
line
.
length
()
==
0
)
{
line
=
last
;
}
long
time
=
System
.
currentTimeMillis
();
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/Function.java
浏览文件 @
2585b4ea
...
...
@@ -17,7 +17,7 @@ public class Function implements Token {
//## Java 1.5 begin ##
// must be a new instance
private
static
final
Long
COUNT_STAR
=
new
Long
(
0
);
private
static
final
Long
COUNT_STAR
=
Long
.
valueOf
(
0
);
protected
Object
[]
x
;
private
String
name
;
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论