Examples of cacheStatement()


Examples of org.apache.derby.client.am.stmtcache.JDBCStatementCache.cacheStatement()

            throws SQLException {
        String sql = "values 1";
        JDBCStatementCache cache = new JDBCStatementCache(10);
        PreparedStatement ps = prepareStatement(sql);
        StatementKey key = StatementKeyFactory.newPrepared(sql, "app", 1);
        assertTrue(cache.cacheStatement(key, ps));
        assertEquals(ps, cache.getCached(key));
    }

    /**
     * Test insertion of a duplicate key.
View Full Code Here

Examples of org.apache.derby.client.am.stmtcache.JDBCStatementCache.cacheStatement()

            throws SQLException {
        String sql = "values 1";
        JDBCStatementCache cache = new JDBCStatementCache(10);
        PreparedStatement ps = prepareStatement(sql);
        StatementKey key = StatementKeyFactory.newPrepared(sql, "app", 1);
        assertTrue(cache.cacheStatement(key, ps));
        // Duplicates shall not be inserted.
        assertFalse(cache.cacheStatement(key, ps));
        assertEquals(ps, cache.getCached(key));
    }
View Full Code Here

Examples of org.apache.derby.client.am.stmtcache.JDBCStatementCache.cacheStatement()

        JDBCStatementCache cache = new JDBCStatementCache(10);
        PreparedStatement ps = prepareStatement(sql);
        StatementKey key = StatementKeyFactory.newPrepared(sql, "app", 1);
        assertTrue(cache.cacheStatement(key, ps));
        // Duplicates shall not be inserted.
        assertFalse(cache.cacheStatement(key, ps));
        assertEquals(ps, cache.getCached(key));
    }

    /**
     * Make sure requesting a cached callable statement does not return a
View Full Code Here

Examples of org.apache.derby.client.am.stmtcache.JDBCStatementCache.cacheStatement()

        String schema = "MYAPP";
        int rsh = 1;
        JDBCStatementCache cache = new JDBCStatementCache(10);
        PreparedStatement ps = prepareStatement(sql);
        StatementKey key = StatementKeyFactory.newPrepared(sql, schema, rsh);
        assertTrue(cache.cacheStatement(key, ps));
        StatementKey callKey =
                StatementKeyFactory.newCallable(sql, schema, rsh);
        assertNotSame(ps, cache.getCached(callKey));
        CallableStatement cs = prepareCall(sql);
        // No entry should exists yet.
View Full Code Here

Examples of org.apache.derby.client.am.stmtcache.JDBCStatementCache.cacheStatement()

        assertNotSame(ps, cache.getCached(callKey));
        CallableStatement cs = prepareCall(sql);
        // No entry should exists yet.
        assertNull(cache.getCached(callKey));
        // New callable statements should be inserted.
        assertTrue(cache.cacheStatement(callKey, cs));
        // Make sure we get the same object back.
        assertSame(cs, cache.getCached(callKey));
        // Make sure we don't get a callable when we ask for a prepared.
        assertNotSame(cs, cache.getCached(key));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.