【标题描述】:
【兼容性】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);
}
}
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.
验收版本:compiled at 2024-02-29-10:03:35 build fb8238f
验收结论:验收通过
登录 后才可以发表评论