Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8faf50a8
提交
8faf50a8
authored
10月 03, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New auto-reconnect feature
上级
a133bc7b
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
26 行增加
和
20 行删除
+26
-20
CommandRemote.java
h2/src/main/org/h2/command/CommandRemote.java
+22
-20
Parser.java
h2/src/main/org/h2/command/Parser.java
+4
-0
没有找到文件。
h2/src/main/org/h2/command/CommandRemote.java
浏览文件 @
8faf50a8
...
...
@@ -38,6 +38,7 @@ public class CommandRemote implements CommandInterface {
private
boolean
isQuery
;
private
boolean
readonly
;
private
int
paramCount
;
private
int
created
;
public
CommandRemote
(
SessionRemote
session
,
ObjectArray
transferList
,
String
sql
,
int
fetchSize
)
throws
SQLException
{
this
.
transferList
=
transferList
;
...
...
@@ -49,6 +50,7 @@ public class CommandRemote implements CommandInterface {
// need to close the object
this
.
session
=
session
;
this
.
fetchSize
=
fetchSize
;
created
=
session
.
getLastReconnect
();
}
private
void
prepare
(
SessionRemote
s
,
boolean
createParams
)
throws
SQLException
{
...
...
@@ -82,7 +84,7 @@ public class CommandRemote implements CommandInterface {
}
}
}
catch
(
IOException
e
)
{
s
.
removeServer
(
i
--);
s
.
removeServer
(
e
,
i
--);
}
}
}
...
...
@@ -95,19 +97,27 @@ public class CommandRemote implements CommandInterface {
return
parameters
;
}
public
ResultInterface
getMetaData
()
throws
SQLException
{
synchronized
(
session
)
{
session
.
checkClosed
();
if
(!
isQuery
)
{
return
null
;
private
void
prepareIfRequired
()
throws
SQLException
{
if
(
session
.
getLastReconnect
()
!=
created
)
{
// in this case we need to prepare again in every case
id
=
Integer
.
MIN_VALUE
;
}
session
.
checkClosed
();
if
(
id
<=
session
.
getCurrentId
()
-
SysProperties
.
SERVER_CACHED_OBJECTS
)
{
// object is too old - we need to prepare again
prepare
(
session
,
false
);
}
}
public
ResultInterface
getMetaData
()
throws
SQLException
{
synchronized
(
session
)
{
if
(!
isQuery
)
{
return
null
;
}
int
objectId
=
session
.
getNextId
();
ResultRemote
result
=
null
;
for
(
int
i
=
0
;
i
<
transferList
.
size
();
i
++)
{
prepareIfRequired
();
Transfer
transfer
=
(
Transfer
)
transferList
.
get
(
i
);
try
{
// TODO cluster: support load balance with values for each server / auto detect
...
...
@@ -118,7 +128,7 @@ public class CommandRemote implements CommandInterface {
result
=
new
ResultRemote
(
session
,
transfer
,
objectId
,
columnCount
,
Integer
.
MAX_VALUE
);
break
;
}
catch
(
IOException
e
)
{
session
.
removeServer
(
i
--);
session
.
removeServer
(
e
,
i
--);
}
}
session
.
autoCommitIfCluster
();
...
...
@@ -129,14 +139,10 @@ public class CommandRemote implements CommandInterface {
public
ResultInterface
executeQuery
(
int
maxRows
,
boolean
scrollable
)
throws
SQLException
{
checkParameters
();
synchronized
(
session
)
{
session
.
checkClosed
();
if
(
id
<=
session
.
getCurrentId
()
-
SysProperties
.
SERVER_CACHED_OBJECTS
)
{
// object is too old - we need to prepare again
prepare
(
session
,
false
);
}
int
objectId
=
session
.
getNextId
();
ResultRemote
result
=
null
;
for
(
int
i
=
0
;
i
<
transferList
.
size
();
i
++)
{
prepareIfRequired
();
Transfer
transfer
=
(
Transfer
)
transferList
.
get
(
i
);
try
{
// TODO cluster: support load balance with values for each
...
...
@@ -163,7 +169,7 @@ public class CommandRemote implements CommandInterface {
break
;
}
}
catch
(
IOException
e
)
{
session
.
removeServer
(
i
--);
session
.
removeServer
(
e
,
i
--);
}
}
session
.
autoCommitIfCluster
();
...
...
@@ -174,16 +180,12 @@ public class CommandRemote implements CommandInterface {
public
int
executeUpdate
()
throws
SQLException
{
checkParameters
();
synchronized
(
session
)
{
session
.
checkClosed
();
if
(
id
<=
session
.
getCurrentId
()
-
SysProperties
.
SERVER_CACHED_OBJECTS
)
{
// object is too old - we need to prepare again
prepare
(
session
,
false
);
}
int
updateCount
=
0
;
boolean
autoCommit
=
false
;
for
(
int
i
=
0
;
i
<
transferList
.
size
();
i
++)
{
try
{
prepareIfRequired
();
Transfer
transfer
=
(
Transfer
)
transferList
.
get
(
i
);
try
{
session
.
traceOperation
(
"COMMAND_EXECUTE_UPDATE"
,
id
);
transfer
.
writeInt
(
SessionRemote
.
COMMAND_EXECUTE_UPDATE
).
writeInt
(
id
);
sendParameters
(
transfer
);
...
...
@@ -191,7 +193,7 @@ public class CommandRemote implements CommandInterface {
updateCount
=
transfer
.
readInt
();
autoCommit
=
transfer
.
readBoolean
();
}
catch
(
IOException
e
)
{
session
.
removeServer
(
i
--);
session
.
removeServer
(
e
,
i
--);
}
}
session
.
setAutoCommit
(
autoCommit
);
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
8faf50a8
...
...
@@ -4039,6 +4039,10 @@ public class Parser {
readIfEqualOrTo
();
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"AUTO_RECONNECT"
))
{
readIfEqualOrTo
();
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"ASSERT"
))
{
readIfEqualOrTo
();
read
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论