⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmlpreparedstatement.java

📁 数据仓库工具
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
      }
      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 {
    this.setString(parameterIndex, value.toString() );
  }

  public void setDate(int parameterIndex, Date x) 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) 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) throws SQLException {
    /**@todo Implement this java.sql.PreparedStatement method*/
    throw new java.lang.UnsupportedOperationException("Method setTimestamp() not yet implemented.");
  }

  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.");
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -