/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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 David Jencks * @version */ public class TestStatement implements Statement { private final TestDriver driver; int queryTimeout = 0; public TestStatement(final TestDriver driver) { this.driver = driver; } // implementation of java.sql.Statement interface /** * * @exception java.sql.SQLException */ public void close() throws SQLException { } /** * * @param param1 * @return * @exception java.sql.SQLException */ public boolean execute(String sql) throws SQLException { if (driver.getFail()) { throw new SQLException("asked to fail"); } // end of if () return false; } /** * * @param param1 * @param param2 * @return * @exception java.sql.SQLException */ public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { return execute(sql); } /** * * @param param1 * @param param2 * @return * @exception java.sql.SQLException */ public boolean execute(String sql, int[] columnIndexes) throws SQLException { return execute(sql); } /** * * @param param1 * @param param2 * @return * @exception java.sql.SQLException */ public boolean execute(String sql, String[]columnNames ) throws SQLException { return execute(sql); } /** * * @return * @exception java.sql.SQLException */ public Connection getConnection() throws SQLException { return null; } /** * * @return * @exception java.sql.SQLException */ public SQLWarning getWarnings() throws SQLException { return null; } /** * * @exception java.sql.SQLException */ public void clearWarnings() throws SQLException { } /** * * @param param1 * @return * @exception java.sql.SQLException */ public ResultSet executeQuery(String sql) throws SQLException { execute(sql); return null; } /** * * @param param1 * @return * @exception java.sql.SQLException */ public int executeUpdate(String sql) throws SQLException { execute(sql); return 0; } /** * * @param param1 * @param param2 * @return * @exception java.sql.SQLException */ public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { return executeUpdate(sql); } /** * * @param param1 * @param param2 * @return * @exception java.sql.SQLException */ public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { return executeUpdate(sql); } /** * * @param param1 * @param param2 * @return * @exception java.sql.SQLException */ public int executeUpdate(String sql, String[] columnNames) throws SQLException { return executeUpdate(sql); } /** * * @return * @exception java.sql.SQLException */ public int getMaxFieldSize() throws SQLException { return 0; } /** * * @param param1 * @exception java.sql.SQLException */ public void setMaxFieldSize(int max) throws SQLException { } /** * * @return * @exception java.sql.SQLException */ public int getMaxRows() throws SQLException { return 0; } /** * * @param param1 * @exception java.sql.SQLException */ public void setMaxRows(int max) throws SQLException { } /** * * @param param1 * @exception java.sql.SQLException */ public void setEscapeProcessing(boolean enable) throws SQLException { } /** * * @return * @exception java.sql.SQLException */ public int getQueryTimeout() throws SQLException { return queryTimeout; } /** * * @param param1 * @exception java.sql.SQLException */ public void setQueryTimeout(int timeout) throws SQLException { this.queryTimeout = timeout; } /** * * @exception java.sql.SQLException */ public void cancel() throws SQLException { } /** * * @param param1 * @exception java.sql.SQLException */ public void setCursorName(String name) throws SQLException { } /** * * @return * @exception java.sql.SQLException */ public ResultSet getResultSet() throws SQLException { return null; } /** * * @return * @exception java.sql.SQLException */ public int getUpdateCount() throws SQLException { return 0; } /** * * @return * @exception java.sql.SQLException */ public boolean getMoreResults() throws SQLException { return false; } /** * * @param param1 * @return * @exception java.sql.SQLException */ public boolean getMoreResults(int current) throws SQLException { return false; } /** * * @param param1 * @exception java.sql.SQLException */ public void setFetchDirection(int direction) throws SQLException { } /** * * @return * @exception java.sql.SQLException */ public int getFetchDirection() throws SQLException { return 0; } /** * * @param param1 * @exception java.sql.SQLException */ public void setFetchSize(int rows) throws SQLException { } /** * * @return * @exception java.sql.SQLException */ public int getFetchSize() throws SQLException { return 0; } /** * * @return * @exception java.sql.SQLException */ public int getResultSetConcurrency() throws SQLException { return 0; } /** * * @return * @exception java.sql.SQLException */ public int getResultSetType() throws SQLException { return 0; } /** * * @param param1 * @exception java.sql.SQLException */ public void addBatch(String sql) throws SQLException { } /** * * @exception java.sql.SQLException */ public void clearBatch() throws SQLException { } /** * * @return * @exception java.sql.SQLException */ public int[] executeBatch() throws SQLException { return null; } /** * * @return * @exception java.sql.SQLException */ public ResultSet getGeneratedKeys() throws SQLException { return null; } /** * * @return * @exception java.sql.SQLException */ public int getResultSetHoldability() throws SQLException { return 0; } }// LocalStatement