XmlPreparedStatement.java :  » Database-JDBC-Connection-Pool » octopus » org » webdocwf » util » xml » Java Open Source

Java Open Source » Database JDBC Connection Pool » octopus 
octopus » org » webdocwf » util » xml » XmlPreparedStatement.java
package org.webdocwf.util.xml;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.io.InputStream;
import java.io.Reader;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Array;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;
import java.util.Calendar;
import java.net.URL;
import java.sql.ParameterMetaData;
import java.sql.SQLWarning;
import java.sql.Connection;
import java.sql.DriverManager;
import java.io.File;
import java.util.*;

/**
 * Class implements the JDBC PreparedStatement interface for the XmlJdbc driver.
 *
 * @author     Zoran Milakovic
 */

public class XmlPreparedStatement implements PreparedStatement {

  private XmlConnection connection;
  private Vector resultSets = new Vector();
  private String sqlForPrepare = "";
  private String sqlPrepared = "";
  private int paramCount = 0;
  private ArrayList parameters = new ArrayList();
  private ArrayList binaryStreamParameters = new ArrayList();
  private String fileName;
  public static String PREPARE_SEPARATOR = "~@#NEXTPARAMETER#@~";

  public XmlPreparedStatement(XmlConnection connection, String preparedSql) {
    DriverManager.println("XmlJdbc - XmlStatement() - connection=" + connection);
    this.sqlForPrepare = preparedSql;
    this.sqlPrepared = preparedSql;
    this.paramCount = countParameters(preparedSql);
    for(int i = 0; i < paramCount; i++)
      parameters.add("null");
    this.connection = connection;
    this.fileName = connection.getPath() + connection.getExtension();
  }

  private int countParameters(String sql) {
    int count = 0;
    int index = sql.indexOf(PREPARE_SEPARATOR);
    while(index != -1) {
      count++;
      sql = sql.substring(index + 1);
      index = sql.indexOf(PREPARE_SEPARATOR);
    }
    return count;
  }

  private boolean prepareSql() throws SQLException {
    boolean retVal = true;

    for(int i = 0; i < parameters.size(); i++) {
      int index = sqlPrepared.indexOf(PREPARE_SEPARATOR);
      if(index != -1) {
        sqlPrepared = sqlPrepared.substring(0, index) +
                      parameters.get(i) +
                      sqlPrepared.substring(index + PREPARE_SEPARATOR.length());
      }
    }

    if(sqlPrepared.indexOf(PREPARE_SEPARATOR) != -1)
      throw new SQLException("All ? in prepared query has to be replaced with values.");
    else if(parameters.size() < this.paramCount)
      throw new SQLException(
          "Number of setted parameters is less than number of parameters in statement.");
    else if(parameters.size() > this.paramCount)
      throw new SQLException(
          "Number of setted parameters is greater than number of parameters in statement.");

    return retVal;
  }

