Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
162c96c0
提交
162c96c0
authored
1月 06, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable warning for 'Local variable declaration hides another field or variable'.
上级
dffedce8
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
55 行增加
和
54 行删除
+55
-54
LocalResult.java
h2/src/main/org/h2/result/LocalResult.java
+3
-3
ResultTempTable.java
h2/src/main/org/h2/result/ResultTempTable.java
+1
-0
RowList.java
h2/src/main/org/h2/result/RowList.java
+2
-2
SchemaObjectBase.java
h2/src/main/org/h2/schema/SchemaObjectBase.java
+4
-4
TriggerObject.java
h2/src/main/org/h2/schema/TriggerObject.java
+2
-2
SecureFileStore.java
h2/src/main/org/h2/security/SecureFileStore.java
+3
-3
TcpServerThread.java
h2/src/main/org/h2/server/TcpServerThread.java
+11
-11
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+5
-5
DbContents.java
h2/src/main/org/h2/server/web/DbContents.java
+4
-4
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+11
-11
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+7
-7
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+2
-2
没有找到文件。
h2/src/main/org/h2/result/LocalResult.java
浏览文件 @
162c96c0
...
...
@@ -130,16 +130,16 @@ public class LocalResult implements ResultInterface {
* Create a shallow copy of the result set. The data and a temporary table
* (if there is any) is not copied.
*
* @param
session the session
* @param
targetSession the session of the copy
* @return the copy
*/
public
LocalResult
createShallowCopy
(
Session
s
ession
)
{
public
LocalResult
createShallowCopy
(
Session
targetS
ession
)
{
if
(
disk
==
null
&&
(
rows
==
null
||
rows
.
size
()
<
rowCount
))
{
return
null
;
}
LocalResult
copy
=
new
LocalResult
();
copy
.
maxMemoryRows
=
this
.
maxMemoryRows
;
copy
.
session
=
s
ession
;
copy
.
session
=
targetS
ession
;
copy
.
visibleColumnCount
=
this
.
visibleColumnCount
;
copy
.
expressions
=
this
.
expressions
;
copy
.
rowId
=
-
1
;
...
...
h2/src/main/org/h2/result/ResultTempTable.java
浏览文件 @
162c96c0
...
...
@@ -29,6 +29,7 @@ import org.h2.value.ValueArray;
* This class implements the temp table buffer for the LocalResult class.
*/
public
class
ResultTempTable
implements
ResultExternal
{
private
static
final
String
COLUMN_NAME
=
"DATA"
;
private
Session
session
;
private
TableData
table
;
...
...
h2/src/main/org/h2/result/RowList.java
浏览文件 @
162c96c0
...
...
@@ -174,7 +174,7 @@ public class RowList {
if
(
buff
.
readByte
()
==
0
)
{
return
null
;
}
int
mem
ory
=
buff
.
readInt
();
int
mem
=
buff
.
readInt
();
int
columnCount
=
buff
.
readInt
();
long
key
=
buff
.
readLong
();
int
version
=
buff
.
readInt
();
...
...
@@ -208,7 +208,7 @@ public class RowList {
return
(
Row
)
found
;
}
}
Row
row
=
new
Row
(
values
,
mem
ory
);
Row
row
=
new
Row
(
values
,
mem
);
row
.
setKey
(
key
);
row
.
setVersion
(
version
);
row
.
setDeleted
(
deleted
);
...
...
h2/src/main/org/h2/schema/SchemaObjectBase.java
浏览文件 @
162c96c0
...
...
@@ -18,14 +18,14 @@ public abstract class SchemaObjectBase extends DbObjectBase implements SchemaObj
/**
* Initialize some attributes of this object.
*
* @param
s
chema the schema
* @param
newS
chema the schema
* @param id the object id
* @param name the name
* @param traceModule the trace module name
*/
protected
void
initSchemaObjectBase
(
Schema
s
chema
,
int
id
,
String
name
,
String
traceModule
)
{
initDbObjectBase
(
s
chema
.
getDatabase
(),
id
,
name
,
traceModule
);
this
.
schema
=
s
chema
;
protected
void
initSchemaObjectBase
(
Schema
newS
chema
,
int
id
,
String
name
,
String
traceModule
)
{
initDbObjectBase
(
newS
chema
.
getDatabase
(),
id
,
name
,
traceModule
);
this
.
schema
=
newS
chema
;
}
public
Schema
getSchema
()
{
...
...
h2/src/main/org/h2/schema/TriggerObject.java
浏览文件 @
162c96c0
...
...
@@ -256,7 +256,7 @@ public class TriggerObject extends SchemaObjectBase {
return
null
;
}
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
public
String
getCreateSQLForCopy
(
Table
ta
rgetTa
ble
,
String
quotedName
)
{
StringBuilder
buff
=
new
StringBuilder
(
"CREATE FORCE TRIGGER "
);
buff
.
append
(
quotedName
);
if
(
before
)
{
...
...
@@ -265,7 +265,7 @@ public class TriggerObject extends SchemaObjectBase {
buff
.
append
(
" AFTER "
);
}
buff
.
append
(
getTypeNameList
());
buff
.
append
(
" ON "
).
append
(
table
.
getSQL
());
buff
.
append
(
" ON "
).
append
(
ta
rgetTa
ble
.
getSQL
());
if
(
rowBased
)
{
buff
.
append
(
" FOR EACH ROW"
);
}
...
...
h2/src/main/org/h2/security/SecureFileStore.java
浏览文件 @
162c96c0
...
...
@@ -104,11 +104,11 @@ public class SecureFileStore extends FileStore {
}
}
private
void
xorInitVector
(
byte
[]
b
,
int
off
,
int
len
,
long
p
os
)
{
private
void
xorInitVector
(
byte
[]
b
,
int
off
,
int
len
,
long
p
)
{
byte
[]
iv
=
bufferForInitVector
;
while
(
len
>
0
)
{
for
(
int
i
=
0
;
i
<
Constants
.
FILE_BLOCK_SIZE
;
i
+=
8
)
{
long
block
=
(
p
os
+
i
)
>>>
3
;
long
block
=
(
p
+
i
)
>>>
3
;
iv
[
i
]
=
(
byte
)
(
block
>>
56
);
iv
[
i
+
1
]
=
(
byte
)
(
block
>>
48
);
iv
[
i
+
2
]
=
(
byte
)
(
block
>>
40
);
...
...
@@ -122,7 +122,7 @@ public class SecureFileStore extends FileStore {
for
(
int
i
=
0
;
i
<
Constants
.
FILE_BLOCK_SIZE
;
i
++)
{
b
[
off
+
i
]
^=
iv
[
i
];
}
p
os
+=
Constants
.
FILE_BLOCK_SIZE
;
p
+=
Constants
.
FILE_BLOCK_SIZE
;
off
+=
Constants
.
FILE_BLOCK_SIZE
;
len
-=
Constants
.
FILE_BLOCK_SIZE
;
}
...
...
h2/src/main/org/h2/server/TcpServerThread.java
浏览文件 @
162c96c0
...
...
@@ -43,13 +43,13 @@ public class TcpServerThread implements Runnable {
private
Transfer
transfer
;
private
Command
commit
;
private
SmallMap
cache
=
new
SmallMap
(
SysProperties
.
SERVER_CACHED_OBJECTS
);
private
int
i
d
;
private
int
threadI
d
;
private
int
clientVersion
;
private
String
sessionId
;
TcpServerThread
(
Socket
socket
,
TcpServer
server
,
int
id
)
{
this
.
server
=
server
;
this
.
i
d
=
id
;
this
.
threadI
d
=
id
;
transfer
=
new
Transfer
(
null
);
transfer
.
setSocket
(
socket
);
}
...
...
@@ -80,17 +80,17 @@ public class TcpServerThread implements Runnable {
String
db
=
transfer
.
readString
();
String
originalURL
=
transfer
.
readString
();
if
(
db
==
null
&&
originalURL
==
null
)
{
String
s
essionId
=
transfer
.
readString
();
String
targetS
essionId
=
transfer
.
readString
();
int
command
=
transfer
.
readInt
();
stop
=
true
;
if
(
command
==
SessionRemote
.
SESSION_CANCEL_STATEMENT
)
{
// cancel a running statement
int
statementId
=
transfer
.
readInt
();
server
.
cancelStatement
(
s
essionId
,
statementId
);
server
.
cancelStatement
(
targetS
essionId
,
statementId
);
}
else
if
(
command
==
SessionRemote
.
SESSION_CHECK_KEY
)
{
// check if this is the correct server
db
=
server
.
checkKeyAndGetDatabaseName
(
s
essionId
);
if
(!
s
essionId
.
equals
(
db
))
{
db
=
server
.
checkKeyAndGetDatabaseName
(
targetS
essionId
);
if
(!
targetS
essionId
.
equals
(
db
))
{
transfer
.
writeInt
(
SessionRemote
.
STATUS_OK
);
}
else
{
transfer
.
writeInt
(
SessionRemote
.
STATUS_ERROR
);
...
...
@@ -126,7 +126,7 @@ public class TcpServerThread implements Runnable {
transfer
.
writeInt
(
Constants
.
TCP_PROTOCOL_VERSION_6
);
}
transfer
.
flush
();
server
.
addConnection
(
i
d
,
originalURL
,
ci
.
getUserName
());
server
.
addConnection
(
threadI
d
,
originalURL
,
ci
.
getUserName
());
trace
(
"Connected"
);
}
catch
(
Throwable
e
)
{
sendError
(
e
);
...
...
@@ -157,7 +157,7 @@ public class TcpServerThread implements Runnable {
}
try
{
session
.
close
();
server
.
removeConnection
(
i
d
);
server
.
removeConnection
(
threadI
d
);
}
catch
(
Exception
e
)
{
server
.
traceError
(
e
);
}
finally
{
...
...
@@ -398,11 +398,11 @@ public class TcpServerThread implements Runnable {
/**
* Cancel a running statement.
*
* @param
s
essionId the session id
* @param
targetS
essionId the session id
* @param statementId the statement to cancel
*/
void
cancelStatement
(
String
s
essionId
,
int
statementId
)
throws
SQLException
{
if
(
StringUtils
.
equals
(
s
essionId
,
this
.
sessionId
))
{
void
cancelStatement
(
String
targetS
essionId
,
int
statementId
)
throws
SQLException
{
if
(
StringUtils
.
equals
(
targetS
essionId
,
this
.
sessionId
))
{
Command
cmd
=
(
Command
)
cache
.
getObject
(
statementId
,
false
);
cmd
.
cancel
();
}
...
...
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
162c96c0
...
...
@@ -63,7 +63,7 @@ public class PgServerThread implements Runnable {
private
String
dateStyle
=
"ISO"
;
private
HashMap
<
String
,
Prepared
>
prepared
=
New
.
hashMap
();
private
HashMap
<
String
,
Portal
>
portals
=
New
.
hashMap
();
private
HashSet
<
Integer
>
type
s
=
New
.
hashSet
();
private
HashSet
<
Integer
>
type
Set
=
New
.
hashSet
();
PgServerThread
(
Socket
socket
,
PgServer
server
)
{
this
.
server
=
server
;
...
...
@@ -374,7 +374,7 @@ public class PgServerThread implements Runnable {
}
private
void
checkType
(
int
type
)
{
if
(
type
s
.
contains
(
type
))
{
if
(
type
Set
.
contains
(
type
))
{
server
.
trace
(
"Unsupported type: "
+
type
);
}
}
...
...
@@ -618,7 +618,7 @@ public class PgServerThread implements Runnable {
rs
=
stat
.
executeQuery
(
"SELECT OID FROM PG_CATALOG.PG_TYPE"
);
while
(
rs
.
next
())
{
type
s
.
add
(
rs
.
getInt
(
1
));
type
Set
.
add
(
rs
.
getInt
(
1
));
}
}
finally
{
JdbcUtils
.
closeSilently
(
stat
);
...
...
@@ -717,8 +717,8 @@ public class PgServerThread implements Runnable {
dataOut
.
write
(
b
);
}
private
void
startMessage
(
int
m
essageType
)
{
this
.
messageType
=
m
essageType
;
private
void
startMessage
(
int
newM
essageType
)
{
this
.
messageType
=
newM
essageType
;
outBuffer
=
new
ByteArrayOutputStream
();
dataOut
=
new
DataOutputStream
(
outBuffer
);
}
...
...
h2/src/main/org/h2/server/web/DbContents.java
浏览文件 @
162c96c0
...
...
@@ -157,7 +157,7 @@ public class DbContents {
return
new
String
[]
{
null
};
}
ResultSet
rs
=
meta
.
getSchemas
();
ArrayList
<
String
>
schema
s
=
New
.
arrayList
();
ArrayList
<
String
>
schema
List
=
New
.
arrayList
();
while
(
rs
.
next
())
{
String
schema
=
rs
.
getString
(
findColumn
(
rs
,
"TABLE_SCHEM"
,
1
));
if
(
isOracle
)
{
...
...
@@ -175,11 +175,11 @@ public class DbContents {
if
(
schema
==
null
)
{
continue
;
}
schema
s
.
add
(
schema
);
schema
List
.
add
(
schema
);
}
rs
.
close
();
String
[]
list
=
new
String
[
schema
s
.
size
()];
schema
s
.
toArray
(
list
);
String
[]
list
=
new
String
[
schema
List
.
size
()];
schema
List
.
toArray
(
list
);
return
list
;
}
...
...
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
162c96c0
...
...
@@ -790,23 +790,23 @@ public class WebApp implements DatabaseEventListener {
boolean
isH2
=
url
.
startsWith
(
"jdbc:h2:"
);
try
{
long
start
=
System
.
currentTimeMillis
();
String
prof
ileOpen
=
""
,
profile
Close
=
""
;
Profiler
prof
iler
=
new
Profiler
();
prof
iler
.
startCollecting
();
String
prof
Open
=
""
,
prof
Close
=
""
;
Profiler
prof
=
new
Profiler
();
prof
.
startCollecting
();
Connection
conn
;
try
{
conn
=
server
.
getConnection
(
driver
,
url
,
user
,
password
,
this
);
}
finally
{
prof
iler
.
stopCollecting
();
prof
ileOpen
=
profiler
.
getTop
(
3
);
prof
.
stopCollecting
();
prof
Open
=
prof
.
getTop
(
3
);
}
prof
iler
=
new
Profiler
();
prof
iler
.
startCollecting
();
prof
=
new
Profiler
();
prof
.
startCollecting
();
try
{
JdbcUtils
.
closeSilently
(
conn
);
}
finally
{
prof
iler
.
stopCollecting
();
prof
ileClose
=
profiler
.
getTop
(
3
);
prof
.
stopCollecting
();
prof
Close
=
prof
.
getTop
(
3
);
}
long
time
=
System
.
currentTimeMillis
()
-
start
;
String
success
;
...
...
@@ -814,9 +814,9 @@ public class WebApp implements DatabaseEventListener {
success
=
"<a class=\"error\" href=\"#\" onclick=\"var x=document.getElementById('prof').style;x.display=x.display==''?'none':'';\">"
+
"${text.login.testSuccessful}</a>"
+
"<span style=\"display: none;\" id=\"prof\"><br />"
+
PageParser
.
escapeHtml
(
prof
ile
Open
)
+
PageParser
.
escapeHtml
(
profOpen
)
+
"<br />"
+
PageParser
.
escapeHtml
(
prof
ile
Close
)
+
PageParser
.
escapeHtml
(
profClose
)
+
"</span>"
;
}
else
{
success
=
"${text.login.testSuccessful}"
;
...
...
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
162c96c0
...
...
@@ -595,30 +595,30 @@ public class WebServer implements Service {
* Open a database connection.
*
* @param driver the driver class name
* @param
u
rl the database URL
* @param
databaseU
rl the database URL
* @param user the user name
* @param password the password
* @param listener the database event listener object
* @return the database connection
*/
Connection
getConnection
(
String
driver
,
String
u
rl
,
String
user
,
String
password
,
DatabaseEventListener
listener
)
throws
SQLException
{
Connection
getConnection
(
String
driver
,
String
databaseU
rl
,
String
user
,
String
password
,
DatabaseEventListener
listener
)
throws
SQLException
{
driver
=
driver
.
trim
();
url
=
u
rl
.
trim
();
databaseUrl
=
databaseU
rl
.
trim
();
org
.
h2
.
Driver
.
load
();
Properties
p
=
new
Properties
();
p
.
setProperty
(
"user"
,
user
.
trim
());
// do not trim the password, otherwise an
// encrypted H2 database with empty user password doesn't work
p
.
setProperty
(
"password"
,
password
);
if
(
u
rl
.
startsWith
(
"jdbc:h2:"
))
{
if
(
databaseU
rl
.
startsWith
(
"jdbc:h2:"
))
{
if
(
ifExists
)
{
u
rl
+=
";IFEXISTS=TRUE"
;
databaseU
rl
+=
";IFEXISTS=TRUE"
;
}
p
.
put
(
"DATABASE_EVENT_LISTENER_OBJECT"
,
listener
);
// PostgreSQL would throw a NullPointerException
// if it is loaded before the H2 driver
// because it can't deal with non-String objects in the connection Properties
return
org
.
h2
.
Driver
.
load
().
connect
(
u
rl
,
p
);
return
org
.
h2
.
Driver
.
load
().
connect
(
databaseU
rl
,
p
);
}
// try {
// Driver dr = (Driver) urlClassLoader.
...
...
@@ -627,7 +627,7 @@ public class WebServer implements Service {
// } catch(ClassNotFoundException e2) {
// throw e2;
// }
return
JdbcUtils
.
getConnection
(
driver
,
u
rl
,
p
);
return
JdbcUtils
.
getConnection
(
driver
,
databaseU
rl
,
p
);
}
/**
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
162c96c0
...
...
@@ -328,8 +328,8 @@ class WebThread extends WebApp implements Runnable {
server
.
traceError
(
e
);
}
public
void
init
(
String
u
rl
)
{
log
(
"Init: "
+
PageParser
.
escapeHtml
(
u
rl
));
public
void
init
(
String
databaseU
rl
)
{
log
(
"Init: "
+
PageParser
.
escapeHtml
(
databaseU
rl
));
}
public
void
opened
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论