package org.postgresql.jdbc3;


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

import org.postgresql.jdbc3.CacheConnection.PStmtKey;

public class CacheablePreparedStatement extends Jdbc3PreparedStatement implements PreparedStatement
{
    StatementPool pool;
    PStmtKey key;
    private boolean isClosed=false;
    
    public CacheablePreparedStatement(StatementPool pool,PStmtKey key,  CacheConnection connection, String sql, int rsType, int rsConcurrency, int rsHoldability) throws SQLException
    {
        super(connection, sql, false, rsType, rsConcurrency, rsHoldability);
        this.pool = pool;
        this.key = key;
    }
    
    public CacheablePreparedStatement(StatementPool pool,PStmtKey key,  CacheConnection connection, String sql ) throws SQLException
    {
        super(connection, sql, false, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT);
        this.pool = pool;
        this.key = key;
    }
    
    public void setClosed( boolean closed )
    {
        this.isClosed = closed;
    }
    public void close()
    {
        pool.returnStatement(this);
        isClosed=true;
    }
   
    
}
