Package com.alibaba.druid.mock

Examples of com.alibaba.druid.mock.MockPreparedStatement


    }

    public void test_prepareStatement() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        MockPreparedStatement raw = null;
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", ResultSet.TYPE_FORWARD_ONLY,
                                                           ResultSet.CONCUR_READ_ONLY);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
View Full Code Here


    }

    public void test_prepareStatement_1() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        MockPreparedStatement raw = null;
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", ResultSet.TYPE_FORWARD_ONLY,
                                                           ResultSet.CONCUR_READ_ONLY,
                                                           ResultSet.HOLD_CURSORS_OVER_COMMIT);
            raw = stmt.unwrap(MockPreparedStatement.class);
View Full Code Here

    }

    public void test_prepareStatement_2() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        MockPreparedStatement raw = null;
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", new int[0]);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
        }
View Full Code Here

    }

    public void test_prepareStatement_3() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        MockPreparedStatement raw = null;
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", new String[0]);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
        }
View Full Code Here

    }

    public void test_prepareStatement_4() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        MockPreparedStatement raw = null;
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", 0);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
        }
View Full Code Here

    }

    public void test_prepCall() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        MockPreparedStatement raw = null;
        {
            PreparedStatement stmt = conn.prepareCall("SELECT 1", ResultSet.TYPE_FORWARD_ONLY,
                                                      ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
View Full Code Here

    }

    public void test_prepCall_1() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        MockPreparedStatement raw = null;
        {
            PreparedStatement stmt = conn.prepareCall("SELECT 1", ResultSet.TYPE_FORWARD_ONLY,
                                                      ResultSet.CONCUR_READ_ONLY);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
View Full Code Here

    final DataTruncation    exception = new java.sql.DataTruncation(0, true, true, 0, 0);

    protected void setUp() throws Exception {

        final MockPreparedStatement mockStatement = new MockPreparedStatement(null, null) {

            public boolean execute() throws SQLException {
                throw exception;
            }
        };
View Full Code Here

        DruidDataSource                dataSource = new DruidDataSource();
        MockConnection mockConn = new MockConnection();
        DruidConnectionHolder connHolder = new DruidConnectionHolder(dataSource, mockConn);
        DruidPooledConnection conn = new DruidPooledConnection(connHolder);

        raw = new MockPreparedStatement(null, null);
        stmt = new DruidPooledPreparedStatement(conn, new PreparedStatementHolder(new PreparedStatementKey("", null,
                                                                                                           null, 0, 0,
                                                                                                           0), raw)) {

            protected SQLException checkException(Throwable error) throws SQLException {
View Full Code Here

        Connection conn = dataSource.getConnection();

        String sql = "select 1";
        Statement stmt = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

        MockPreparedStatement mockStmt = stmt.unwrap(MockPreparedStatement.class);

        Assert.assertEquals(ResultSet.TYPE_SCROLL_SENSITIVE, mockStmt.getResultSetType());
        Assert.assertEquals(ResultSet.CONCUR_UPDATABLE, mockStmt.getResultSetConcurrency());

        stmt.close();

        conn.close();
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.mock.MockPreparedStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.