  /**
   * Sets the maxFieldSize attribute of the XmlStatement object
   *
   * @param  p0                The new maxFieldSize value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void setMaxFieldSize(int p0) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Sets the maxRows attribute of the XmlStatement object
   *
   * @param  p0                The new maxRows value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void setMaxRows(int p0) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Sets the escapeProcessing attribute of the XmlStatement object
   *
   * @param  p0                The new escapeProcessing value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void setEscapeProcessing(boolean p0) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Sets the queryTimeout attribute of the XmlStatement object
   *
   * @param  p0                The new queryTimeout value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void setQueryTimeout(int p0) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Sets the cursorName attribute of the XmlStatement object
   *
   * @param  p0                The new cursorName value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void setCursorName(String p0) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Sets the fetchDirection attribute of the XmlStatement object
   *
   * @param  p0                The new fetchDirection value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void setFetchDirection(int p0) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Sets the fetchSize attribute of the XmlStatement object
   *
   * @param  p0                The new fetchSize value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void setFetchSize(int p0) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the maxFieldSize attribute of the XmlStatement object
   *
   * @return                   The maxFieldSize value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int getMaxFieldSize() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the maxRows attribute of the XmlStatement object
   *
   * @return                   The maxRows value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int getMaxRows() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the queryTimeout attribute of the XmlStatement object
   *
   * @return                   The queryTimeout value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int getQueryTimeout() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the warnings attribute of the XmlStatement object
   *
   * @return                   The warnings value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public SQLWarning getWarnings() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the resultSet attribute of the XmlStatement object
   *
   * @return                   The resultSet value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public ResultSet getResultSet() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the updateCount attribute of the XmlStatement object
   *
   * @return                   The updateCount value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int getUpdateCount() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the moreResults attribute of the XmlStatement object
   *
   * @return                   The moreResults value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public boolean getMoreResults() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the fetchDirection attribute of the XmlStatement object
   *
   * @return                   The fetchDirection value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int getFetchDirection() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the fetchSize attribute of the XmlStatement object
   *
   * @return                   The fetchSize value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int getFetchSize() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the resultSetConcurrency attribute of the XmlStatement object
   *
   * @return                   The resultSetConcurrency value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int getResultSetConcurrency() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the resultSetType attribute of the XmlStatement object
   *
   * @return                   The resultSetType value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int getResultSetType() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Gets the connection attribute of the XmlStatement object
   *
   * @return                   The connection value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public Connection getConnection() throws SQLException {
    return connection;
  }

  public ResultSet executeQuery(String sql) throws SQLException {
    DriverManager.println("XmlJdbc - XmlStatement:executeQuery() - sql= " + sql);
    XmlWriter writer;
    if(this.connection.getAutoCommit())
      writer = new XmlWriter(fileName,true);
    else
      writer = new XmlWriter(fileName, false);
    XmlSqlParser parser = new XmlSqlParser(this.fileName, this.connection.getAutoCommit() );
    if( binaryStreamParameters.size() != 0 )
          parser.setBinaryStreamList( binaryStreamParameters );
    try {
      parser.parse(sql);
    }
    catch(Exception e) {
      throw new SQLException("Syntax Error. " + e.getMessage());
    }
    if(parser.sqlType.equals(parser.DROP_TABLE)) {
      execute(sql);
      return null;
    }
    if(parser.sqlType.equals(parser.DELETE)) {
      executeUpdate(sql);
      return null;
    }
    if(parser.sqlType.equals(parser.UPDATE)) {
      executeUpdate(sql);
      return null;
    } else if(parser.sqlType.equals(parser.INSERT)) {
      executeUpdate(sql);
      return null;
    } else if(parser.sqlType.equals(parser.CREATE_TABLE)) {
      execute(sql);
      return null;
    } else if(parser.sqlType.equals(parser.SELECT)) {

      String fileName = connection.getPath() + connection.getExtension();
      File checkFile = new File(fileName);
      XmlReader reader;
      try {
        reader = new XmlReader(fileName);
        String[] xxx = parser.getColumnNames();
        String[] yyy = (String[]) writer.getTableProperties(parser.getTableName()).get(0);
        boolean isOK = true;
        for(int i = 0; i < xxx.length; i++) {
          out:
              for(int j = 0; j < yyy.length; j++) {
            if(xxx[i].equalsIgnoreCase(yyy[j])) {
              isOK = true;
              break out;
            } else
              isOK = false;
          }
          if(!isOK)
            throw new SQLException("Column '" + xxx[i] + "' not found in table " +
                parser.getTableName());
        }
      }
      catch(Exception e) {
        throw new SQLException("Error reading data file. Message was: " + e);
      }
      XmlResultSet resultSet = new XmlResultSet(this, reader,
                               parser.getTableName(), parser.getColumnNames(),
                               parser.getWhereColumnNames(), parser.getWhereColumnValues());
      resultSet.select();
      return resultSet;
    } else {
      throw new SQLException("Syntax error.Not supported sql statement.");
    }
  }

  /**
   * Insert data into XML database
   *
   * @param  sql               Description of Parameter
   * @return                   Description of the Returned Value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int executeUpdate(String sql) throws SQLException {
    DriverManager.println("XmlJdbc - XmlStatement:executeUpdate() - sql= " + sql);
    XmlSqlParser parser = new XmlSqlParser();
    if( binaryStreamParameters.size() != 0 )
          parser.setBinaryStreamList( binaryStreamParameters );
    try {
      parser.parse(sql);
    }
    catch(Exception e) {
      throw new SQLException("Syntax Error. " + e.getMessage());
    }
    if(parser.sqlType.equals(parser.SELECT))
      throw new SQLException("Not supported SELECT statement - use executeQuery() method");
    else if(parser.sqlType.equals(parser.CREATE_TABLE)) {
      throw new SQLException("Not supported CREATE_TABLE statement - use execute() method");
    } else if(parser.sqlType.equals(parser.DROP_TABLE)) {
      throw new SQLException("Not supported DROP_TABLE statement - use execute() method");
    } else if(parser.sqlType.equals(parser.INSERT)) {
      String fileName = connection.getPath() + connection.getExtension();
      XmlWriter writeXml;
      try {
        if(this.connection.getAutoCommit())
          writeXml = new XmlWriter(fileName,true);
        else
          writeXml = new XmlWriter(fileName, false);
        ArrayList properties = writeXml.getTableProperties(parser.tableName);
        //check for existance of columns
        String[] xxx = parser.getColumnNames();
        String[] yyy = (String[]) properties.get(0);
        boolean isOK = true;
        for(int i = 0; i < xxx.length; i++) {
          if(!xxx[i].endsWith("*")) {
            out:
                for(int j = 0; j < yyy.length; j++) {
              if(xxx[i].equalsIgnoreCase(yyy[j])) {
                isOK = true;
                break out;
              } else
                isOK = false;
            }
            if(!isOK)
              throw new SQLException("Column '" + xxx[i] + "' not found in table " +
                  parser.getTableName());
          }
        }
        //check if NOTNULL columns is set
        if(!properties.get(1).toString().equalsIgnoreCase("NO CREATE TABLE")) {
          yyy = parser.getColumnNames();
          xxx = (String[]) writeXml.getTableProperties(parser.tableName).get(2);
          isOK = true;
          for(int i = 0; i < xxx.length; i++) {
            out:
                for(int j = 0; j < yyy.length; j++) {
              if(xxx[i].equalsIgnoreCase(yyy[j])) {
                isOK = true;
                break out;
              } else
                isOK = false;
            }
            if(!isOK)
              throw new SQLException("Column '" + xxx[i] + "' can not be NULL.");
          }
        }
        writeXml.insert(parser.getTableName(), parser.getColumnNames(), parser.getColumnValues());
      }
      catch(Exception e) {
        throw new SQLException("Error reading data file. Message was: " + e);
      }

    } else if(parser.sqlType.equals(parser.UPDATE)) {
      String fileName = connection.getPath() + connection.getExtension();
      XmlWriter writeXml;
      try {
        if(this.connection.getAutoCommit())
          writeXml = new XmlWriter(fileName,true);
        else
          writeXml = new XmlWriter(fileName, false);
        String[] xxx = parser.getColumnNames();
        String[] yyy = (String[]) writeXml.getTableProperties(parser.tableName).get(0);
        boolean isOK = true;
        for(int i = 0; i < xxx.length; i++) {
          if(!xxx[i].endsWith("*")) {
            out:
                for(int j = 0; j < yyy.length; j++) {
              if(xxx[i].equalsIgnoreCase(yyy[j])) {
                isOK = true;
                break out;
              } else
                isOK = false;
            }
            if(!isOK)
              throw new SQLException("Column '" + xxx[i] + "' not found in table " +
                  parser.getTableName());
          }
        }
        writeXml.update(parser.getTableName(), parser.getColumnNames(), parser.getColumnValues(),
            parser.getWhereColumnNames(), parser.getWhereColumnValues());
      }
      catch(Exception e) {
        throw new SQLException("Error reading data file. Message was: " + e);
      }

    } else if(parser.sqlType.equals(parser.DELETE)) {
      String fileName = connection.getPath() + connection.getExtension();
      XmlWriter writeXml;
      try {
        if(this.connection.getAutoCommit())
          writeXml = new XmlWriter(fileName,true);
        else
          writeXml = new XmlWriter(fileName, false);
        String[] xxx = parser.getWhereColumnNames();
        String[] yyy = (String[]) writeXml.getTableProperties(parser.tableName).get(0);
        boolean isOK = true;
        for(int i = 0; i < xxx.length; i++) {
          if(!xxx[i].endsWith("*")) {
            out:
                for(int j = 0; j < yyy.length; j++) {
              if(xxx[i].equalsIgnoreCase(yyy[j])) {
                isOK = true;
                break out;
              } else
                isOK = false;
            }
            if(!isOK)
              throw new SQLException("Column '" + xxx[i] + "' not found in table " +
                  parser.getTableName());
          }
        }
        writeXml.delete(parser.getTableName(), parser.getWhereColumnNames(),
            parser.getWhereColumnValues());
      }
      catch(Exception e) {
        throw new SQLException("Error reading data file. Message was: " + e);
      }

    } else if(parser.sqlType.equals(parser.DROP_TABLE)) {
    }
    return 0;

  }

  /**
   * Releases this <code>Statement</code> object's database
   * and JDBC resources immediately instead of waiting for
   * this to happen when it is automatically closed.
   * It is generally good practice to release resources as soon as
   * you are finished with them to avoid tying up database
   * resources.
   * <P>
   * Calling the method <code>close</code> on a <code>Statement</code>
   * object that is already closed has no effect.
   * <P>
   * <B>Note:</B> A <code>Statement</code> object is automatically closed
   * when it is garbage collected. When a <code>Statement</code> object is
   * closed, its current <code>ResultSet</code> object, if one exists, is
   * also closed.
   *
   * @exception SQLException if a database access error occurs
   */
  public void close() throws SQLException {
  // close all result sets
  }

