/*
 * Statement.java
 *
 * Created on August 1, 2007, 6:02 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package usda.weru.soil.arssql;

import java.net.ConnectException;
import java.sql.*;

/**
 * This is a stripped implementation of the Statement interface. It is
 * intended to be used the ARS soap web service to obtain soil data.
 * Only calls that are actually used by WEPS are implemented.
 *
 * @author wjr
 */
public class StatementARS implements java.sql.Statement {
    
    /** Creates a new instance of Statement */
    public StatementARS() {
    }
    
    String url;
    public StatementARS(String url) {
        this.url = url;
    }
    
//          Adds the given SQL command to the current list of commmands for this Statement object.
    public void 	addBatch(String sql) {}
    
//          Cancels this Statement object if both the DBMS and driver support aborting an SQL statement.
    public void 	cancel() {}
    
//          Empties this Statement object's current list of SQL commands.
    public void 	clearBatch() {}
    
//          Clears all the warnings reported on this Statement object.
    public void 	clearWarnings() {}
    
//          Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
    public void 	close() {}
    
//          Executes the given SQL statement, which may return multiple results.
    public boolean 	execute(String sql) {return false;}
    
//          Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval.
    public boolean 	execute(String sql, int autoGeneratedKeys) {return false;}
    
//          Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
    public boolean 	execute(String sql, int[] columnIndexes) {return false;}
    
//          Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
    public boolean 	execute(String sql, String[] columnNames) {return false;}
    
//          Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
    public int[] 	executeBatch() {return null;}
    
//          Executes the given SQL statement, which returns a single ResultSet object.
//			Called by WEPS
    @Override
    public ResultSetARS 	executeQuery(String query) throws SQLException{
//        System.out.println("eQ: " + query);            
                CommunicateWithARS cwa = new CommunicateWithARS(url, query);
                return new ResultSetARS(cwa.getXMLDoc());

    }
    
//          Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.
    public int 	executeUpdate(String sql) {return -1;}
    
//          Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.
    public int 	executeUpdate(String sql, int autoGeneratedKeys) {return -1;}
    
//          Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
    public int 	executeUpdate(String sql, int[] columnIndexes) {return -1;}
    
//          Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
    public int 	executeUpdate(String sql, String[] columnNames) {return -1;}
    
//          Retrieves the Connection object that produced this Statement object.
    public java.sql.Connection 	getConnection() throws SQLException {return  null;}
    
//          Retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement object.
    public int 	getFetchDirection() {return -1;}
    
//          Retrieves the number of result set rows that is the default fetch size for ResultSet objects generated from this Statement object.
    public int 	getFetchSize() {return -1;}
    
//          Retrieves any auto-generated keys created as a result of executing this Statement object.
    public ResultSetARS 	getGeneratedKeys() {return null;}
    
//          Retrieves the maximum number of bytes that can be returned for character and binary column values in a ResultSet object produced by this Statement object.
    public int 	getMaxFieldSize() {return -1;}
    
//          Retrieves the maximum number of rows that a ResultSet object produced by this Statement object can contain.
    public int 	getMaxRows() {return -1;}
    
//          Moves to this Statement object's next result, returns true if it is a ResultSet object, and implicitly closes any current ResultSet object(s) {} obtained with the method getResultSet.
    public boolean 	getMoreResults() {return false;}
    
//          Moves to this Statement object's next result, deals with any current ResultSet object(s) {} according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object.
    public boolean 	getMoreResults(int current) {return false;}
    
//          Retrieves the number of seconds the driver will wait for a Statement object to execute.
    public int 	getQueryTimeout() {return -1;}
    
//          Retrieves the current result as a ResultSet object.
    public ResultSetARS 	getResultSet() {return null;}
    
//          Retrieves the result set concurrency for ResultSet objects generated by this Statement object.
    public int 	getResultSetConcurrency() {return -1;}
    
//          Retrieves the result set holdability for ResultSet objects generated by this Statement object.
    public int 	getResultSetHoldability() {return -1;}
    
//          Retrieves the result set type for ResultSet objects generated by this Statement object.
    public int 	getResultSetType() {return -1;}
    
//          Retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned.
    public int 	getUpdateCount() {return -1;}
    
//          Retrieves the first warning reported by calls on this Statement object.
    public SQLWarning 	getWarnings() {return null;}
    
//          Sets the SQL cursor name to the given String, which will be used by subsequent Statement object execute methods.
    public void 	setCursorName(String name) {}
    
//          Sets escape processing on or off.
    public void 	setEscapeProcessing(boolean enable) {}
    
//          Gives the driver a hint as to the direction in which rows will be processed in ResultSet objects created using this Statement object.
    public void 	setFetchDirection(int direction) {}
    
//          Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed.
    public void 	setFetchSize(int rows) {}
    
//          Sets the limit for the maximum number of bytes in a ResultSet column storing character or binary values to the given number of bytes.
    public void 	setMaxFieldSize(int max) {}
    
//          Sets the limit for the maximum number of rows that any ResultSet object can contain to the given number.
    public void 	setMaxRows(int max) {}
    
//          Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds.
    public void 	setQueryTimeout(int seconds) {}
    
    
    public boolean isPoolable() {return false;}
    public void setPoolable(boolean b) {}
    public boolean isClosed() {return false;}
    public boolean isWrapperFor(Class<?> c) {return false;}
    public <T> T unwrap(Class<T> t) {return null;}
    
}
