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

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


        assertTrue(key1.equals(key3));
    }

    public void testEqualityDefaultNoAutoGenKey() {
        int holdability = ResultSet.HOLD_CURSORS_OVER_COMMIT;
        StatementKey basicKey = StatementKeyFactory.newPrepared(
                "values 2", "APP", holdability);
        StatementKey simplifiedKey = StatementKeyFactory.newPrepared(
                "values 2", "APP", holdability, Statement.NO_GENERATED_KEYS);
        assertTrue(basicKey.equals(simplifiedKey));
        assertTrue(simplifiedKey.equals(basicKey));
    }
View Full Code Here


        assertTrue(simplifiedKey.equals(basicKey));
    }

    public void testEqualityNoAutoVsAutoGenKey() {
        int holdability = ResultSet.HOLD_CURSORS_OVER_COMMIT;
        StatementKey basicKey = StatementKeyFactory.newPrepared(
                "values 2", "APP", holdability);
        StatementKey autoKey = StatementKeyFactory.newPrepared(
                "values 2", "APP", holdability, Statement.RETURN_GENERATED_KEYS);
        assertFalse(basicKey.equals(autoKey));
        assertFalse(autoKey.equals(basicKey));
    }
View Full Code Here

            StatementKeyFactory.newPrepared(sql, schema, rsh, auto),
            StatementKeyFactory.newPrepared(sql, schema, rst, rsc, rsh),
            StatementKeyFactory.newCallable(sql, schema, rsh),
            StatementKeyFactory.newCallable(sql, schema, rst, rsc, rsh)};
        for (int outer=0; outer < keys.length; outer++) {
            StatementKey current = keys[outer];
            for (int inner=0; inner < keys.length; inner++) {
                if (outer != inner) {
                    if (current.equals(keys[inner])) {
                        fail("[" + current.toString() + "] should not equal [" +
                                keys[inner].toString() + "]");
                    }
                } else {
                    // Should equal itself.
                    assertTrue(current.equals(keys[inner]));
                }
            }
        }
    }
View Full Code Here

    public void testCallableVsPrepared() {
        String sql = "select colA, colB from mytable";
        String schema = "SOMEAPP";
        int holdability = ResultSet.HOLD_CURSORS_OVER_COMMIT;
        StatementKey callable =
                StatementKeyFactory.newCallable(sql, schema, holdability);
        StatementKey prepared =
                StatementKeyFactory.newPrepared(sql, schema, holdability);
        assertFalse(callable.equals(prepared));
        assertFalse(prepared.equals(callable));
    }
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.