  /**
   *Description of the Method
   *
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void cancel() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Description of the Method
   *
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void clearWarnings() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Description of the Method
   *
   * @param  sql               Description of Parameter
   * @return                   Description of the Returned Value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public boolean execute(String sql) throws SQLException {
    XmlWriter writeXml;
    if(this.connection.getAutoCommit())
      writeXml = new XmlWriter(fileName,true);
    else
      writeXml = new XmlWriter(fileName, false);
    XmlSqlParser parser = new XmlSqlParser(this.fileName, this.connection.getAutoCommit() );
    if( binaryStreamParameters.size() != 0 )
          parser.setBinaryStreamList( binaryStreamParameters );
    try {
      parser.parse(sql);
    }
    catch(Exception e) {
      throw new SQLException("Syntax Error. " + e.getMessage());
    }
    if(parser.sqlType.equals(parser.SELECT))
      throw new SQLException("Use executeQuery() for SELECT statement");
    else if(parser.sqlType.equals(parser.UPDATE))
      executeUpdate(sql);
    else if(parser.sqlType.equals(parser.INSERT))
      executeUpdate(sql);
    else if(parser.sqlType.equals(parser.DELETE))
      executeUpdate(sql);
    else if(parser.sqlType.equals(parser.CREATE_TABLE)) {
      String fileName = connection.getPath() + connection.getExtension();
      try {
        writeXml.createTable(parser.getSqlStatement(), parser.getTableName());
      }
      catch(Exception e) {
        throw new SQLException("Error reading data file. Message was: " + e);
      }
    } else if(parser.sqlType.equals(parser.DROP_TABLE)) {
      String fileName = connection.getPath() + connection.getExtension();
      try {
        writeXml.dropTable(parser.getTableName());
      }
      catch(Exception e) {
        throw new SQLException("Error reading data file. Message was: " + e);
      }
    }
    return true;

  }

  /**
   * Set String as parameter in sql statement.
   * @param parameterIndex
   * @param value
   * @throws SQLException
   */
  public void setString(int parameterIndex, String value) throws SQLException {
    if( value == null )
      value = "null";
    value = Utils.replaceAll( value, "'", XmlSqlParser.quoteEscape);

XmlDriver.log("XmlPreparedStatement.setString(), value = "+value);

    parameters.set(parameterIndex - 1, "'" + value + "'");
  }

