Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
764c9495
提交
764c9495
authored
1月 06, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting, javadocs, improve testability
上级
8f38fa77
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
137 行增加
和
71 行删除
+137
-71
JdbcArray.java
h2/src/main/org/h2/jdbc/JdbcArray.java
+6
-12
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+7
-1
JdbcDataSource.java
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
+3
-5
Cursor.java
h2/src/main/org/h2/mvstore/Cursor.java
+2
-2
DataUtils.java
h2/src/main/org/h2/mvstore/DataUtils.java
+4
-4
FileStore.java
h2/src/main/org/h2/mvstore/FileStore.java
+1
-1
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+2
-2
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+1
-1
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+11
-0
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+87
-31
ResultTempTable.java
h2/src/main/org/h2/result/ResultTempTable.java
+1
-1
LobStorageBackend.java
h2/src/main/org/h2/store/LobStorageBackend.java
+8
-8
FunctionTable.java
h2/src/main/org/h2/table/FunctionTable.java
+4
-3
没有找到文件。
h2/src/main/org/h2/jdbc/JdbcArray.java
浏览文件 @
764c9495
...
@@ -62,7 +62,7 @@ public class JdbcArray extends TraceObject implements Array {
...
@@ -62,7 +62,7 @@ public class JdbcArray extends TraceObject implements Array {
public
Object
getArray
(
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
public
Object
getArray
(
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
try
{
try
{
debugCode
(
"getArray("
+
quoteMap
(
map
)+
");"
);
debugCode
(
"getArray("
+
quoteMap
(
map
)+
");"
);
checkMap
(
map
);
JdbcConnection
.
checkMap
(
map
);
checkClosed
();
checkClosed
();
return
get
();
return
get
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -105,7 +105,7 @@ public class JdbcArray extends TraceObject implements Array {
...
@@ -105,7 +105,7 @@ public class JdbcArray extends TraceObject implements Array {
try
{
try
{
debugCode
(
"getArray("
+
index
+
", "
+
count
+
", "
+
quoteMap
(
map
)+
");"
);
debugCode
(
"getArray("
+
index
+
", "
+
count
+
", "
+
quoteMap
(
map
)+
");"
);
checkClosed
();
checkClosed
();
checkMap
(
map
);
JdbcConnection
.
checkMap
(
map
);
return
get
(
index
,
count
);
return
get
(
index
,
count
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -176,7 +176,7 @@ public class JdbcArray extends TraceObject implements Array {
...
@@ -176,7 +176,7 @@ public class JdbcArray extends TraceObject implements Array {
try
{
try
{
debugCode
(
"getResultSet("
+
quoteMap
(
map
)+
");"
);
debugCode
(
"getResultSet("
+
quoteMap
(
map
)+
");"
);
checkClosed
();
checkClosed
();
checkMap
(
map
);
JdbcConnection
.
checkMap
(
map
);
return
getResultSet
(
get
(),
0
);
return
getResultSet
(
get
(),
0
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -198,7 +198,7 @@ public class JdbcArray extends TraceObject implements Array {
...
@@ -198,7 +198,7 @@ public class JdbcArray extends TraceObject implements Array {
try
{
try
{
debugCode
(
"getResultSet("
+
index
+
", "
+
count
+
");"
);
debugCode
(
"getResultSet("
+
index
+
", "
+
count
+
");"
);
checkClosed
();
checkClosed
();
return
getResultSet
(
get
(
index
,
count
),
index
);
return
getResultSet
(
get
(
index
,
count
),
index
-
1
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
@@ -221,8 +221,8 @@ public class JdbcArray extends TraceObject implements Array {
...
@@ -221,8 +221,8 @@ public class JdbcArray extends TraceObject implements Array {
try
{
try
{
debugCode
(
"getResultSet("
+
index
+
", "
+
count
+
", "
+
quoteMap
(
map
)+
");"
);
debugCode
(
"getResultSet("
+
index
+
", "
+
count
+
", "
+
quoteMap
(
map
)+
");"
);
checkClosed
();
checkClosed
();
checkMap
(
map
);
JdbcConnection
.
checkMap
(
map
);
return
getResultSet
(
get
(
index
,
count
),
index
);
return
getResultSet
(
get
(
index
,
count
),
index
-
1
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
@@ -274,12 +274,6 @@ public class JdbcArray extends TraceObject implements Array {
...
@@ -274,12 +274,6 @@ public class JdbcArray extends TraceObject implements Array {
return
subset
;
return
subset
;
}
}
private
static
void
checkMap
(
Map
<
String
,
Class
<?>>
map
)
{
if
(
map
!=
null
&&
map
.
size
()
>
0
)
{
throw
DbException
.
getUnsupportedException
(
"map.size > 0"
);
}
}
/**
/**
* INTERNAL
* INTERNAL
*/
*/
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
764c9495
...
@@ -1807,7 +1807,13 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -1807,7 +1807,13 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
//*/
//*/
private
static
void
checkMap
(
Map
<
String
,
Class
<?>>
map
)
{
/**
* Check that the given type map is either null or empty.
*
* @param map the type map
* @throws DbException if the map is not empty
*/
static
void
checkMap
(
Map
<
String
,
Class
<?>>
map
)
{
if
(
map
!=
null
&&
map
.
size
()
>
0
)
{
if
(
map
!=
null
&&
map
.
size
()
>
0
)
{
throw
DbException
.
getUnsupportedException
(
"map.size > 0"
);
throw
DbException
.
getUnsupportedException
(
"map.size > 0"
);
}
}
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
浏览文件 @
764c9495
...
@@ -215,7 +215,6 @@ public class JdbcDataSource extends TraceObject
...
@@ -215,7 +215,6 @@ public class JdbcDataSource extends TraceObject
/**
/**
* Get the current URL.
* Get the current URL.
* <p>
* This method does the same as getURL, but this methods signature conforms
* This method does the same as getURL, but this methods signature conforms
* the JavaBean naming convention.
* the JavaBean naming convention.
*
*
...
@@ -228,7 +227,6 @@ public class JdbcDataSource extends TraceObject
...
@@ -228,7 +227,6 @@ public class JdbcDataSource extends TraceObject
/**
/**
* Set the current URL.
* Set the current URL.
* <p>
* This method does the same as setURL, but this methods signature conforms
* This method does the same as setURL, but this methods signature conforms
* the JavaBean naming convention.
* the JavaBean naming convention.
*
*
...
...
h2/src/main/org/h2/mvstore/Cursor.java
浏览文件 @
764c9495
h2/src/main/org/h2/mvstore/DataUtils.java
浏览文件 @
764c9495
h2/src/main/org/h2/mvstore/FileStore.java
浏览文件 @
764c9495
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
764c9495
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
764c9495
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
764c9495
...
@@ -39,8 +39,19 @@ import org.h2.value.ValueNull;
...
@@ -39,8 +39,19 @@ import org.h2.value.ValueNull;
*/
*/
public
class
MVPrimaryIndex
extends
BaseIndex
{
public
class
MVPrimaryIndex
extends
BaseIndex
{
/**
* The minimum long value.
*/
static
final
ValueLong
MIN
=
ValueLong
.
get
(
Long
.
MIN_VALUE
);
static
final
ValueLong
MIN
=
ValueLong
.
get
(
Long
.
MIN_VALUE
);
/**
* The maximum long value.
*/
static
final
ValueLong
MAX
=
ValueLong
.
get
(
Long
.
MAX_VALUE
);
static
final
ValueLong
MAX
=
ValueLong
.
get
(
Long
.
MAX_VALUE
);
/**
* The zero long value.
*/
static
final
ValueLong
ZERO
=
ValueLong
.
get
(
0
);
static
final
ValueLong
ZERO
=
ValueLong
.
get
(
0
);
private
final
MVTable
mvTable
;
private
final
MVTable
mvTable
;
...
...
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
764c9495
...
@@ -116,6 +116,13 @@ public class TransactionStore {
...
@@ -116,6 +116,13 @@ public class TransactionStore {
this
.
maxTransactionId
=
max
;
this
.
maxTransactionId
=
max
;
}
}
/**
* Combine the transaction id and the log id to an operation id.
*
* @param transactionId the transaction id
* @param logId the log id
* @return the operation id
*/
static
long
getOperationId
(
int
transactionId
,
long
logId
)
{
static
long
getOperationId
(
int
transactionId
,
long
logId
)
{
DataUtils
.
checkArgument
(
transactionId
>=
0
&&
transactionId
<
(
1
<<
24
),
DataUtils
.
checkArgument
(
transactionId
>=
0
&&
transactionId
<
(
1
<<
24
),
"Transaction id out of range: {0}"
,
transactionId
);
"Transaction id out of range: {0}"
,
transactionId
);
...
@@ -124,10 +131,22 @@ public class TransactionStore {
...
@@ -124,10 +131,22 @@ public class TransactionStore {
return
((
long
)
transactionId
<<
40
)
|
logId
;
return
((
long
)
transactionId
<<
40
)
|
logId
;
}
}
/**
* Get the transaction id for the given operation id.
*
* @param operationId the operation id
* @return the transaction id
*/
static
int
getTransactionId
(
long
operationId
)
{
static
int
getTransactionId
(
long
operationId
)
{
return
(
int
)
(
operationId
>>>
40
);
return
(
int
)
(
operationId
>>>
40
);
}
}
/**
* Get the log id for the given operation id.
*
* @param operationId the operation id
* @return the log id
*/
static
long
getLogId
(
long
operationId
)
{
static
long
getLogId
(
long
operationId
)
{
return
operationId
&
((
1L
<<
40
)
-
1
);
return
operationId
&
((
1L
<<
40
)
-
1
);
}
}
...
@@ -248,6 +267,13 @@ public class TransactionStore {
...
@@ -248,6 +267,13 @@ public class TransactionStore {
}
}
}
}
/**
* Remove the given map.
*
* @param <K> the key type
* @param <V> the value type
* @param map the map
*/
synchronized
<
K
,
V
>
void
removeMap
(
TransactionMap
<
K
,
V
>
map
)
{
synchronized
<
K
,
V
>
void
removeMap
(
TransactionMap
<
K
,
V
>
map
)
{
maps
.
remove
(
map
.
mapId
);
maps
.
remove
(
map
.
mapId
);
store
.
removeMap
(
map
.
map
);
store
.
removeMap
(
map
.
map
);
...
@@ -302,7 +328,17 @@ public class TransactionStore {
...
@@ -302,7 +328,17 @@ public class TransactionStore {
endTransaction
(
t
);
endTransaction
(
t
);
}
}
synchronized
<
K
>
MVMap
<
K
,
VersionedValue
>
openMap
(
String
name
,
DataType
keyType
,
DataType
valueType
)
{
/**
* Open the map with the given name.
*
* @param <K> the key type
* @param name the map name
* @param keyType the key type
* @param valueType the value type
* @return the map
*/
synchronized
<
K
>
MVMap
<
K
,
VersionedValue
>
openMap
(
String
name
,
DataType
keyType
,
DataType
valueType
)
{
if
(
keyType
==
null
)
{
if
(
keyType
==
null
)
{
keyType
=
new
ObjectDataType
();
keyType
=
new
ObjectDataType
();
}
}
...
@@ -328,6 +364,12 @@ public class TransactionStore {
...
@@ -328,6 +364,12 @@ public class TransactionStore {
return
map
;
return
map
;
}
}
/**
* Open the map with the given id.
*
* @param mapId the id
* @return the map
*/
synchronized
MVMap
<
Object
,
VersionedValue
>
openMap
(
int
mapId
)
{
synchronized
MVMap
<
Object
,
VersionedValue
>
openMap
(
int
mapId
)
{
MVMap
<
Object
,
VersionedValue
>
map
=
maps
.
get
(
mapId
);
MVMap
<
Object
,
VersionedValue
>
map
=
maps
.
get
(
mapId
);
if
(
map
!=
null
)
{
if
(
map
!=
null
)
{
...
@@ -1061,6 +1103,14 @@ public class TransactionStore {
...
@@ -1061,6 +1103,14 @@ public class TransactionStore {
return
getValue
(
key
,
maxLog
,
data
);
return
getValue
(
key
,
maxLog
,
data
);
}
}
/**
* Get the versioned value for the given key.
*
* @param key the key
* @param maxLog the maximum log id of the entry
* @param data the value stored in the main map
* @return the value
*/
VersionedValue
getValue
(
K
key
,
long
maxLog
,
VersionedValue
data
)
{
VersionedValue
getValue
(
K
key
,
long
maxLog
,
VersionedValue
data
)
{
while
(
true
)
{
while
(
true
)
{
if
(
data
==
null
)
{
if
(
data
==
null
)
{
...
@@ -1239,6 +1289,12 @@ public class TransactionStore {
...
@@ -1239,6 +1289,12 @@ public class TransactionStore {
return
wrapIterator
(
it
,
includeUncommitted
);
return
wrapIterator
(
it
,
includeUncommitted
);
}
}
/**
* Iterate over entries.
*
* @param from the first key to return
* @return the iterator
*/
public
Iterator
<
Entry
<
K
,
V
>>
entryIterator
(
K
from
)
{
public
Iterator
<
Entry
<
K
,
V
>>
entryIterator
(
K
from
)
{
final
Cursor
<
K
,
VersionedValue
>
cursor
=
map
.
cursor
(
from
);
final
Cursor
<
K
,
VersionedValue
>
cursor
=
map
.
cursor
(
from
);
return
new
Iterator
<
Entry
<
K
,
V
>>()
{
return
new
Iterator
<
Entry
<
K
,
V
>>()
{
...
...
h2/src/main/org/h2/result/ResultTempTable.java
浏览文件 @
764c9495
h2/src/main/org/h2/store/LobStorageBackend.java
浏览文件 @
764c9495
h2/src/main/org/h2/table/FunctionTable.java
浏览文件 @
764c9495
...
@@ -173,7 +173,8 @@ public class FunctionTable extends Table {
...
@@ -173,7 +173,8 @@ public class FunctionTable extends Table {
}
}
/**
/**
* Read the result from the function. This method buffers the result in a temporary file.
* Read the result from the function. This method buffers the result in a
* temporary file.
*
*
* @param session the session
* @param session the session
* @return the result
* @return the result
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论