Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
065aa507
提交
065aa507
authored
7月 28, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prepare release.
上级
121598c2
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
40 个修改的文件
包含
911 行增加
和
784 行删除
+911
-784
help.csv
h2/src/docsrc/help/help.csv
+2
-2
changelog.html
h2/src/docsrc/html/changelog.html
+4
-4
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+243
-210
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+243
-210
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+221
-210
AggregateFunction.java
h2/src/main/org/h2/api/AggregateFunction.java
+1
-1
AlterTableRenameColumn.java
h2/src/main/org/h2/command/ddl/AlterTableRenameColumn.java
+2
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+3
-3
DataUtils.java
h2/src/main/org/h2/mvstore/DataUtils.java
+15
-14
FreeSpaceBitSet.java
h2/src/main/org/h2/mvstore/FreeSpaceBitSet.java
+20
-20
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+10
-9
MVTableEngine.java
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
+3
-3
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+4
-4
MVRTreeMap.java
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
+21
-14
ResultTempTable.java
h2/src/main/org/h2/result/ResultTempTable.java
+2
-1
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+1
-1
LobStorageBackend.java
h2/src/main/org/h2/store/LobStorageBackend.java
+20
-8
Column.java
h2/src/main/org/h2/table/Column.java
+4
-1
TableBase.java
h2/src/main/org/h2/table/TableBase.java
+1
-1
SourceCompiler.java
h2/src/main/org/h2/util/SourceCompiler.java
+5
-4
DataType.java
h2/src/main/org/h2/value/DataType.java
+5
-5
ValueGeometry.java
h2/src/main/org/h2/value/ValueGeometry.java
+1
-1
TestAlter.java
h2/src/test/org/h2/test/db/TestAlter.java
+1
-1
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+1
-1
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+1
-1
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+2
-2
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+1
-1
FreeSpaceList.java
h2/src/test/org/h2/test/store/FreeSpaceList.java
+18
-6
FreeSpaceTree.java
h2/src/test/org/h2/test/store/FreeSpaceTree.java
+21
-9
TestDataUtils.java
h2/src/test/org/h2/test/store/TestDataUtils.java
+1
-1
TestFreeSpace.java
h2/src/test/org/h2/test/store/TestFreeSpace.java
+10
-10
TestMVRTree.java
h2/src/test/org/h2/test/store/TestMVRTree.java
+3
-3
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+1
-1
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+2
-2
TestTransactionStore.java
h2/src/test/org/h2/test/store/TestTransactionStore.java
+3
-3
TestFileLockSerialized.java
h2/src/test/org/h2/test/unit/TestFileLockSerialized.java
+2
-2
TestPgServer.java
h2/src/test/org/h2/test/unit/TestPgServer.java
+3
-3
Build.java
h2/src/tools/org/h2/build/Build.java
+2
-2
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+3
-4
JavaProcessKiller.java
h2/src/tools/org/h2/dev/util/JavaProcessKiller.java
+5
-5
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
065aa507
...
...
@@ -2930,7 +2930,7 @@ CHAR(65)
CONCAT(string, string [,...])
","
Combines strings.
Unlike with the operator ""||"", NULL parameters are ignored,
Unlike with the operator ""||"", NULL parameters are ignored,
and do not cause the result to become NULL.
This method returns a string.
","
...
...
@@ -2941,7 +2941,7 @@ CONCAT(NAME, '!')
CONCAT_WS(separatorString, string, string [,...])
","
Combines strings with separator.
Unlike with the operator ""||"", NULL parameters are ignored,
Unlike with the operator ""||"", NULL parameters are ignored,
and do not cause the result to become NULL.
This method returns a string.
","
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
065aa507
...
...
@@ -53,15 +53,15 @@ Change Log
</li><li>
Fix a NullPointerException when attempting to add foreign key reference to a view.
</li><li>
Add sufficient ClientInfo support to our javax.sql.Connection implementation to make WebSphere happy.
</li><li>
Issue 482: class LobStorageBackend$LobInputStream does not override the method InputStream.available().
</li><li>
Fix corruption resulting from a mix of the "WRITE_DELAY=0" option
</li><li>
Fix corruption resulting from a mix of the "WRITE_DELAY=0" option
and "SELECT DISTINCT" queries that don't fit in memory.
</li><li>
Fix the combination of updating a table which contains an LOB,
</li><li>
Fix the combination of updating a table which contains an LOB,
and reading from the LOB at the same time.
Previously it would throw an exception, now it works.
</li><li>
Issue 484: In the H2 Console tool, all schemas starting with "INFO" where hidden.
Now they are hidden only if the database is not H2. Patch from "mgcodeact"/"cumer d"
</li><li>
MySQL compatibil
t
ity, support the "AUTO_INCREMENT=3" part of the CREATE TABLE statement.
</li><li>
Issue 486: MySQL compatibil
t
ity, support the "DEFAULT CHARSET" part of the CREATE TABLE statement.
</li><li>
MySQL compatibility, support the "AUTO_INCREMENT=3" part of the CREATE TABLE statement.
</li><li>
Issue 486: MySQL compatibility, support the "DEFAULT CHARSET" part of the CREATE TABLE statement.
</li><li>
Issue 487: support the MySQL "SET foreign_key_checks = 0" command
</li><li>
Issue 490: support MySQL "USING BTREE" index declaration
</li><li>
Issue 485: Database get corrupted when column is renamed for which check constraint was defined inside create table statement.
...
...
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
065aa507
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
065aa507
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
065aa507
差异被折叠。
点击展开。
h2/src/main/org/h2/api/AggregateFunction.java
浏览文件 @
065aa507
...
...
@@ -28,7 +28,7 @@ public interface AggregateFunction {
* the input data. The method should check here if the number of parameters
* passed is correct, and if not it should throw an exception.
*
* @param inputTypes the SQL type of the parameters, {@link java.sql.Types}
* @param inputTypes the SQL type of the parameters, {@link java.sql.Types}
* @return the SQL type of the result
*/
int
getType
(
int
[]
inputTypes
)
throws
SQLException
;
...
...
h2/src/main/org/h2/command/ddl/AlterTableRenameColumn.java
浏览文件 @
065aa507
...
...
@@ -47,7 +47,8 @@ public class AlterTableRenameColumn extends DefineCommand {
Database
db
=
session
.
getDatabase
();
session
.
getUser
().
checkRight
(
table
,
Right
.
ALL
);
table
.
checkSupportAlter
();
// we need to update CHECK constraint since it might reference the name of the column
// we need to update CHECK constraint
// since it might reference the name of the column
Expression
newCheckExpr
=
column
.
getCheckConstraint
(
session
,
newName
);
table
.
renameColumn
(
column
,
newName
);
column
.
removeCheckConstraint
();
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
065aa507
...
...
@@ -280,7 +280,7 @@ public class Database implements DataHandler {
public
void
exceptionThrown
(
Exception
e
)
{
setBackgroundException
(
DbException
.
convert
(
e
));
}
});
}
...
...
@@ -1819,7 +1819,7 @@ public class Database implements DataHandler {
}
session
.
setAllCommitted
();
}
private
void
throwLastBackgroundException
()
{
if
(
backgroundException
!=
null
)
{
// we don't care too much about concurrency here,
...
...
@@ -1832,7 +1832,7 @@ public class Database implements DataHandler {
}
}
}
public
void
setBackgroundException
(
DbException
e
)
{
if
(
backgroundException
==
null
)
{
backgroundException
=
e
;
...
...
h2/src/main/org/h2/mvstore/DataUtils.java
浏览文件 @
065aa507
...
...
@@ -28,48 +28,48 @@ public class DataUtils {
* An error occurred while reading from the file.
*/
public
static
final
int
ERROR_READING_FAILED
=
1
;
/**
* An error occurred when trying to write to the file.
*/
public
static
final
int
ERROR_WRITING_FAILED
=
2
;
/**
* An internal error occurred. This could be a bug, or a memory corruption
* (for example caused by out of memory).
*/
public
static
final
int
ERROR_INTERNAL
=
3
;
/**
* The object is already closed.
*/
public
static
final
int
ERROR_CLOSED
=
4
;
/**
* The file format is not supported.
*/
public
static
final
int
ERROR_UNSUPPORTED_FORMAT
=
5
;
/**
* The file is corrupt or (for encrypted files) the encryption key is wrong.
*/
public
static
final
int
ERROR_FILE_CORRUPT
=
6
;
/**
* The file is locked.
*/
public
static
final
int
ERROR_FILE_LOCKED
=
7
;
/**
* An error occurred when serializing or de-serializing.
*/
public
static
final
int
ERROR_SERIALIZATION
=
8
;
/**
* The transaction store is corrupt.
*/
public
static
final
int
ERROR_TRANSACTION_CORRUPT
=
100
;
/**
* A lock timeout occurred.
*/
...
...
@@ -687,6 +687,7 @@ public class DataUtils {
/**
* Create a new IllegalStateException.
*
* @param errorCode the error code
* @param message the message
* @param arguments the arguments
* @return the exception
...
...
@@ -708,7 +709,7 @@ public class DataUtils {
}
return
e
;
}
private
static
String
formatMessage
(
int
errorCode
,
String
message
,
Object
...
arguments
)
{
// convert arguments to strings, to avoid locale specific formatting
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
++)
{
...
...
@@ -717,15 +718,15 @@ public class DataUtils {
arguments
[
i
]
=
a
==
null
?
"null"
:
a
.
toString
();
}
}
return
MessageFormat
.
format
(
message
,
arguments
)
+
return
MessageFormat
.
format
(
message
,
arguments
)
+
" ["
+
Constants
.
VERSION_MAJOR
+
"."
+
Constants
.
VERSION_MINOR
+
"."
+
Constants
.
BUILD_ID
+
"/"
+
errorCode
+
"]"
;
Constants
.
VERSION_MINOR
+
"."
+
Constants
.
BUILD_ID
+
"/"
+
errorCode
+
"]"
;
}
/**
* Get the error code from an exception message.
*
*
* @param m the message
* @return the error code, or 0 if none
*/
...
...
h2/src/main/org/h2/mvstore/FreeSpaceBitSet.java
浏览文件 @
065aa507
...
...
@@ -19,20 +19,20 @@ public class FreeSpaceBitSet {
* The first usable block.
*/
private
final
int
firstFreeBlock
;
/**
* The block size in bytes.
*/
private
final
int
blockSize
;
/**
* The bit set.
*/
private
final
BitSet
set
=
new
BitSet
();
/**
* Create a new free space map.
*
*
* @param firstFreeBlock the first free block
* @param blockSize the block size
*/
...
...
@@ -41,7 +41,7 @@ public class FreeSpaceBitSet {
this
.
blockSize
=
blockSize
;
clear
();
}
/**
* Reset the list.
*/
...
...
@@ -49,10 +49,10 @@ public class FreeSpaceBitSet {
set
.
clear
();
set
.
set
(
0
,
firstFreeBlock
);
}
/**
* Check whether one of the blocks is in use.
*
*
* @param pos the position in bytes
* @param length the number of bytes
* @return true if a block is in use
...
...
@@ -67,10 +67,10 @@ public class FreeSpaceBitSet {
}
return
true
;
}
/**
* Check whether one of the blocks is free.
*
*
* @param pos the position in bytes
* @param length the number of bytes
* @return true if a block is free
...
...
@@ -99,48 +99,48 @@ public class FreeSpaceBitSet {
int
end
=
set
.
nextSetBit
(
start
+
1
);
if
(
end
<
0
||
end
-
start
>=
blocks
)
{
set
.
set
(
start
,
start
+
blocks
);
return
getPos
(
start
);
return
getPos
(
start
);
}
i
=
end
;
}
}
/**
* Mark the space as in use.
*
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public
synchronized
void
markUsed
(
long
pos
,
int
length
)
{
int
start
=
getBlock
(
pos
);
int
blocks
=
getBlockCount
(
length
);
int
blocks
=
getBlockCount
(
length
);
set
.
set
(
start
,
start
+
blocks
);
}
/**
* Mark the space as free.
*
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public
synchronized
void
free
(
long
pos
,
int
length
)
{
int
start
=
getBlock
(
pos
);
int
blocks
=
getBlockCount
(
length
);
int
blocks
=
getBlockCount
(
length
);
set
.
clear
(
start
,
start
+
blocks
);
}
private
long
getPos
(
int
block
)
{
return
(
long
)
block
*
(
long
)
blockSize
;
}
private
int
getBlock
(
long
pos
)
{
return
(
int
)
(
pos
/
blockSize
);
}
private
int
getBlockCount
(
int
length
)
{
return
MathUtils
.
roundUpInt
(
length
,
blockSize
)
/
blockSize
;
}
@Override
public
String
toString
()
{
StringBuilder
buff
=
new
StringBuilder
(
"["
);
...
...
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
065aa507
...
...
@@ -161,7 +161,7 @@ public class MVStore {
*/
private
final
ConcurrentHashMap
<
Integer
,
Chunk
>
chunks
=
new
ConcurrentHashMap
<
Integer
,
Chunk
>();
/**
* The free spaces between the chunks. The first block to use is block 2
* (the first two blocks are the file header).
...
...
@@ -235,7 +235,7 @@ public class MVStore {
* The delay in milliseconds to automatically store changes.
*/
private
int
writeDelay
=
1000
;
private
ExceptionListener
backgroundExceptionListener
;
MVStore
(
HashMap
<
String
,
Object
>
config
)
{
...
...
@@ -441,7 +441,7 @@ public class MVStore {
/**
* Open the store.
*
*
* @throws IllegalStateException if the file is corrupt, or an exception
* occurred while opening
* @throws IllegalArgumentException if the directory does not exist
...
...
@@ -932,7 +932,7 @@ public class MVStore {
int
chunkLength
=
buff
.
position
();
// round to the next block,
// round to the next block,
// and one additional block for the file header
int
length
=
MathUtils
.
roundUpInt
(
chunkLength
,
BLOCK_SIZE
)
+
BLOCK_SIZE
;
if
(
length
>
buff
.
capacity
())
{
...
...
@@ -972,7 +972,7 @@ public class MVStore {
buff
.
position
(
0
);
fileWriteCount
++;
DataUtils
.
writeFully
(
file
,
filePos
,
buff
);
fileSize
=
Math
.
max
(
fileSize
,
filePos
+
buff
.
position
());
if
(
buff
.
capacity
()
<=
4
*
1024
*
1024
)
{
writeBuffer
=
buff
;
...
...
@@ -1457,10 +1457,11 @@ public class MVStore {
}
return
v
;
}
/**
* Set the listener to be used for exceptions that occur in the background thread.
*
* Set the listener to be used for exceptions that occur in the background
* thread.
*
* @param backgroundExceptionListener the listener
*/
public
void
setBackgroundExceptionListener
(
...
...
@@ -1804,7 +1805,7 @@ public class MVStore {
/**
* Set the read cache size in MB.
*
*
* @param mb the cache size in MB.
*/
public
void
setCacheSize
(
long
mb
)
{
...
...
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
浏览文件 @
065aa507
...
...
@@ -31,10 +31,10 @@ import org.h2.util.New;
* A table engine that internally uses the MVStore.
*/
public
class
MVTableEngine
implements
TableEngine
{
/**
* Initialize the MVStore.
*
*
* @param db the database
* @return the store
*/
...
...
@@ -197,7 +197,7 @@ public class MVTableEngine implements TableEngine {
public
void
initTransactions
()
{
List
<
Transaction
>
list
=
transactionStore
.
getOpenTransactions
();
for
(
Transaction
t
:
list
)
{
if
(
t
.
getStatus
()
==
Transaction
.
STATUS_COMITTING
)
{
if
(
t
.
getStatus
()
==
Transaction
.
STATUS_COM
M
ITTING
)
{
t
.
commit
();
}
else
if
(
t
.
getStatus
()
!=
Transaction
.
STATUS_PREPARED
)
{
t
.
rollback
();
...
...
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
065aa507
...
...
@@ -45,7 +45,7 @@ public class TransactionStore {
/**
* The undo log.
* If the first entry for a transaction doesn't have a logId of 0, then
* the transaction is committing (partially committed).
* the transaction is committing (partially committed).
* Key: [ transactionId, logId ], value: [ opType, mapId, key, oldValue ].
*/
final
MVMap
<
long
[],
Object
[]>
undoLog
;
...
...
@@ -147,7 +147,7 @@ public class TransactionStore {
if
(
undoLog
.
containsKey
(
key
))
{
status
=
Transaction
.
STATUS_OPEN
;
}
else
{
status
=
Transaction
.
STATUS_COMITTING
;
status
=
Transaction
.
STATUS_COM
M
ITTING
;
}
name
=
null
;
}
else
{
...
...
@@ -239,7 +239,7 @@ public class TransactionStore {
return
;
}
synchronized
(
undoLog
)
{
t
.
setStatus
(
Transaction
.
STATUS_COMITTING
);
t
.
setStatus
(
Transaction
.
STATUS_COM
M
ITTING
);
for
(
long
logId
=
0
;
logId
<
maxLogId
;
logId
++)
{
commitIfNeeded
();
long
[]
undoKey
=
new
long
[]
{
t
.
getId
(),
logId
};
...
...
@@ -504,7 +504,7 @@ public class TransactionStore {
* closed while the transaction is committing. When opening a store,
* such transactions should be committed.
*/
public
static
final
int
STATUS_COMITTING
=
3
;
public
static
final
int
STATUS_COM
M
ITTING
=
3
;
/**
* The operation type for changes in a map.
...
...
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
浏览文件 @
065aa507
...
...
@@ -8,6 +8,7 @@ package org.h2.mvstore.rtree;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
org.h2.mvstore.CursorPos
;
import
org.h2.mvstore.DataUtils
;
import
org.h2.mvstore.MVMap
;
...
...
@@ -61,7 +62,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
* @param x the rectangle
* @return the iterator
*/
public
Iterator
<
SpatialKey
>
findIntersectingKeys
(
SpatialKey
x
)
{
public
RTreeCursor
findIntersectingKeys
(
SpatialKey
x
)
{
checkOpen
();
return
new
RTreeCursor
(
root
,
x
)
{
@Override
...
...
@@ -77,7 +78,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
* @param x the rectangle
* @return the iterator
*/
public
Iterator
<
SpatialKey
>
findContainedKeys
(
SpatialKey
x
)
{
public
RTreeCursor
findContainedKeys
(
SpatialKey
x
)
{
checkOpen
();
return
new
RTreeCursor
(
root
,
x
)
{
@Override
...
...
@@ -483,7 +484,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
* A cursor to iterate over a subset of the keys.
*/
static
class
RTreeCursor
implements
Iterator
<
SpatialKey
>
{
private
final
SpatialKey
filter
;
private
CursorPos
pos
;
private
SpatialKey
current
;
...
...
@@ -494,7 +495,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
this
.
root
=
root
;
this
.
filter
=
filter
;
}
@Override
public
boolean
hasNext
()
{
if
(!
initialized
)
{
...
...
@@ -505,7 +506,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
}
return
current
!=
null
;
}
/**
* Skip over that many entries. This method is relatively fast (for this map
* implementation) even if many entries need to be skipped.
*
* @param n the number of entries to skip
*/
public
void
skip
(
long
n
)
{
while
(
hasNext
()
&&
n
--
>
0
)
{
fetchNext
();
...
...
@@ -521,13 +528,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
fetchNext
();
return
c
;
}
@Override
public
void
remove
()
{
throw
DataUtils
.
newUnsupportedOperationException
(
"Removing is not supported"
);
}
/**
* Fetch the next entry if there is one.
*/
...
...
@@ -563,7 +570,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
}
current
=
null
;
}
// if(pos==null || pos.page != p) {
// pos = new CursorPos(p, i + 1, pos);
// } else {
...
...
@@ -574,8 +581,8 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
// break;
// }
// }
//
//
// if (pos.index < pos.page.getKeyCount()) {
// pos.index++;
// }
...
...
@@ -645,13 +652,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
// }
// }
// }
// }
//
// }
//
// @Override
// protected void min(Page p, SpatialKey x) {
// // x
// }
//
//
// protected void min3(Page p, SpatialKey x) {
// while (true) {
// if (p.isLeaf()) {
...
...
@@ -698,7 +705,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
// }
// current = null;
// }
}
@Override
...
...
h2/src/main/org/h2/result/ResultTempTable.java
浏览文件 @
065aa507
...
...
@@ -153,7 +153,8 @@ public class ResultTempTable implements ResultExternal {
}
try
{
Database
database
=
session
.
getDatabase
();
// Need to lock because not all of the code-paths that reach here have already taken this lock,
// Need to lock because not all of the code-paths
// that reach here have already taken this lock,
// notably via the close() paths.
synchronized
(
session
)
{
synchronized
(
database
)
{
...
...
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
065aa507
...
...
@@ -597,7 +597,7 @@ public class PgServerThread implements Runnable {
}
}
}
private
static
void
checkParamLength
(
int
expected
,
int
got
)
{
if
(
expected
!=
got
)
{
throw
DbException
.
getInvalidValueException
(
"paramLen"
,
got
);
...
...
h2/src/main/org/h2/store/LobStorageBackend.java
浏览文件 @
065aa507
...
...
@@ -61,7 +61,7 @@ public class LobStorageBackend implements LobStorageInterface {
JdbcConnection
conn
;
final
Database
database
;
private
final
HashMap
<
String
,
PreparedStatement
>
prepared
=
New
.
hashMap
();
private
long
nextBlock
;
private
final
CompressTool
compress
=
CompressTool
.
getInstance
();
...
...
@@ -156,7 +156,7 @@ public class LobStorageBackend implements LobStorageInterface {
/**
* Remove all LOBs for this table.
*
*
* @param tableId the table id
*/
public
void
removeAllForTable
(
int
tableId
)
{
...
...
@@ -185,7 +185,7 @@ public class LobStorageBackend implements LobStorageInterface {
/**
* Read a block of data from the given LOB.
*
*
* @param block the block number
* @return the block (expanded if stored compressed)
*/
...
...
@@ -217,7 +217,7 @@ public class LobStorageBackend implements LobStorageInterface {
* Retrieve the sequence id and position that is smaller than the requested
* position. Those values can be used to quickly skip to a given position
* without having to read all data.
*
*
* @param lob the lob
* @param pos the required position
* @return null if the data is not available, or an array of two elements:
...
...
@@ -244,6 +244,12 @@ public class LobStorageBackend implements LobStorageInterface {
}
}
/**
* Create a prepared statement, or re-use an existing one.
*
* @param sql the SQL statement
* @return the prepared statement
*/
PreparedStatement
prepare
(
String
sql
)
throws
SQLException
{
if
(
SysProperties
.
CHECK2
)
{
if
(!
Thread
.
holdsLock
(
database
))
{
...
...
@@ -257,6 +263,12 @@ public class LobStorageBackend implements LobStorageInterface {
return
prep
;
}
/**
* Allow to re-use the prepared statement.
*
* @param sql the SQL statement
* @param prep the prepared statement
*/
void
reuse
(
String
sql
,
PreparedStatement
prep
)
{
if
(
SysProperties
.
CHECK2
)
{
if
(!
Thread
.
holdsLock
(
database
))
{
...
...
@@ -465,7 +477,7 @@ public class LobStorageBackend implements LobStorageInterface {
/**
* Store a block in the LOB storage.
*
*
* @param lobId the lob id
* @param seq the sequence number
* @param pos the position within the lob
...
...
@@ -572,12 +584,12 @@ public class LobStorageBackend implements LobStorageInterface {
* to the table that contains the LOB column from changing the data under us.
*/
private
final
long
[]
lobMapBlocks
;
/**
* index into the lobMapBlocks array.
*/
private
int
lobMapIndex
;
/**
* The remaining bytes in the lob.
*/
...
...
@@ -612,7 +624,7 @@ public class LobStorageBackend implements LobStorageInterface {
reuse
(
sql
,
prep
);
}
this
.
remainingBytes
=
byteCount
;
String
sql
=
"SELECT COUNT(*) FROM "
+
LOB_MAP
+
" WHERE LOB = ?"
;
PreparedStatement
prep
=
prepare
(
sql
);
prep
.
setLong
(
1
,
lobId
);
...
...
h2/src/main/org/h2/table/Column.java
浏览文件 @
065aa507
...
...
@@ -563,11 +563,14 @@ public class Column {
checkConstraintSQL
=
getCheckConstraintSQL
(
session
,
name
);
}
/**
* Remove the check constraint if there is one.
*/
public
void
removeCheckConstraint
()
{
checkConstraint
=
null
;
checkConstraintSQL
=
null
;
}
/**
* Get the check constraint expression for this column if set.
*
...
...
h2/src/main/org/h2/table/TableBase.java
浏览文件 @
065aa507
...
...
@@ -28,7 +28,7 @@ public abstract class TableBase extends Table {
private
final
String
tableEngine
;
/** Provided table parameters */
private
List
<
String
>
tableEngineParams
=
new
ArrayList
<
String
>();
private
final
boolean
globalTemporary
;
public
TableBase
(
CreateTableData
data
)
{
...
...
h2/src/main/org/h2/util/SourceCompiler.java
浏览文件 @
065aa507
...
...
@@ -211,12 +211,13 @@ public class SourceCompiler {
ByteArrayOutputStream
buff
=
new
ByteArrayOutputStream
();
try
{
ProcessBuilder
builder
=
new
ProcessBuilder
();
// The javac executable allows some of it's flags to be smuggled in via environment variables.
// But if it sees those flags, it will write out a message to stderr, which messes up our
// parsing of the output.
// The javac executable allows some of it's flags
// to be smuggled in via environment variables.
// But if it sees those flags, it will write out a message
// to stderr, which messes up our parsing of the output.
builder
.
environment
().
remove
(
"JAVA_TOOL_OPTIONS"
);
builder
.
command
(
args
);
Process
p
=
builder
.
start
();
copyInThread
(
p
.
getInputStream
(),
buff
);
copyInThread
(
p
.
getErrorStream
(),
buff
);
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
065aa507
...
...
@@ -40,20 +40,20 @@ import org.h2.util.Utils;
* and can convert between Java objects and Values.
*/
public
class
DataType
{
/**
* This constant is used to represent the type of a ResultSet. There is no
* equivalent java.sql.Types value, but Oracle uses it to represent a
* ResultSet (OracleTypes.CURSOR = -10).
*/
public
static
final
int
TYPE_RESULT_SET
=
-
10
;
/**
* The Geometry class. This object is null if the jts jar file is not in the
* classpath.
*/
public
static
final
Class
<?>
GEOMETRY_CLASS
;
private
static
final
String
GEOMETRY_CLASS_NAME
=
"com.vividsolutions.jts.geom.Geometry"
;
/**
...
...
@@ -169,7 +169,7 @@ public class DataType {
* The number of bytes required for an object.
*/
public
int
memory
;
static
{
Class
<?>
g
;
try
{
...
...
@@ -960,7 +960,7 @@ public class DataType {
return
ValueJavaObject
.
getNoCopy
(
x
,
null
);
}
}
private
static
boolean
isGeometry
(
Object
x
)
{
if
(
x
==
null
||
GEOMETRY_CLASS
==
null
)
{
return
false
;
...
...
h2/src/main/org/h2/value/ValueGeometry.java
浏览文件 @
065aa507
...
...
@@ -41,7 +41,7 @@ public class ValueGeometry extends Value {
public
static
ValueGeometry
getFromGeometry
(
Object
o
)
{
return
get
((
Geometry
)
o
);
}
private
static
ValueGeometry
get
(
Geometry
g
)
{
return
(
ValueGeometry
)
Value
.
cache
(
new
ValueGeometry
(
g
));
}
...
...
h2/src/test/org/h2/test/db/TestAlter.java
浏览文件 @
065aa507
...
...
@@ -128,7 +128,7 @@ public class TestAlter extends TestBase {
execute
(
"insert into test values(3)"
);
stat
.
execute
(
"drop table test"
);
}
private
void
testAlterTableDropIdentityColumn
()
throws
SQLException
{
stat
.
execute
(
"create table test(id int auto_increment, name varchar)"
);
stat
.
execute
(
"alter table test drop column id"
);
...
...
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
065aa507
...
...
@@ -101,7 +101,7 @@ public class TestCases extends TestBase {
testBinaryCollation
();
deleteDb
(
"cases"
);
}
private
void
testEmptyStatements
()
throws
SQLException
{
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
065aa507
...
...
@@ -272,7 +272,7 @@ public class TestCompatibility extends TestBase {
// this maps to SET REFERENTIAL_INTEGRITY TRUE/FALSE
stat
.
execute
(
"SET foreign_key_checks = 0"
);
stat
.
execute
(
"SET foreign_key_checks = 1"
);
// Check if mysql comments are supported, ensure clean connection
conn
.
close
();
conn
=
getConnection
(
"compatibility;MODE=MYSQL"
);
...
...
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
065aa507
...
...
@@ -1473,5 +1473,5 @@ public class TestLob extends TestBase {
r
.
close
();
conn
.
close
();
}
}
}
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
065aa507
...
...
@@ -83,7 +83,7 @@ public class TestTableEngines extends TestBase {
assertEquals
(
"param2"
,
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
get
(
1
));
conn
.
close
();
if
(!
config
.
memory
)
{
// Test seriali
s
ation of table parameters
// Test seriali
z
ation of table parameters
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
clear
();
conn
=
getConnection
(
"tableEngine"
);
assertEquals
(
2
,
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
size
());
...
...
h2/src/test/org/h2/test/store/FreeSpaceList.java
浏览文件 @
065aa507
...
...
@@ -16,12 +16,12 @@ import org.h2.util.MathUtils;
* A list that maintains ranges of free space (in blocks).
*/
public
class
FreeSpaceList
{
/**
* The first usable block.
*/
private
final
int
firstFreeBlock
;
/**
* The block size in bytes.
*/
...
...
@@ -43,10 +43,10 @@ public class FreeSpaceList {
*/
public
synchronized
void
clear
()
{
freeSpaceList
.
clear
();
freeSpaceList
.
add
(
new
BlockRange
(
firstFreeBlock
,
freeSpaceList
.
add
(
new
BlockRange
(
firstFreeBlock
,
Integer
.
MAX_VALUE
-
firstFreeBlock
));
}
/**
* Allocate a number of blocks and mark them as used.
*
...
...
@@ -67,6 +67,12 @@ public class FreeSpaceList {
"Could not find a free page to allocate"
);
}
/**
* Mark the space as in use.
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public
synchronized
void
markUsed
(
long
pos
,
int
length
)
{
int
start
=
(
int
)
(
pos
/
blockSize
);
int
required
=
getBlockCount
(
length
);
...
...
@@ -112,6 +118,12 @@ public class FreeSpaceList {
}
}
/**
* Mark the space as free.
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public
synchronized
void
free
(
long
pos
,
int
length
)
{
int
start
=
(
int
)
(
pos
/
blockSize
);
int
required
=
getBlockCount
(
length
);
...
...
@@ -158,7 +170,7 @@ public class FreeSpaceList {
BlockRange
newRange
=
new
BlockRange
(
start
,
required
);
freeSpaceList
.
add
(
i
,
newRange
);
}
private
int
getBlockCount
(
int
length
)
{
if
(
length
<=
0
)
{
throw
DataUtils
.
newIllegalStateException
(
...
...
@@ -199,7 +211,7 @@ public class FreeSpaceList {
}
return
start
+
"-"
+
(
start
+
length
-
1
);
}
}
}
h2/src/test/org/h2/test/store/FreeSpaceTree.java
浏览文件 @
065aa507
...
...
@@ -15,12 +15,12 @@ import org.h2.util.MathUtils;
* A list that maintains ranges of free space (in blocks) in a file.
*/
public
class
FreeSpaceTree
{
/**
* The first usable block.
*/
private
final
int
firstFreeBlock
;
/**
* The block size in bytes.
*/
...
...
@@ -45,7 +45,7 @@ public class FreeSpaceTree {
*/
public
synchronized
void
clear
()
{
freeSpace
.
clear
();
freeSpace
.
add
(
new
BlockRange
(
firstFreeBlock
,
freeSpace
.
add
(
new
BlockRange
(
firstFreeBlock
,
Integer
.
MAX_VALUE
-
firstFreeBlock
));
}
...
...
@@ -73,7 +73,13 @@ public class FreeSpaceTree {
}
return
pos
;
}
/**
* Mark the space as in use.
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public
synchronized
void
markUsed
(
long
pos
,
int
length
)
{
int
start
=
getBlock
(
pos
);
int
blocks
=
getBlockCount
(
length
);
...
...
@@ -103,7 +109,13 @@ public class FreeSpaceTree {
prev
.
blocks
=
start
-
prev
.
start
;
}
}
/**
* Mark the space as free.
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public
synchronized
void
free
(
long
pos
,
int
length
)
{
int
start
=
getBlock
(
pos
);
int
blocks
=
getBlockCount
(
length
);
...
...
@@ -134,15 +146,15 @@ public class FreeSpaceTree {
}
freeSpace
.
add
(
x
);
}
private
long
getPos
(
int
block
)
{
return
(
long
)
block
*
(
long
)
blockSize
;
}
private
int
getBlock
(
long
pos
)
{
return
(
int
)
(
pos
/
blockSize
);
}
private
int
getBlockCount
(
int
length
)
{
if
(
length
<=
0
)
{
throw
DataUtils
.
newIllegalStateException
(
...
...
@@ -175,7 +187,7 @@ public class FreeSpaceTree {
this
.
start
=
start
;
this
.
blocks
=
blocks
;
}
@Override
public
int
compareTo
(
BlockRange
o
)
{
return
start
<
o
.
start
?
-
1
:
start
>
o
.
start
?
1
:
0
;
...
...
h2/src/test/org/h2/test/store/TestDataUtils.java
浏览文件 @
065aa507
...
...
@@ -81,7 +81,7 @@ public class TestDataUtils extends TestBase {
assertEquals
(
"1,2"
,
m
.
get
(
"c"
));
assertEquals
(
"\"test\""
,
m
.
get
(
"d"
));
}
private
void
testMapRandomized
()
{
Random
r
=
new
Random
(
1
);
String
chars
=
"a_1,\\\":"
;
...
...
h2/src/test/org/h2/test/store/TestFreeSpace.java
浏览文件 @
065aa507
...
...
@@ -26,20 +26,20 @@ public class TestFreeSpace extends TestBase {
testMemoryUsage
();
testPerformance
();
}
@Override
public
void
test
()
throws
Exception
{
testSimple
();
testRandomized
();
}
private
static
void
testPerformance
()
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
long
t
=
System
.
currentTimeMillis
();
FreeSpaceBitSet
f
=
new
FreeSpaceBitSet
(
0
,
4096
);
// 75 ms
// FreeSpaceList f = new FreeSpaceList(0, 4096);
// 13868 ms
...
...
@@ -58,18 +58,18 @@ public class TestFreeSpace extends TestBase {
System
.
out
.
println
(
System
.
currentTimeMillis
()
-
t
);
}
}
private
static
void
testMemoryUsage
()
{
// 16 GB file size
long
size
=
16L
*
1024
*
1024
*
1024
;
System
.
gc
();
System
.
gc
();
long
first
=
Utils
.
getMemoryUsed
();
long
first
=
Utils
.
getMemoryUsed
();
FreeSpaceBitSet
f
=
new
FreeSpaceBitSet
(
0
,
4096
);
// 512 KB
// FreeSpaceTree f = new FreeSpaceTree(0, 4096);
// 64 MB
...
...
@@ -105,7 +105,7 @@ public class TestFreeSpace extends TestBase {
assertEquals
(
f1
.
toString
(),
f2
.
toString
());
assertEquals
(
f1
.
toString
(),
f3
.
toString
());
}
private
void
testRandomized
()
{
FreeSpaceBitSet
f1
=
new
FreeSpaceBitSet
(
2
,
8
);
FreeSpaceList
f2
=
new
FreeSpaceList
(
2
,
8
);
...
...
h2/src/test/org/h2/test/store/TestMVRTree.java
浏览文件 @
065aa507
...
...
@@ -273,7 +273,7 @@ public class TestMVRTree extends TestMVStore {
testRandom
(
true
);
testRandom
(
false
);
}
private
void
testRandomFind
()
{
MVStore
s
=
openStore
(
null
);
MVRTreeMap
<
Integer
>
m
=
s
.
openMap
(
"data"
,
...
...
@@ -284,7 +284,7 @@ public class TestMVRTree extends TestMVStore {
int
id
=
x
*
max
+
y
;
SpatialKey
k
=
new
SpatialKey
(
id
,
x
,
x
,
y
,
y
);
m
.
put
(
k
,
id
);
}
}
}
Random
rand
=
new
Random
(
1
);
int
operationCount
=
1000
;
...
...
@@ -316,7 +316,7 @@ public class TestMVRTree extends TestMVStore {
count
++;
}
assertEquals
(
intersecting
,
count
);
}
}
}
private
void
testRandom
(
boolean
quadraticSplit
)
{
...
...
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
065aa507
...
...
@@ -266,7 +266,7 @@ public class TestMVStore extends TestBase {
encryptionKey
(
passwordChars
).
open
();
fail
();
}
catch
(
IllegalStateException
e
)
{
assertEquals
(
DataUtils
.
ERROR_FILE_CORRUPT
,
assertEquals
(
DataUtils
.
ERROR_FILE_CORRUPT
,
DataUtils
.
getErrorCode
(
e
.
getMessage
()));
}
assertEquals
(
0
,
passwordChars
[
0
]);
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
065aa507
...
...
@@ -88,7 +88,7 @@ public class TestMVTableEngine extends TestBase {
}
}
}
private
void
testTwoPhaseCommit
()
throws
Exception
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
Connection
conn
;
...
...
@@ -204,7 +204,7 @@ public class TestMVTableEngine extends TestBase {
stat
.
execute
(
"insert into test values(1)"
);
stat
.
execute
(
"shutdown immediately"
);
JdbcUtils
.
closeSilently
(
conn
);
conn
=
getConnection
(
url
);
stat
=
conn
.
createStatement
();
ResultSet
rs
=
stat
.
executeQuery
(
"select row_count_estimate "
+
...
...
h2/src/test/org/h2/test/store/TestTransactionStore.java
浏览文件 @
065aa507
...
...
@@ -55,7 +55,7 @@ public class TestTransactionStore extends TestBase {
testSingleConnection
();
testCompareWithPostgreSQL
();
}
private
void
testStopWhileCommitting
()
throws
Exception
{
String
fileName
=
getBaseDir
()
+
"/testStopWhileCommitting.h3"
;
FileUtils
.
delete
(
fileName
);
...
...
@@ -106,7 +106,7 @@ public class TestTransactionStore extends TestBase {
List
<
Transaction
>
list
=
ts
.
getOpenTransactions
();
if
(
list
.
size
()
!=
0
)
{
tx
=
list
.
get
(
0
);
if
(
tx
.
getStatus
()
==
Transaction
.
STATUS_COMITTING
)
{
if
(
tx
.
getStatus
()
==
Transaction
.
STATUS_COM
M
ITTING
)
{
i
++;
}
}
...
...
@@ -116,7 +116,7 @@ public class TestTransactionStore extends TestBase {
FileUtils
.
delete
(
fileName
);
assertFalse
(
FileUtils
.
exists
(
fileName
));
s
.
close
();
FileUtils
.
delete
(
fileName
);
FileUtils
.
delete
(
fileName
);
}
}
...
...
h2/src/test/org/h2/test/unit/TestFileLockSerialized.java
浏览文件 @
065aa507
...
...
@@ -566,7 +566,7 @@ public class TestFileLockSerialized extends TestBase {
stat
.
execute
(
"insert into test values("
+
i
+
", "
+
i
+
")"
);
}
importFinishedLatch
.
countDown
();
select1FinishedLatch
.
await
();
stat
.
execute
(
"update test set id2=999 where id=500"
);
...
...
@@ -601,7 +601,7 @@ public class TestFileLockSerialized extends TestBase {
}
};
selectTask
.
execute
();
importUpdateTask
.
get
();
selectTask
.
get
();
deleteDb
(
"fileLockSerialized"
);
...
...
h2/src/test/org/h2/test/unit/TestPgServer.java
浏览文件 @
065aa507
...
...
@@ -46,7 +46,7 @@ public class TestPgServer extends TestBase {
testCancelQuery
();
testBinaryTypes
();
}
private
boolean
getPgJdbcDriver
()
{
try
{
Class
.
forName
(
"org.postgresql.Driver"
);
...
...
@@ -146,7 +146,7 @@ public class TestPgServer extends TestBase {
prep
.
setNull
(
1
,
Types
.
VARCHAR
);
rs
=
prep
.
executeQuery
();
assertFalse
(
rs
.
next
());
prep
=
conn
.
prepareStatement
(
"insert into test values(?, ?)"
);
ParameterMetaData
meta
=
prep
.
getParameterMetaData
();
assertEquals
(
2
,
meta
.
getParameterCount
());
...
...
@@ -314,7 +314,7 @@ public class TestPgServer extends TestBase {
if
(!
getPgJdbcDriver
())
{
return
;
}
Server
server
=
Server
.
createPgServer
(
"-pgPort"
,
"5535"
,
"-pgDaemon"
,
"-key"
,
"test"
,
"mem:test"
);
server
.
start
();
try
{
...
...
h2/src/tools/org/h2/build/Build.java
浏览文件 @
065aa507
...
...
@@ -524,8 +524,8 @@ public class Build extends BuildBase {
mkdir
(
"docs/javadoc"
);
javadoc
(
"-sourcepath"
,
"src/main"
,
"org.h2.jdbc"
,
"org.h2.jdbcx"
,
"org.h2.tools"
,
"org.h2.api"
,
"org.h2.constant"
,
"org.h2.fulltext"
,
"-classpath"
,
"ext/"
+
getLuceneJar
()
+
"-classpath"
,
"ext/"
+
getLuceneJar
()
+
File
.
pathSeparator
+
"ext/jts-1.13.jar"
,
"-docletpath"
,
"bin"
+
File
.
pathSeparator
+
"temp"
,
"-doclet"
,
"org.h2.build.doclet.Doclet"
);
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
065aa507
...
...
@@ -730,7 +730,6 @@ customizers retains scalability assuming gili cancelled departments juerg
franklin indicated offending unimplemented executors dumping variants
presence spiess azeckoski aaron cowwoc decompiles canceling vividsolutions
quadtree envelope geometry polygon typname intersects wkt intersects wkb
coordinate geometric rates cope attempting sphere hyde clinton
computation varies
coordinate geometric rates cope attempting sphere hyde clinton taskkill
mgcodeact cumer reach notably computation varies smuggled stderr sees messes
nico devel
h2/src/tools/org/h2/dev/util/JavaProcessKiller.java
浏览文件 @
065aa507
...
...
@@ -19,7 +19,7 @@ public class JavaProcessKiller {
/**
* Kill a certain Java process. The JDK (jps) needs to be in the path.
*
*
* @param args the Java process name as listed by jps -l. If not set the
* Java processes are listed
*/
...
...
@@ -27,7 +27,7 @@ public class JavaProcessKiller {
public
static
void
main
(
String
...
args
)
{
new
JavaProcessKiller
().
run
(
args
);
}
private
void
run
(
String
...
args
)
{
TreeMap
<
Integer
,
String
>
map
=
getProcesses
();
System
.
out
.
println
(
"Processes:"
);
...
...
@@ -67,7 +67,7 @@ public class JavaProcessKiller {
System
.
out
.
println
(
"Processes now:"
);
System
.
out
.
println
(
map
);
}
private
static
TreeMap
<
Integer
,
String
>
getProcesses
()
{
String
processList
=
exec
(
"jps"
,
"-l"
);
String
[]
processes
=
processList
.
split
(
"\n"
);
...
...
@@ -83,7 +83,7 @@ public class JavaProcessKiller {
}
return
map
;
}
private
static
String
exec
(
String
...
args
)
{
ByteArrayOutputStream
err
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
...
...
@@ -122,5 +122,5 @@ public class JavaProcessKiller {
}
}.
run
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论