  /**
   *
   * @param parameterIndex
   * @param value
   * @throws SQLException
   */
  public void setBinaryStream(int parameterIndex, InputStream value,
      int length) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *
   * @param parameterIndex
   * @param value
   * @throws SQLException
   */
  public void setBytes(int parameterIndex, byte[] value) throws SQLException {
    binaryStreamParameters.add(Utils.bytesToHexString(value));
    String paramName = XmlSqlParser.BINARY_STREAM_OBJECT+binaryStreamParameters.size();
    parameters.set(parameterIndex-1, paramName);
  }


  /**
   *
   * @param parameterIndex
   * @param value
   * @throws SQLException
   */
  public void setBlob(int parameterIndex, Blob value) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   * Adds a feature to the Batch attribute of the XmlStatement object
   *
   * @param  p0                The feature to be added to the Batch attribute
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void addBatch(String p0) throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Description of the Method
   *
   * @exception  SQLException  Description of Exception
   * @since
   */
  public void clearBatch() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  /**
   *Description of the Method
   *
   * @return                   Description of the Returned Value
   * @exception  SQLException  Description of Exception
   * @since
   */
  public int[] executeBatch() throws SQLException {
    throw new SQLException("Not Supported !");
  }

  //---------------------------------------------------------------------
  // JDBC 3.0
  //---------------------------------------------------------------------

