Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
43701f3f
提交
43701f3f
authored
5月 17, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Javadocs; lob storage bugfix.
上级
8d9dec61
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
87 行增加
和
17 行删除
+87
-17
Command.java
h2/src/main/org/h2/command/Command.java
+0
-1
Session.java
h2/src/main/org/h2/engine/Session.java
+19
-5
ConditionInConstantSet.java
h2/src/main/org/h2/expression/ConditionInConstantSet.java
+1
-0
MVTableEngine.java
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
+9
-0
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+37
-1
LobStorageInterface.java
h2/src/main/org/h2/store/LobStorageInterface.java
+1
-1
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+5
-3
Doclet.java
h2/src/tools/org/h2/build/doclet/Doclet.java
+15
-6
没有找到文件。
h2/src/main/org/h2/command/Command.java
浏览文件 @
43701f3f
...
@@ -144,7 +144,6 @@ public abstract class Command implements CommandInterface {
...
@@ -144,7 +144,6 @@ public abstract class Command implements CommandInterface {
private
void
stop
()
{
private
void
stop
()
{
session
.
endStatement
();
session
.
endStatement
();
session
.
closeTemporaryResults
();
session
.
setCurrentCommand
(
null
);
session
.
setCurrentCommand
(
null
);
if
(!
isTransactional
())
{
if
(!
isTransactional
())
{
session
.
commit
(
true
);
session
.
commit
(
true
);
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
43701f3f
...
@@ -584,6 +584,11 @@ public class Session extends SessionWithState {
...
@@ -584,6 +584,11 @@ public class Session extends SessionWithState {
return
undoLog
.
size
()
>
0
;
return
undoLog
.
size
()
>
0
;
}
}
/**
* Create a savepoint to allow rolling back to this state.
*
* @return the savepoint
*/
public
Savepoint
setSavepoint
()
{
public
Savepoint
setSavepoint
()
{
Savepoint
sp
=
new
Savepoint
();
Savepoint
sp
=
new
Savepoint
();
sp
.
logIndex
=
undoLog
.
size
();
sp
.
logIndex
=
undoLog
.
size
();
...
@@ -1203,11 +1208,7 @@ public class Session extends SessionWithState {
...
@@ -1203,11 +1208,7 @@ public class Session extends SessionWithState {
}
}
}
}
/**
private
void
closeTemporaryResults
()
{
* Close all temporary result set. This also deletes all temporary files
* held by the result sets.
*/
public
void
closeTemporaryResults
()
{
if
(
temporaryResults
!=
null
)
{
if
(
temporaryResults
!=
null
)
{
for
(
ResultInterface
result
:
temporaryResults
)
{
for
(
ResultInterface
result
:
temporaryResults
)
{
result
.
close
();
result
.
close
();
...
@@ -1325,8 +1326,13 @@ public class Session extends SessionWithState {
...
@@ -1325,8 +1326,13 @@ public class Session extends SessionWithState {
return
startStatement
;
return
startStatement
;
}
}
/**
* Mark the statement as completed. This also close all temporary result
* set, and deletes all temporary files held by the result sets.
*/
public
void
endStatement
()
{
public
void
endStatement
()
{
startStatement
=
-
1
;
startStatement
=
-
1
;
closeTemporaryResults
();
}
}
/**
/**
...
@@ -1334,7 +1340,15 @@ public class Session extends SessionWithState {
...
@@ -1334,7 +1340,15 @@ public class Session extends SessionWithState {
* back to).
* back to).
*/
*/
public
static
class
Savepoint
{
public
static
class
Savepoint
{
/**
* The undo log index.
*/
int
logIndex
;
int
logIndex
;
/**
* The transaction savepoint id.
*/
long
transactionSavepoint
;
long
transactionSavepoint
;
}
}
...
...
h2/src/main/org/h2/expression/ConditionInConstantSet.java
浏览文件 @
43701f3f
...
@@ -145,6 +145,7 @@ public class ConditionInConstantSet extends Condition {
...
@@ -145,6 +145,7 @@ public class ConditionInConstantSet extends Condition {
* Add an additional element if possible. Example: given two conditions
* Add an additional element if possible. Example: given two conditions
* A IN(1, 2) OR A=3, the constant 3 is added: A IN(1, 2, 3).
* A IN(1, 2) OR A=3, the constant 3 is added: A IN(1, 2, 3).
*
*
* @param session the session
* @param other the second condition
* @param other the second condition
* @return null if the condition was not added, or the new condition
* @return null if the condition was not added, or the new condition
*/
*/
...
...
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
浏览文件 @
43701f3f
...
@@ -101,6 +101,9 @@ public class MVTableEngine implements TableEngine {
...
@@ -101,6 +101,9 @@ public class MVTableEngine implements TableEngine {
return
openTables
;
return
openTables
;
}
}
/**
* Store all pending changes.
*/
public
void
store
()
{
public
void
store
()
{
if
(!
store
.
isReadOnly
())
{
if
(!
store
.
isReadOnly
())
{
store
.
commit
();
store
.
commit
();
...
@@ -109,6 +112,9 @@ public class MVTableEngine implements TableEngine {
...
@@ -109,6 +112,9 @@ public class MVTableEngine implements TableEngine {
}
}
}
}
/**
* Close the store, without persisting changes.
*/
public
void
closeImmediately
()
{
public
void
closeImmediately
()
{
if
(
store
.
isClosed
())
{
if
(
store
.
isClosed
())
{
return
;
return
;
...
@@ -123,6 +129,9 @@ public class MVTableEngine implements TableEngine {
...
@@ -123,6 +129,9 @@ public class MVTableEngine implements TableEngine {
}
}
}
}
/**
* Close the store. Pending changes are persisted.
*/
public
void
close
()
{
public
void
close
()
{
if
(!
store
.
isReadOnly
())
{
if
(!
store
.
isReadOnly
())
{
store
.
store
();
store
.
store
();
...
...
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
43701f3f
...
@@ -248,6 +248,13 @@ public class TransactionStore {
...
@@ -248,6 +248,13 @@ public class TransactionStore {
endTransaction
(
t
);
endTransaction
(
t
);
}
}
/**
* Check whether the given transaction id is still open and contains log
* entries.
*
* @param transactionId the transaction id
* @return true if it is open
*/
boolean
isTransactionOpen
(
long
transactionId
)
{
boolean
isTransactionOpen
(
long
transactionId
)
{
if
(
transactionId
<
firstOpenTransaction
)
{
if
(
transactionId
<
firstOpenTransaction
)
{
return
false
;
return
false
;
...
@@ -267,6 +274,11 @@ public class TransactionStore {
...
@@ -267,6 +274,11 @@ public class TransactionStore {
return
key
!=
null
&&
key
[
0
]
==
transactionId
;
return
key
!=
null
&&
key
[
0
]
==
transactionId
;
}
}
/**
* End this transaction
*
* @param t the transaction
*/
void
endTransaction
(
Transaction
t
)
{
void
endTransaction
(
Transaction
t
)
{
if
(
t
.
getStatus
()
==
Transaction
.
STATUS_PREPARED
)
{
if
(
t
.
getStatus
()
==
Transaction
.
STATUS_PREPARED
)
{
preparedTransactions
.
remove
(
t
.
getId
());
preparedTransactions
.
remove
(
t
.
getId
());
...
@@ -308,6 +320,14 @@ public class TransactionStore {
...
@@ -308,6 +320,14 @@ public class TransactionStore {
}
}
}
}
/**
* Get the set of changed maps.
*
* @param t the transaction
* @param maxLogId the maximum log id
* @param toLogId the minimum log id
* @return the set of changed maps
*/
HashSet
<
String
>
getChangedMaps
(
Transaction
t
,
long
maxLogId
,
long
toLogId
)
{
HashSet
<
String
>
getChangedMaps
(
Transaction
t
,
long
maxLogId
,
long
toLogId
)
{
HashSet
<
String
>
set
=
New
.
hashSet
();
HashSet
<
String
>
set
=
New
.
hashSet
();
for
(
long
logId
=
maxLogId
-
1
;
logId
>=
toLogId
;
logId
--)
{
for
(
long
logId
=
maxLogId
-
1
;
logId
>=
toLogId
;
logId
--)
{
...
@@ -363,6 +383,9 @@ public class TransactionStore {
...
@@ -363,6 +383,9 @@ public class TransactionStore {
*/
*/
final
long
transactionId
;
final
long
transactionId
;
/**
* The log id of the last entry in the undo log map.
*/
long
logId
;
long
logId
;
private
int
status
;
private
int
status
;
...
@@ -1012,7 +1035,20 @@ public class TransactionStore {
...
@@ -1012,7 +1035,20 @@ public class TransactionStore {
* value, and the value itself.
* value, and the value itself.
*/
*/
static
class
VersionedValue
{
static
class
VersionedValue
{
public
long
transactionId
,
logId
;
/**
* The transaction id.
*/
public
long
transactionId
;
/**
* The log id.
*/
public
long
logId
;
/**
* The value.
*/
public
Object
value
;
public
Object
value
;
}
}
...
...
h2/src/main/org/h2/store/LobStorageInterface.java
浏览文件 @
43701f3f
...
@@ -62,7 +62,7 @@ public interface LobStorageInterface {
...
@@ -62,7 +62,7 @@ public interface LobStorageInterface {
* @param lobId the lob
* @param lobId the lob
* @param table the table
* @param table the table
*/
*/
void
setTable
(
long
lobId
,
int
table
IdSessionVariable
);
void
setTable
(
long
lobId
,
int
table
);
/**
/**
* Delete a LOB from the database.
* Delete a LOB from the database.
...
...
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
43701f3f
...
@@ -142,6 +142,7 @@ public class ValueLob extends Value {
...
@@ -142,6 +142,7 @@ public class ValueLob extends Value {
* @param objectId the object id
* @param objectId the object id
* @param precision the precision (length in elements)
* @param precision the precision (length in elements)
* @param compression if compression is used
* @param compression if compression is used
* @param fileName the file name
* @return the value object
* @return the value object
*/
*/
public
static
ValueLob
openUnlinked
(
int
type
,
DataHandler
handler
,
public
static
ValueLob
openUnlinked
(
int
type
,
DataHandler
handler
,
...
@@ -237,7 +238,7 @@ public class ValueLob extends Value {
...
@@ -237,7 +238,7 @@ public class ValueLob extends Value {
}
}
}
}
p
ublic
static
String
getFileNamePrefix
(
String
path
,
int
objectId
)
{
p
rivate
static
String
getFileNamePrefix
(
String
path
,
int
objectId
)
{
String
name
;
String
name
;
int
f
=
objectId
%
SysProperties
.
LOB_FILES_PER_DIRECTORY
;
int
f
=
objectId
%
SysProperties
.
LOB_FILES_PER_DIRECTORY
;
if
(
f
>
0
)
{
if
(
f
>
0
)
{
...
@@ -480,7 +481,8 @@ public class ValueLob extends Value {
...
@@ -480,7 +481,8 @@ public class ValueLob extends Value {
}
}
}
}
public
void
unlink
()
{
@Override
public
void
unlink
(
DataHandler
handler
)
{
if
(
linked
&&
fileName
!=
null
)
{
if
(
linked
&&
fileName
!=
null
)
{
String
temp
;
String
temp
;
// synchronize on the database, to avoid concurrent temp file
// synchronize on the database, to avoid concurrent temp file
...
@@ -751,7 +753,7 @@ public class ValueLob extends Value {
...
@@ -751,7 +753,7 @@ public class ValueLob extends Value {
return
compression
;
return
compression
;
}
}
p
ublic
static
synchronized
void
deleteFile
(
DataHandler
handler
,
String
fileName
)
{
p
rivate
static
synchronized
void
deleteFile
(
DataHandler
handler
,
String
fileName
)
{
// synchronize on the database, to avoid concurrent temp file creation /
// synchronize on the database, to avoid concurrent temp file creation /
// deletion / backup
// deletion / backup
synchronized
(
handler
.
getLobSyncObject
())
{
synchronized
(
handler
.
getLobSyncObject
())
{
...
...
h2/src/tools/org/h2/build/doclet/Doclet.java
浏览文件 @
43701f3f
...
@@ -203,7 +203,7 @@ public class Doclet {
...
@@ -203,7 +203,7 @@ public class Doclet {
String
name
=
field
.
name
();
String
name
=
field
.
name
();
String
text
=
field
.
commentText
();
String
text
=
field
.
commentText
();
if
(
text
==
null
||
text
.
trim
().
length
()
==
0
)
{
if
(
text
==
null
||
text
.
trim
().
length
()
==
0
)
{
addError
(
"Undocumented field ("
+
clazz
.
name
()
+
".java:"
+
field
.
position
().
line
(
)
+
") "
+
name
);
addError
(
"Undocumented field ("
+
getLink
(
clazz
,
field
.
position
().
line
()
)
+
") "
+
name
);
}
}
if
(
text
!=
null
&&
text
.
startsWith
(
"INTERNAL"
))
{
if
(
text
!=
null
&&
text
.
startsWith
(
"INTERNAL"
))
{
continue
;
continue
;
...
@@ -315,7 +315,7 @@ public class Doclet {
...
@@ -315,7 +315,7 @@ public class Doclet {
if
(
hasComment
&&
!
method
.
commentText
().
startsWith
(
"["
))
{
if
(
hasComment
&&
!
method
.
commentText
().
startsWith
(
"["
))
{
// [Not supported] and such are not problematic
// [Not supported] and such are not problematic
addError
(
"Undocumented parameter(s) ("
+
addError
(
"Undocumented parameter(s) ("
+
clazz
.
name
()
+
".java:"
+
method
.
position
().
line
(
)
+
") "
+
getLink
(
clazz
,
method
.
position
().
line
()
)
+
") "
+
name
+
" documented: "
+
paramTags
.
length
+
" params: "
+
params
.
length
);
name
+
" documented: "
+
paramTags
.
length
+
" params: "
+
params
.
length
);
}
}
}
}
...
@@ -324,7 +324,7 @@ public class Doclet {
...
@@ -324,7 +324,7 @@ public class Doclet {
String
comment
=
paramTags
[
j
].
parameterComment
();
String
comment
=
paramTags
[
j
].
parameterComment
();
if
(
comment
.
trim
().
length
()
==
0
)
{
if
(
comment
.
trim
().
length
()
==
0
)
{
addError
(
"Undocumented parameter ("
+
addError
(
"Undocumented parameter ("
+
clazz
.
name
()
+
".java:"
+
method
.
position
().
line
(
)
+
") "
+
name
+
" "
+
paramName
);
getLink
(
clazz
,
method
.
position
().
line
()
)
+
") "
+
name
+
" "
+
paramName
);
}
}
String
p
=
paramName
+
" - "
+
comment
;
String
p
=
paramName
+
" - "
+
comment
;
if
(
j
==
0
)
{
if
(
j
==
0
)
{
...
@@ -339,7 +339,7 @@ public class Doclet {
...
@@ -339,7 +339,7 @@ public class Doclet {
String
returnComment
=
returnTags
[
0
].
text
();
String
returnComment
=
returnTags
[
0
].
text
();
if
(
returnComment
.
trim
().
length
()
==
0
)
{
if
(
returnComment
.
trim
().
length
()
==
0
)
{
addError
(
"Undocumented return value ("
+
addError
(
"Undocumented return value ("
+
clazz
.
name
()
+
".java:"
+
method
.
position
().
line
(
)
+
") "
+
name
);
getLink
(
clazz
,
method
.
position
().
line
()
)
+
") "
+
name
);
}
}
writer
.
println
(
"<div class=\"item\">"
+
returnComment
+
"</div>"
);
writer
.
println
(
"<div class=\"item\">"
+
returnComment
+
"</div>"
);
}
else
if
(
returnType
!=
null
&&
!
returnType
.
toString
().
equals
(
"void"
))
{
}
else
if
(
returnType
!=
null
&&
!
returnType
.
toString
().
equals
(
"void"
))
{
...
@@ -347,7 +347,7 @@ public class Doclet {
...
@@ -347,7 +347,7 @@ public class Doclet {
// [Not supported] and such are not problematic
// [Not supported] and such are not problematic
// also not problematic are methods that always throw an exception
// also not problematic are methods that always throw an exception
addError
(
"Undocumented return value ("
+
addError
(
"Undocumented return value ("
+
clazz
.
name
()
+
".java:"
+
method
.
position
().
line
(
)
+
") "
+
name
+
" "
+
getReturnType
(
method
));
getLink
(
clazz
,
method
.
position
().
line
()
)
+
") "
+
name
+
" "
+
getReturnType
(
method
));
}
}
}
}
if
(
hasThrowsTag
)
{
if
(
hasThrowsTag
)
{
...
@@ -363,6 +363,15 @@ public class Doclet {
...
@@ -363,6 +363,15 @@ public class Doclet {
}
}
}
}
private
static
String
getLink
(
ClassDoc
clazz
,
int
line
)
{
String
c
=
clazz
.
name
();
int
x
=
c
.
lastIndexOf
(
'.'
);
if
(
x
>=
0
)
{
c
=
c
.
substring
(
0
,
x
);
}
return
c
+
".java:"
+
line
;
}
private
String
getFieldLink
(
String
text
,
String
constant
,
ClassDoc
clazz
,
String
name
)
{
private
String
getFieldLink
(
String
text
,
String
constant
,
ClassDoc
clazz
,
String
name
)
{
String
link
=
constant
!=
null
?
constant
:
name
.
toLowerCase
();
String
link
=
constant
!=
null
?
constant
:
name
.
toLowerCase
();
int
linkStart
=
text
.
indexOf
(
"<code>"
);
int
linkStart
=
text
.
indexOf
(
"<code>"
);
...
@@ -431,7 +440,7 @@ public class Doclet {
...
@@ -431,7 +440,7 @@ public class Doclet {
returnType
.
toString
().
equals
(
"boolean"
);
returnType
.
toString
().
equals
(
"boolean"
);
if
(!
setterOrGetter
)
{
if
(!
setterOrGetter
)
{
addError
(
"Undocumented method "
+
addError
(
"Undocumented method "
+
" ("
+
clazz
.
name
()
+
".java:"
+
method
.
position
().
line
(
)
+
") "
+
" ("
+
getLink
(
clazz
,
method
.
position
().
line
()
)
+
") "
+
clazz
+
"."
+
name
+
" "
+
raw
);
clazz
+
"."
+
name
+
" "
+
raw
);
return
true
;
return
true
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论