TestTypeConversion.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:dev-courses 作者:
public void testArrayA() {

        try {
            String ddl0 = "DROP TABLE ARRAYTEST IF EXISTS";
            String ddl1 = "CREATE TABLE ARRAYTEST(A INTEGER ARRAY)";
            String dml1 = "INSERT INTO ARRAYTEST VALUES(ARRAY[0,0])";
            String dml2 = "INSERT INTO ARRAYTEST VALUES ?";

            statement.execute(ddl0);
            statement.execute(ddl1);
            statement.execute(dml1);

            PreparedStatement ps      = connection.prepareStatement(dml2);
            Object[]          objects = new Object[] {
                "1", 3, 9
            };
            Array array = connection.createArrayOf("INTEGER", objects);

            ps.setArray(1, array);
            ps.execute();
        } catch (SQLException e) {
            e.printStackTrace();
            fail("array failure");
        }
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号