  public boolean getMoreResults(int current) throws SQLException {
    throw new UnsupportedOperationException("Statement.getMoreResults(int) unsupported");
  }

  public ResultSet getGeneratedKeys() throws SQLException {
    throw new UnsupportedOperationException("Statement.getGeneratedKeys() unsupported");
  }

  public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
    throw new UnsupportedOperationException("Statement.executeUpdate(String,int) unsupported");
  }

  public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
    throw new UnsupportedOperationException("Statement.executeUpdate(String,int[]) unsupported");
  }

  public int executeUpdate(String sql, String[] columnNames) throws SQLException {
    throw new UnsupportedOperationException("Statement.executeUpdate(String,String[]) unsupported");
  }

  public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
    throw new UnsupportedOperationException("Statement.execute(String,int) unsupported");
  }

  public boolean execute(String sql, int[] columnIndexes) throws SQLException {
    throw new UnsupportedOperationException("Statement.execute(String,int[]) unsupported");
  }

  public boolean execute(String sql, String[] columnNames) throws SQLException {
    throw new UnsupportedOperationException("Statement.execute(String,String[]) unsupported");
  }

  public int getResultSetHoldability() throws SQLException {
    throw new UnsupportedOperationException("Statement.getResultSetHoldability() unsupported");
  }

  public ResultSet executeQuery() throws SQLException {
    if(!prepareSql())
      throw new SQLException("Error with prepared statement  !");
    return executeQuery(this.sqlPrepared);

  }

  public int executeUpdate() throws SQLException {
    if(!prepareSql())
      throw new SQLException("Error with prepared statement  !");
    executeUpdate(this.sqlPrepared);
    return 0;
  }

  public void setNull(int parameterIndex, int sqlType) throws SQLException {
    this.setString(parameterIndex, "null" );
  }

  public void setBoolean(int parameterIndex, boolean value) throws SQLException {
    this.setString(parameterIndex, String.valueOf(value) );
  }

  public void setByte(int parameterIndex, byte value) throws SQLException {
    this.setString(parameterIndex, String.valueOf(value) );
  }

  public void setShort(int parameterIndex, short value) throws SQLException {
    this.setString(parameterIndex, String.valueOf(value) );
  }

  public void setInt(int parameterIndex, int value) throws SQLException {
    this.setString(parameterIndex, String.valueOf(value) );
  }

  public void setLong(int parameterIndex, long value) throws SQLException {
    this.setString(parameterIndex, String.valueOf(value) );
  }

  public void setFloat(int parameterIndex, float value) throws SQLException {
    this.setString(parameterIndex, String.valueOf(value) );
  }

  public void setDouble(int parameterIndex, double value) throws SQLException {
    this.setString(parameterIndex, String.valueOf(value) );
  }

  public void setBigDecimal(int parameterIndex, BigDecimal value) throws SQLException {
      if(value == null) {
          this.setString( parameterIndex, value.toString() );
      } else {
          this.setString( parameterIndex, "" );
      }
  }

  public void setDate(int parameterIndex, Date value) throws SQLException {
      if(value == null) {
          this.setString( parameterIndex, value.toString() );
      } else {
          this.setString( parameterIndex, "" );
      }
  }
  
  public void setTime(int parameterIndex, Time value) throws SQLException {
      if(value == null) {
          this.setString( parameterIndex, value.toString() );
      } else {
          this.setString( parameterIndex, "" );
      }
  }
  
  public void setTimestamp(int parameterIndex, Timestamp value) throws SQLException {
      if(value == null) {
          this.setString( parameterIndex, value.toString() );
      } else {
          this.setString( parameterIndex, "" );
      }
  }

  public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException(
        "Method setAsciiStream() not yet implemented.");
  }

  public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException(
        "Method setUnicodeStream() not yet implemented.");
  }

  public void clearParameters() throws SQLException {
    this.sqlPrepared = this.sqlForPrepare;
//    this.parameters.clear();
    for(int i = 0; i < parameters.size(); i++)
      parameters.set(i, null);
    this.binaryStreamParameters.clear();
  }

  public void setObject(int parameterIndex, Object x, int targetSqlType,
      int scale) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setObject() not yet implemented.");
  }

  public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setObject() not yet implemented.");
  }

  public void setObject(int parameterIndex, Object x) throws SQLException {
    if(x == null)
      x = new String("null");
    setString(parameterIndex, x.toString());
  }

  public boolean execute() throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method execute() not yet implemented.");
  }

  public void addBatch() throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method addBatch() not yet implemented.");
  }

  public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException(
        "Method setCharacterStream() not yet implemented.");
  }

  public void setRef(int i, Ref x) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setRef() not yet implemented.");
  }

  public void setClob(int i, Clob x) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setClob() not yet implemented.");
  }

  public void setArray(int i, Array x) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setArray() not yet implemented.");
  }

  public ResultSetMetaData getMetaData() throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method getMetaData() not yet implemented.");
  }

  public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setDate() not yet implemented.");
  }

  public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setTime() not yet implemented.");
  }

  public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setTimestamp() not yet implemented.");
  }

  public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException {
    this.setString(paramIndex, "null" );
  }

  public void setURL(int parameterIndex, URL x) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setURL() not yet implemented.");
  }

  public ParameterMetaData getParameterMetaData() throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException(
        "Method getParameterMetaData() not yet implemented.");
  }

