Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f29a10df
提交
f29a10df
authored
7 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Provide actual information in javadoc of JdbcStatement.getGeneratedKeys()
上级
cdfa8ce1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
42 行增加
和
5 行删除
+42
-5
JdbcStatement.java
h2/src/main/org/h2/jdbc/JdbcStatement.java
+42
-5
没有找到文件。
h2/src/main/org/h2/jdbc/JdbcStatement.java
浏览文件 @
f29a10df
...
@@ -818,12 +818,49 @@ public class JdbcStatement extends TraceObject implements Statement, JdbcStateme
...
@@ -818,12 +818,49 @@ public class JdbcStatement extends TraceObject implements Statement, JdbcStateme
}
}
/**
/**
* Return a result set that contains the last generated auto-increment key
* Return a result set with generated keys from the latest executed command or
* for this connection, if there was one. If no key was generated by the
* an empty result set if keys were not generated or were not requested with
* last modification statement, then an empty result set is returned.
* {@link Statement#RETURN_GENERATED_KEYS}, column indexes, or column names.
* The returned result set only contains the data for the very last row.
* <p>
* Generated keys are only returned from inserted rows from {@code INSERT},
* {@code MERGE INTO}, and {@code MERGE INTO ... USING} commands. Generated keys
* are not returned if exact values of generated columns were specified
* explicitly in SQL command. All columns with inserted generated values are
* included in the result if command was executed with
* {@link Statement#RETURN_GENERATED_KEYS} parameter.
* </p>
* <p>
* If SQL command inserts multiple rows with generated keys each such inserted
* row is returned. Batch methods are also supported. When multiple rows are
* returned each row contains only generated values for this row. It's possible
* to insert several rows with generated values in different columns with some
* specific commands, in this special case the returned result set contains all
* used columns, but each row will contain only generated values, columns that
* were not generated for this row will contain {@code null} values.
* </p>
* <p>
* H2 treats inserted value as generated in the following cases:
* </p>
* <ul>
* <li>Columns with sequences including {@code IDENTITY} columns and columns
* with {@code AUTO_INCREMENT} if value was generated automatically (not
* specified in command).</li>
* <li>Columns with other default values that are not evaluated into constant
* expressions (like {@code DEFAULT RANDOM_UUID()}) also only if default value
* was inserted.</li>
* <li>Columns that were set by triggers.</li>
* <li>Columns with values specified in command with invocation of some sequence
* (like {@code INSERT INTO ... VALUES (NEXT VALUE FOR ...)}).</li>
* </ul>
* <p>
* Exact required columns for the returning result set may be specified on
* execution of command with names or indexes of columns to limit output or
* reorder columns in result set. Specifying of some column has no effect on
* treatment of inserted values as generated or not. If some value is not
* determined to be generated it will not be returned even on explicit request.
* </p>
*
*
* @return the
result set with one row and one column containing the key
* @return the
possibly empty result set with generated keys
* @throws SQLException if this object is closed
* @throws SQLException if this object is closed
*/
*/
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论