/*
 * JBoss, Home of Professional Open Source
 * Copyright 2005, JBoss Inc., and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.test.jca.jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;


/**
 * TestStatement.java
 *
 *
 * Created: Sat Apr 20 14:29:19 2002
 *
 * @author <a href="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
 * @version
 */

public class TestStatement
   implements Statement
{

   private final TestDriver driver;

   int maxFieldSize = 0;
   int maxRows = 0;
   int queryTimeout = 0;
   int fetchDirection = ResultSet.FETCH_FORWARD;
   int fetchSize = 0;

   public TestStatement(final TestDriver driver)
   {
      this.driver = driver;
   }
   // implementation of java.sql.Statement interface

   /**
    *
    * @exception java.sql.SQLException <description>
    */
   public void close() throws SQLException
   {
   }

   /**
    *
    * @param param1 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public boolean execute(String sql) throws SQLException
   {
      if (driver.getFail())
      {
         throw new SQLException("asked to fail");
      } // end of if ()
      return false;

   }

   /**
    *
    * @param param1 <description>
    * @param param2 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
   {
      return execute(sql);
   }

   /**
    *
    * @param param1 <description>
    * @param param2 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public boolean execute(String sql, int[] columnIndexes) throws SQLException
   {
      return execute(sql);
   }

   /**
    *
    * @param param1 <description>
    * @param param2 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public boolean execute(String sql, String[]columnNames ) throws SQLException
   {
      return execute(sql);
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public Connection getConnection() throws SQLException
   {
      return null;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public SQLWarning getWarnings() throws SQLException
   {
      return null;
   }

   /**
    *
    * @exception java.sql.SQLException <description>
    */
   public void clearWarnings() throws SQLException
   {
   }

   /**
    *
    * @param param1 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public ResultSet executeQuery(String sql) throws SQLException
   {
      execute(sql);
      return null;
   }

   /**
    *
    * @param param1 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int executeUpdate(String sql) throws SQLException
   {
      execute(sql);
      return 0;
   }

   /**
    *
    * @param param1 <description>
    * @param param2 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
   {
      return executeUpdate(sql);
   }

   /**
    *
    * @param param1 <description>
    * @param param2 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
   {
      return executeUpdate(sql);
   }

   /**
    *
    * @param param1 <description>
    * @param param2 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int executeUpdate(String sql, String[] columnNames) throws SQLException
   {
      return executeUpdate(sql);
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int getMaxFieldSize() throws SQLException
   {
      return maxFieldSize;
   }

   /**
    *
    * @param param1 <description>
    * @exception java.sql.SQLException <description>
    */
   public void setMaxFieldSize(int max) throws SQLException
   {
      this.maxFieldSize = max;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int getMaxRows() throws SQLException
   {
      return maxRows;
   }

   /**
    *
    * @param param1 <description>
    * @exception java.sql.SQLException <description>
    */
   public void setMaxRows(int max) throws SQLException
   {
      this.maxRows = max;
   }

   /**
    *
    * @param param1 <description>
    * @exception java.sql.SQLException <description>
    */
   public void setEscapeProcessing(boolean enable) throws SQLException
   {
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int getQueryTimeout() throws SQLException
   {
      return queryTimeout;
   }

   /**
    *
    * @param param1 <description>
    * @exception java.sql.SQLException <description>
    */
   public void setQueryTimeout(int timeout) throws SQLException
   {
      this.queryTimeout = timeout;
   }

   /**
    *
    * @exception java.sql.SQLException <description>
    */
   public void cancel() throws SQLException
   {
   }

   /**
    *
    * @param param1 <description>
    * @exception java.sql.SQLException <description>
    */
   public void setCursorName(String name) throws SQLException
   {
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public ResultSet getResultSet() throws SQLException
   {
      return null;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int getUpdateCount() throws SQLException
   {
      return 0;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public boolean getMoreResults() throws SQLException
   {
      return false;
   }

   /**
    *
    * @param param1 <description>
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public boolean getMoreResults(int current) throws SQLException
   {
      return false;
   }

   /**
    *
    * @param param1 <description>
    * @exception java.sql.SQLException <description>
    */
   public void setFetchDirection(int direction) throws SQLException
   {
      this.fetchDirection = direction;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int getFetchDirection() throws SQLException
   {
      return fetchDirection;
   }

   /**
    *
    * @param param1 <description>
    * @exception java.sql.SQLException <description>
    */
   public void setFetchSize(int rows) throws SQLException
   {
      this.fetchSize = rows;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int getFetchSize() throws SQLException
   {
      return fetchSize;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int getResultSetConcurrency() throws SQLException
   {
      return 0;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int getResultSetType() throws SQLException
   {
      return 0;
   }

   /**
    *
    * @param param1 <description>
    * @exception java.sql.SQLException <description>
    */
   public void addBatch(String sql) throws SQLException
   {
   }

   /**
    *
    * @exception java.sql.SQLException <description>
    */
   public void clearBatch() throws SQLException
   {
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int[] executeBatch() throws SQLException
   {
      return null;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public ResultSet getGeneratedKeys() throws SQLException
   {
      return null;
   }

   /**
    *
    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public int getResultSetHoldability() throws SQLException
   {
      return 0;
   }


}// LocalStatement
