Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a4afb494
提交
a4afb494
authored
7月 17, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix Eclipse 3.5 warnings
上级
383a7c09
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
39 行增加
和
33 行删除
+39
-33
Restore.java
h2/src/main/org/h2/tools/Restore.java
+4
-2
SimpleResultSet.java
h2/src/main/org/h2/tools/SimpleResultSet.java
+1
-1
StringCache.java
h2/src/main/org/h2/util/StringCache.java
+7
-6
Profile.java
h2/src/test/org/h2/test/coverage/Profile.java
+9
-7
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+1
-7
TestAutoServer.java
h2/src/test/org/h2/test/server/TestAutoServer.java
+3
-3
TestValueHashMap.java
h2/src/test/org/h2/test/unit/TestValueHashMap.java
+1
-1
PgTcpRedirect.java
h2/src/tools/org/h2/dev/net/PgTcpRedirect.java
+4
-2
Query.java
h2/src/tools/org/h2/jaqu/Query.java
+9
-4
没有找到文件。
h2/src/main/org/h2/tools/Restore.java
浏览文件 @
a4afb494
...
@@ -103,7 +103,7 @@ public class Restore extends Tool {
...
@@ -103,7 +103,7 @@ public class Restore extends Tool {
}
}
}
}
zipIn
.
close
();
zipIn
.
close
();
if
(
multiple
&&
!
originalDbName
.
equals
(
db
))
{
if
(
multiple
&&
!
db
.
equals
(
originalDbName
))
{
throw
new
IOException
(
"Multiple databases found, but not "
+
db
);
throw
new
IOException
(
"Multiple databases found, but not "
+
db
);
}
}
return
originalDbName
;
return
originalDbName
;
...
@@ -141,6 +141,7 @@ public class Restore extends Tool {
...
@@ -141,6 +141,7 @@ public class Restore extends Tool {
throw
new
IOException
(
"File not found: "
+
zipFileName
);
throw
new
IOException
(
"File not found: "
+
zipFileName
);
}
}
String
originalDbName
=
null
;
String
originalDbName
=
null
;
int
originalDbLen
=
0
;
if
(
db
!=
null
)
{
if
(
db
!=
null
)
{
originalDbName
=
getOriginalDbName
(
zipFileName
,
db
);
originalDbName
=
getOriginalDbName
(
zipFileName
,
db
);
if
(
originalDbName
==
null
)
{
if
(
originalDbName
==
null
)
{
...
@@ -149,6 +150,7 @@ public class Restore extends Tool {
...
@@ -149,6 +150,7 @@ public class Restore extends Tool {
if
(
originalDbName
.
startsWith
(
File
.
separator
))
{
if
(
originalDbName
.
startsWith
(
File
.
separator
))
{
originalDbName
=
originalDbName
.
substring
(
1
);
originalDbName
=
originalDbName
.
substring
(
1
);
}
}
originalDbLen
=
originalDbName
.
length
();
}
}
in
=
FileUtils
.
openFileInputStream
(
zipFileName
);
in
=
FileUtils
.
openFileInputStream
(
zipFileName
);
ZipInputStream
zipIn
=
new
ZipInputStream
(
in
);
ZipInputStream
zipIn
=
new
ZipInputStream
(
in
);
...
@@ -168,7 +170,7 @@ public class Restore extends Tool {
...
@@ -168,7 +170,7 @@ public class Restore extends Tool {
if
(
db
==
null
)
{
if
(
db
==
null
)
{
copy
=
true
;
copy
=
true
;
}
else
if
(
fileName
.
startsWith
(
originalDbName
+
"."
))
{
}
else
if
(
fileName
.
startsWith
(
originalDbName
+
"."
))
{
fileName
=
db
+
fileName
.
substring
(
originalDb
Name
.
length
()
);
fileName
=
db
+
fileName
.
substring
(
originalDb
Len
);
copy
=
true
;
copy
=
true
;
}
}
if
(
copy
)
{
if
(
copy
)
{
...
...
h2/src/main/org/h2/tools/SimpleResultSet.java
浏览文件 @
a4afb494
...
@@ -91,7 +91,7 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
...
@@ -91,7 +91,7 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
* A simple array implementation,
* A simple array implementation,
* backed by an object array
* backed by an object array
*/
*/
p
rivate
static
class
SimpleArray
implements
Array
{
p
ublic
static
class
SimpleArray
implements
Array
{
private
Object
[]
value
;
private
Object
[]
value
;
...
...
h2/src/main/org/h2/util/StringCache.java
浏览文件 @
a4afb494
...
@@ -77,12 +77,13 @@ public class StringCache {
...
@@ -77,12 +77,13 @@ public class StringCache {
int
hash
=
s
.
hashCode
();
int
hash
=
s
.
hashCode
();
String
[]
cache
=
getCache
();
String
[]
cache
=
getCache
();
int
index
=
hash
&
(
SysProperties
.
OBJECT_CACHE_SIZE
-
1
);
int
index
=
hash
&
(
SysProperties
.
OBJECT_CACHE_SIZE
-
1
);
if
(
cache
!=
null
)
{
if
(
cache
==
null
)
{
String
cached
=
cache
[
index
];
return
s
;
if
(
cached
!=
null
)
{
}
if
(
s
.
equals
(
cached
))
{
String
cached
=
cache
[
index
];
return
cached
;
if
(
cached
!=
null
)
{
}
if
(
s
.
equals
(
cached
))
{
return
cached
;
}
}
}
}
// create a new object that is not shared
// create a new object that is not shared
...
...
h2/src/test/org/h2/test/coverage/Profile.java
浏览文件 @
a4afb494
...
@@ -133,13 +133,15 @@ public class Profile extends Thread {
...
@@ -133,13 +133,15 @@ public class Profile extends Thread {
return
;
return
;
}
}
long
now
=
System
.
currentTimeMillis
();
long
now
=
System
.
currentTimeMillis
();
if
(
TRACE
&&
trace
!=
null
)
{
if
(
TRACE
)
{
int
duration
=
(
int
)
(
now
-
lastTime
);
if
(
trace
!=
null
)
{
try
{
int
duration
=
(
int
)
(
now
-
lastTime
);
trace
.
write
(
i
+
"\t"
+
duration
+
"\r\n"
);
try
{
}
catch
(
Exception
e
)
{
trace
.
write
(
i
+
"\t"
+
duration
+
"\r\n"
);
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
System
.
exit
(
1
);
e
.
printStackTrace
();
System
.
exit
(
1
);
}
}
}
}
}
count
[
i
]++;
count
[
i
]++;
...
...
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
a4afb494
...
@@ -12,8 +12,6 @@ import java.sql.ResultSet;
...
@@ -12,8 +12,6 @@ import java.sql.ResultSet;
import
java.sql.ResultSetMetaData
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
org.h2.engine.Constants
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
/**
/**
...
@@ -70,11 +68,7 @@ public class TestCompatibility extends TestBase {
...
@@ -70,11 +68,7 @@ public class TestCompatibility extends TestBase {
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
String
[]
modes
=
new
String
[]
{
"PostgreSQL"
,
"MySQL"
,
"HSQLDB"
,
"MSSQLServer"
,
"Derby"
,
"Oracle"
,
"Regular"
};
String
[]
modes
=
new
String
[]
{
"PostgreSQL"
,
"MySQL"
,
"HSQLDB"
,
"MSSQLServer"
,
"Derby"
,
"Oracle"
,
"Regular"
};
String
columnAlias
;
String
columnAlias
;
if
(
Constants
.
VERSION_MINOR
==
0
)
{
columnAlias
=
"MySQL,Regular"
;
columnAlias
=
"MySQL"
;
}
else
{
columnAlias
=
"MySQL,Regular"
;
}
stat
.
execute
(
"CREATE TABLE TEST(ID INT)"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT)"
);
for
(
String
mode
:
modes
)
{
for
(
String
mode
:
modes
)
{
stat
.
execute
(
"SET MODE "
+
mode
);
stat
.
execute
(
"SET MODE "
+
mode
);
...
...
h2/src/test/org/h2/test/server/TestAutoServer.java
浏览文件 @
a4afb494
...
@@ -20,9 +20,9 @@ import org.h2.util.SortedProperties;
...
@@ -20,9 +20,9 @@ import org.h2.util.SortedProperties;
public
class
TestAutoServer
extends
TestBase
{
public
class
TestAutoServer
extends
TestBase
{
/**
/**
*
If enabled, this flag allows to debug the test case
.
*
The number of iterations
.
*/
*/
static
final
boolean
SLOW
=
false
;
static
final
int
ITERATIONS
=
30
;
/**
/**
* Run just this test.
* Run just this test.
...
@@ -42,7 +42,7 @@ public class TestAutoServer extends TestBase {
...
@@ -42,7 +42,7 @@ public class TestAutoServer extends TestBase {
String
user
=
getUser
(),
password
=
getPassword
();
String
user
=
getUser
(),
password
=
getPassword
();
Connection
connServer
=
getConnection
(
url
+
";OPEN_NEW=TRUE"
,
user
,
password
);
Connection
connServer
=
getConnection
(
url
+
";OPEN_NEW=TRUE"
,
user
,
password
);
int
i
=
SLOW
?
Integer
.
MAX_VALUE
:
30
;
int
i
=
ITERATIONS
;
for
(;
i
>
0
;
i
--)
{
for
(;
i
>
0
;
i
--)
{
Thread
.
sleep
(
100
);
Thread
.
sleep
(
100
);
SortedProperties
prop
=
SortedProperties
.
loadProperties
(
baseDir
+
"/autoServer.lock.db"
);
SortedProperties
prop
=
SortedProperties
.
loadProperties
(
baseDir
+
"/autoServer.lock.db"
);
...
...
h2/src/test/org/h2/test/unit/TestValueHashMap.java
浏览文件 @
a4afb494
...
@@ -86,7 +86,7 @@ public class TestValueHashMap extends TestBase implements DataHandler {
...
@@ -86,7 +86,7 @@ public class TestValueHashMap extends TestBase implements DataHandler {
case
2
:
case
2
:
Value
v1
=
map
.
get
(
key
);
Value
v1
=
map
.
get
(
key
);
Value
v2
=
hash
.
get
(
key
);
Value
v2
=
hash
.
get
(
key
);
assertTrue
(
(
v1
==
null
&&
v2
==
null
)
||
v1
.
compareEqual
(
v2
));
assertTrue
(
v1
==
null
?
v2
==
null
:
v1
.
compareEqual
(
v2
));
break
;
break
;
case
3
:
{
case
3
:
{
ObjectArray
<
Value
>
a1
=
map
.
keys
();
ObjectArray
<
Value
>
a1
=
map
.
keys
();
...
...
h2/src/tools/org/h2/dev/net/PgTcpRedirect.java
浏览文件 @
a4afb494
...
@@ -22,6 +22,8 @@ import java.net.Socket;
...
@@ -22,6 +22,8 @@ import java.net.Socket;
*/
*/
public
class
PgTcpRedirect
{
public
class
PgTcpRedirect
{
private
static
final
boolean
DEBUG
=
false
;
/**
/**
* This method is called when executing this application from the command
* This method is called when executing this application from the command
* line.
* line.
...
@@ -92,7 +94,7 @@ public class PgTcpRedirect {
...
@@ -92,7 +94,7 @@ public class PgTcpRedirect {
}
}
private
void
println
(
String
s
)
{
private
void
println
(
String
s
)
{
if
(
false
)
{
if
(
DEBUG
)
{
System
.
out
.
println
(
s
);
System
.
out
.
println
(
s
);
}
}
}
}
...
@@ -536,7 +538,7 @@ public class PgTcpRedirect {
...
@@ -536,7 +538,7 @@ public class PgTcpRedirect {
* @param len the length
* @param len the length
*/
*/
synchronized
void
printData
(
byte
[]
buffer
,
int
len
)
{
synchronized
void
printData
(
byte
[]
buffer
,
int
len
)
{
if
(
false
)
{
if
(
DEBUG
)
{
System
.
out
.
print
(
" "
);
System
.
out
.
print
(
" "
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
int
c
=
buffer
[
i
]
&
255
;
int
c
=
buffer
[
i
]
&
255
;
...
...
h2/src/tools/org/h2/jaqu/Query.java
浏览文件 @
a4afb494
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
jaqu
;
package
org
.
h2
.
jaqu
;
//## Java 1.5 begin ##
//## Java 1.5 begin ##
import
java.lang.reflect.Field
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -165,10 +166,14 @@ public class Query<T> {
...
@@ -165,10 +166,14 @@ public class Query<T> {
public
<
A
>
QueryWhere
<
T
>
where
(
Filter
filter
)
{
public
<
A
>
QueryWhere
<
T
>
where
(
Filter
filter
)
{
// TODO decompile the filter and add conditions accordingly
// TODO decompile the filter and add conditions accordingly
// for (Field f : filter.getClass().getDeclaredFields()) {
for
(
Field
f
:
filter
.
getClass
().
getDeclaredFields
())
{
// f.setAccessible(true);
f
.
setAccessible
(
true
);
// try { System.out.println(f.getName() + "=" + f.get(filter));
// try {
// } catch (Exception e) { } }
// System.out.println(f.getName() + "=" + f.get(filter));
// } catch (Exception e) {
// // convert
// }
}
return
new
QueryWhere
<
T
>(
this
);
return
new
QueryWhere
<
T
>(
this
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论