public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setAsciiStream(int,InputStream) not yet implemented.");
}

public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setAsciiStream(int,InputStream,long) not yet implemented.");
}

public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setBinaryStream(int,InputStream) not yet implemented.");
}

public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setBinaryStream(int,InputStream,long) not yet implemented.");
}

public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setBlob(int,InputStream) not yet implemented.");
}

public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setBlob(int,InputStream,long) not yet implemented.");
}

public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setCharacterStream(int,Reader) not yet implemented.");
}

public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setCharacterStream(int,Reader,long) not yet implemented.");
}

public void setClob(int parameterIndex, Reader reader) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setClob(int,Reader) not yet implemented.");
}

public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setClob(int,Reader,long) not yet implemented.");
}

public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setNCharacterStream(int,Reader) not yet implemented.");
}

public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setNCharacterStream(int,Reader,long) not yet implemented.");
}

public void setNClob(int parameterIndex, NClob value) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setNClob(int,NClob) not yet implemented.");
}

public void setNClob(int parameterIndex, Reader reader) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setNClob(int,Reader) not yet implemented.");
}

public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setNClob(int,Reader,long) not yet implemented.");
}

public void setNString(int parameterIndex, String value) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setNString(int,String) not yet implemented.");
}

public void setRowId(int parameterIndex, RowId x) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setRowId(int,RowId) not yet implemented.");
}

public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setSQLXML(int,SQLXML) not yet implemented.");
}

public boolean isClosed() throws SQLException {
   // TODO Auto-generated method stub
   return false;
}

public boolean isPoolable() throws SQLException {
   // TODO Auto-generated method stub
   return false;
}

public void setPoolable(boolean poolable) throws SQLException {
   // TODO Auto-generated method stub
   throw new java.lang.UnsupportedOperationException(
   "Method setPoolable(boolean) not yet implemented.");
}

public boolean isWrapperFor(Class<?> iface) throws SQLException {
   // TODO Auto-generated method stub
   return false;
}

public <T> T unwrap(Class<T> iface) throws SQLException {
   // TODO Auto-generated method stub
   return null;
}

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.