Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
1ae95cff
提交
1ae95cff
authored
7 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add compatibility flag for generated keys
上级
d48c679b
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
30 行增加
和
10 行删除
+30
-10
Parser.java
h2/src/main/org/h2/command/Parser.java
+4
-0
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+2
-1
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+11
-0
JdbcPreparedStatement.java
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
+1
-1
JdbcStatement.java
h2/src/main/org/h2/jdbc/JdbcStatement.java
+12
-8
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
1ae95cff
...
...
@@ -5651,6 +5651,10 @@ public class Parser {
readIfEqualOrTo
();
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"SCOPE_GENERATED_KEYS"
))
{
readIfEqualOrTo
();
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"SCHEMA"
))
{
readIfEqualOrTo
();
Set
command
=
new
Set
(
session
,
SetTypes
.
SCHEMA
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
1ae95cff
...
...
@@ -96,7 +96,8 @@ public class ConnectionInfo implements Cloneable {
"CREATE"
,
"CACHE_TYPE"
,
"FILE_LOCK"
,
"IGNORE_UNKNOWN_SETTINGS"
,
"IFEXISTS"
,
"INIT"
,
"PASSWORD"
,
"RECOVER"
,
"RECOVER_TEST"
,
"USER"
,
"AUTO_SERVER"
,
"AUTO_SERVER_PORT"
,
"NO_UPGRADE"
,
"AUTO_RECONNECT"
,
"OPEN_NEW"
,
"PAGE_SIZE"
,
"PASSWORD_HASH"
,
"JMX"
};
"AUTO_RECONNECT"
,
"OPEN_NEW"
,
"PAGE_SIZE"
,
"PASSWORD_HASH"
,
"JMX"
,
"SCOPE_GENERATED_KEYS"
};
HashSet
<
String
>
set
=
new
HashSet
<>(
list
.
size
()
+
connectionTime
.
length
);
set
.
addAll
(
list
);
for
(
String
key
:
connectionTime
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
1ae95cff
...
...
@@ -94,6 +94,7 @@ public class JdbcConnection extends TraceObject
private
Map
<
String
,
String
>
clientInfo
;
private
String
mode
;
private
final
boolean
scopeGeneratedKeys
;
/**
* INTERNAL
...
...
@@ -132,6 +133,7 @@ public class JdbcConnection extends TraceObject
+
", \"\");"
);
}
this
.
url
=
ci
.
getURL
();
scopeGeneratedKeys
=
ci
.
getProperty
(
"SCOPE_GENERATED_KEYS"
,
false
);
closeOld
();
watcher
=
CloseWatcher
.
register
(
this
,
session
,
keepOpenStackTrace
);
}
catch
(
Exception
e
)
{
...
...
@@ -156,6 +158,7 @@ public class JdbcConnection extends TraceObject
this
.
getQueryTimeout
=
clone
.
getQueryTimeout
;
this
.
getReadOnly
=
clone
.
getReadOnly
;
this
.
rollback
=
clone
.
rollback
;
this
.
scopeGeneratedKeys
=
clone
.
scopeGeneratedKeys
;
this
.
watcher
=
null
;
if
(
clone
.
clientInfo
!=
null
)
{
this
.
clientInfo
=
new
HashMap
<>(
clone
.
clientInfo
);
...
...
@@ -172,6 +175,7 @@ public class JdbcConnection extends TraceObject
setTrace
(
trace
,
TraceObject
.
CONNECTION
,
id
);
this
.
user
=
user
;
this
.
url
=
url
;
this
.
scopeGeneratedKeys
=
false
;
this
.
watcher
=
null
;
}
...
...
@@ -1578,6 +1582,13 @@ public class JdbcConnection extends TraceObject
executingStatement
=
stat
;
}
/**
* INTERNAL
*/
boolean
scopeGeneratedKeys
()
{
return
scopeGeneratedKeys
;
}
/**
* INTERNAL
*/
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
浏览文件 @
1ae95cff
...
...
@@ -70,7 +70,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements
int
resultSetType
,
int
resultSetConcurrency
,
boolean
closeWithResultSet
,
Object
generatedKeysRequest
)
{
super
(
conn
,
id
,
resultSetType
,
resultSetConcurrency
,
closeWithResultSet
);
this
.
generatedKeysRequest
=
generatedKeysRequest
;
this
.
generatedKeysRequest
=
conn
.
scopeGeneratedKeys
()
?
false
:
generatedKeysRequest
;
setTrace
(
session
.
getTrace
(),
TraceObject
.
PREPARED_STATEMENT
,
id
);
this
.
sqlStatement
=
sql
;
command
=
conn
.
prepareCommand
(
sql
,
fetchSize
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcStatement.java
浏览文件 @
1ae95cff
...
...
@@ -166,7 +166,8 @@ public class JdbcStatement extends TraceObject implements Statement, JdbcStateme
synchronized
(
session
)
{
setExecutingStatement
(
command
);
try
{
ResultWithGeneratedKeys
result
=
command
.
executeUpdate
(
generatedKeysRequest
);
ResultWithGeneratedKeys
result
=
command
.
executeUpdate
(
conn
.
scopeGeneratedKeys
()
?
false
:
generatedKeysRequest
);
updateCount
=
result
.
getUpdateCount
();
ResultInterface
gk
=
result
.
getGeneratedKeys
();
if
(
gk
!=
null
)
{
...
...
@@ -229,7 +230,8 @@ public class JdbcStatement extends TraceObject implements Statement, JdbcStateme
closedByResultSet
,
scrollable
,
updatable
);
}
else
{
returnsResultSet
=
false
;
ResultWithGeneratedKeys
result
=
command
.
executeUpdate
(
generatedKeysRequest
);
ResultWithGeneratedKeys
result
=
command
.
executeUpdate
(
conn
.
scopeGeneratedKeys
()
?
false
:
generatedKeysRequest
);
updateCount
=
result
.
getUpdateCount
();
ResultInterface
gk
=
result
.
getGeneratedKeys
();
if
(
gk
!=
null
)
{
...
...
@@ -832,13 +834,15 @@ public class JdbcStatement extends TraceObject implements Statement, JdbcStateme
debugCodeAssign
(
"ResultSet"
,
TraceObject
.
RESULT_SET
,
id
,
"getGeneratedKeys()"
);
}
checkClosed
();
if
(
generatedKeys
!=
null
)
{
return
generatedKeys
;
}
if
(
session
.
isSupportsGeneratedKeys
())
{
return
new
SimpleResultSet
();
if
(!
conn
.
scopeGeneratedKeys
())
{
if
(
generatedKeys
!=
null
)
{
return
generatedKeys
;
}
if
(
session
.
isSupportsGeneratedKeys
())
{
return
new
SimpleResultSet
();
}
}
//
O
ld server, so use SCOPE_IDENTITY()
//
Compatibility mode or an o
ld server, so use SCOPE_IDENTITY()
return
conn
.
getGeneratedKeys
(
this
,
id
);
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论