36 Star 101 Fork 107

openGauss / openGauss-connector-jdbc

 / 详情

【兼容性】jdbc对openGauss游标类型的返回Type值与Oracle不一致,需要兼容

已验收
缺陷
创建于  
2023-11-14 11:26

【标题描述】:
【兼容性】jdbc对openGauss游标类型的返回Type值与Oracle不一致,OracleTypes.CURSOR = -10,需要兼容下与Oracle保持一致。
【报错信息】
输入图片说明

具体测试用例:

    // 执行用例前,需要先创建 test_cursor 表,并插入一条测试数据,具体代码如下:
    TestUtil.createTable(con, "test_cursor", "c1 int, c2 float, c3 float, c4 text, c5 bigint");
    String insertSQL = TestUtil.insertSQL("test_cursor", "1,2.2,3.3,'test',5");
    TestUtil.execute(insertSQL, con);

    @Test
    public void testSpOutCursor() throws SQLException {
        Statement stmt = null;
        CallableStatement cmt = null;
        try {
            con.setAutoCommit(false);
            // create sp
            String procedureSql = "CREATE OR REPLACE FUNCTION test_refcursor () RETURNS refcursor AS \n" +
                    "\t'declare v_resset refcursor; begin open v_resset for select c1,c2 from test_cursor;\n" +
                    "\treturn v_resset; end;' \n" +
                    "LANGUAGE plpgsql;";
            stmt = con.createStatement();
            stmt.execute(procedureSql);

            // execute sp
            String commandText = "{? = call test_refcursor()}";
            cmt = con.prepareCall(commandText);
            int OracleTypes_CURSOR = -10;
            cmt.registerOutParameter(1, OracleTypes_CURSOR);
            cmt.execute();

            // get result set
            ResultSet rs = (ResultSet) cmt.getObject(1);
            rs.next();
            assertEquals(1, rs.getInt(1));
            assertEquals(2.2d, rs.getDouble(2), 0.0001);
            con.setAutoCommit(true);
        } finally {
            TestUtil.closeQuietly(stmt);
            TestUtil.closeQuietly(cmt);
        }
    }

评论 (4)

Sam皮皮 创建了缺陷

Hey @Sam皮皮, 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.

Hi @Sam皮皮,
if you want to get quick review about your issue, please contact the owner in first: @周斌 ,
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.

opengauss_bot 添加了
 
sig/connectors
标签
jiexiao1413 负责人设置为周斌
周斌 计划开始日期设置为2023-11-18
周斌 计划截止日期设置为2023-11-18
Sam皮皮 修改了描述
travelliu 任务状态待办的 修改为已确认
travelliu 任务状态已确认 修改为修复中
Sam皮皮 通过opengauss/openGauss-connector-jdbc Pull Request !176任务状态修复中 修改为已完成
周斌 任务状态已完成 修改为待回归
周斌 任务状态待回归 修改为测试中
Sam皮皮 修改了描述

@Sam皮皮 麻烦上传java脚本至附件,包括其他两个问题单,谢谢

wan005 添加协作者ningyali

验收版本:compiled at 2024-02-29-10:03:35 build fb8238f
验收结论:验收通过
输入图片说明
输入图片说明
输入图片说明
输入图片说明

ningyali 任务状态测试中 修改为已验收

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(4)
13084139 opengauss bot 1686829535 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

搜索帮助