/*-----------------------------------------------------------------------------
 *
 * Enhydra JdbcS
 * The Initial Developer of the Original Code is Lutris Technologies Inc.
 * Portions created by Lutris are Copyright 1997-2000 Lutris Technologies Inc.
 * All Rights Reserved.
 *
 * The contents of this file are subject to the Enhydra Public License
 * Version 1.1 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 * www.enhydra.org/license/epl.html
 *
 * Software distributed under the License is distributed on an "ASIS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * -----------------------------------------------------------------------------
 * $Id$
 * -----------------------------------------------------------------------------
 */

package org.enhydra.jdbc.standard;

import org.enhydra.jdbc.util.LRUCache;

import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * Implementation of LRUCache to handle prepared statements
 * TODO: Override put to check type
 */
public class PreparedStatementCache extends LRUCache {
    /**
     * Constructor
     */
    public PreparedStatementCache(int maxSize) {
	super(maxSize);
    }

    /**
     * Overriden to close the statement
     */
    protected void cleanupObject(Object obj) {
	try {
	    ((PreparedStatement)obj).close();
	} catch (SQLException e) {} //ignore
    }
}

