36 Star 100 Fork 103

openGauss / openGauss-connector-jdbc

 / 详情

驱动支持批量插入时候处理returnning 语句

已完成
需求
创建于  
2022-03-16 10:25

【需求背景】
批量插入且仅插入一条数据时候,驱动返回 Received resultset tuples, but no field structure for them 错误.
【需求描述】
preparestatement中设置 RETURN_GENERATED_KEYS 以后 批量插入且仅插入一条数据时 协议处理流程不正确
如下是测试代码

   @Test
    public void testBatchMode() throws SQLException {
        String insertSql = "insert into test_batch (col1, col2) values (?,?)";
        PreparedStatement preparedStatement = postgresConnection.prepareStatement(insertSql, Statement.RETURN_GENERATED_KEYS);
        preparedStatement.setInt(1,1);
        preparedStatement.setString(2,"a");
        preparedStatement.addBatch();
        preparedStatement.executeBatch();
    }

以下是表结构

create table test_batch
(
    id   serial,
    col1 integer,
    col2 varchar(32)
)

【其他说明】

评论 (6)

萨西摩尔 创建了需求

Hey @萨西摩尔, Welcome to openGauss Community.
All of the projects in openGauss Community are maintained by @opengauss-bot.
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at Here to find the details.

/sig connectors

opengauss-bot 添加了
 
sig/connectors
标签

Hi @萨西摩尔,
if you want to get quick review about your issue, please contact the owner in first: @Pike ,
and then any of the maintainers: @Pike
and then any of the committers: @travelliu , @aaronwell , @Loong , @Kamus , @vimiix , @汪伟
if you have any question, please contact the SIG: Connectors.

验收版本:
gsql:gaussdb (openGauss 5.0.2 build 0db5202f) compiled at 2024-04-17 15:28:50 commit 0 last mr
jdbc:compiled at 2024-04-17-15:42:00 build fd771c9
验收结论:验收通过
插入单行
输入图片说明
输入图片说明

插入多行
输入图片说明
输入图片说明

验收版本:
gsql:openGauss 5.0.2 build 0db5202f) compiled at 2024-04-17 15:39:29 commit 0 last mr
psycopg2:2.9 (dt dec pq3 ext)
验收结论:验收通过
验收过程:
插入单行:
输入图片说明
输入图片说明

插入多行:
输入图片说明
输入图片说明

验收版本:
gsql:(openGauss 5.0.2 build db63ed87) compiled at 2024-04-23 21:36:27 commit 0 last mr on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit
odbc:5.0.2
验收结论:验收通过

输入图片说明
输入图片说明
输入图片说明

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(5)
5622128 opengauss bot 1581905080 8772917 ningyali 1691032793
Java
1
https://gitee.com/opengauss/openGauss-connector-jdbc.git
git@gitee.com:opengauss/openGauss-connector-jdbc.git
opengauss
openGauss-connector-jdbc
openGauss-connector-jdbc

搜索帮助