Package org.apache.derby.client.am.stmtcache

Examples of org.apache.derby.client.am.stmtcache.StatementKey


    public synchronized CallableStatement prepareCall(String sql,
                                                      int resultSetType,
                                                      int resultSetConcurrency,
                                                      int resultSetHoldability)
            throws SQLException {
        StatementKey stmtKey = StatementKeyFactory.newCallable(
                sql, physicalConnection.getCurrentSchemaName(), resultSetType,
                resultSetConcurrency, resultSetHoldability);
        CallableStatement cs = (CallableStatement)cache.getCached(stmtKey);
        if (cs == null) {
            cs = physicalConnection.prepareCall(sql, resultSetType, resultSetConcurrency,
View Full Code Here


    public void testBasicInsertion()
            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));
    }
View Full Code Here

    public void testBasicDuplicateKeyInsertion()
            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

        String sql = "values 7";
        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.
        assertNull(cache.getCached(callKey));
View Full Code Here

    /**
     * @see java.sql.Connection#prepareStatement(String)
     */
    public synchronized PreparedStatement prepareStatement(String sql)
            throws SQLException {
        StatementKey stmtKey = StatementKeyFactory.newPrepared(
                sql, physicalConnection.getCurrentSchemaName(),
                physicalConnection.holdability());
        PreparedStatement ps = cache.getCached(stmtKey);
        if (ps == null) {
            ps = physicalConnection.prepareStatement(sql);
View Full Code Here

    public synchronized PreparedStatement prepareStatement(
                                                String sql,
                                                int resultSetType,
                                                int resultSetConcurrency)
            throws SQLException {
        StatementKey stmtKey = StatementKeyFactory.newPrepared(
                sql, physicalConnection.getCurrentSchemaName(), resultSetType,
                resultSetConcurrency, physicalConnection.holdability());
        PreparedStatement ps = cache.getCached(stmtKey);
        if (ps == null) {
            ps = physicalConnection.prepareStatement(
View Full Code Here

                                                String sql,
                                                int resultSetType,
                                                int resultSetConcurrency,
                                                int resultSetHoldability)
            throws SQLException {
        StatementKey stmtKey = StatementKeyFactory.newPrepared(
                sql, physicalConnection.getCurrentSchemaName(), resultSetType,
                resultSetConcurrency, resultSetHoldability);

        PreparedStatement ps = cache.getCached(stmtKey);
        if (ps == null) {
View Full Code Here

     */
    public synchronized PreparedStatement prepareStatement(
                                                String sql,
                                                int autoGeneratedKeys)
            throws SQLException {
        StatementKey stmtKey = StatementKeyFactory.newPrepared(
                sql, physicalConnection.getCurrentSchemaName(),
                physicalConnection.getHoldability(), autoGeneratedKeys);
        PreparedStatement ps = cache.getCached(stmtKey);
        if (ps == null) {
            ps = physicalConnection.prepareStatement(sql, autoGeneratedKeys);
View Full Code Here

    /**
     * @see java.sql.Connection#prepareCall(String)
     */
    public synchronized CallableStatement prepareCall(String sql)
            throws SQLException {
        StatementKey stmtKey = StatementKeyFactory.newCallable(
                sql, physicalConnection.getCurrentSchemaName(),
                physicalConnection.holdability());
        CallableStatement cs = (CallableStatement)cache.getCached(stmtKey);
        if (cs == null) {
            cs = physicalConnection.prepareCall(sql);
View Full Code Here

     */
    public synchronized CallableStatement prepareCall(String sql,
                                                      int resultSetType,
                                                      int resultSetConcurrency)
            throws SQLException {
        StatementKey stmtKey = StatementKeyFactory.newCallable(
                sql, physicalConnection.getCurrentSchemaName(), resultSetType,
                resultSetConcurrency, physicalConnection.holdability());
        CallableStatement cs = (CallableStatement)cache.getCached(stmtKey);
        if (cs == null) {
            cs = physicalConnection.prepareCall(sql, resultSetType, resultSetConcurrency);
View Full Code Here

TOP

Related Classes of org.apache.derby.client.am.stmtcache.StatementKey

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.