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

📄 jdbcpreparedstatement.java

📁 一个可以在applet窗体上持行sql语句并显示返回结果的程序
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
  public Timestamp getTimestamp(int parameterIndex) throws SQLException {
    throw getNotSupported();
  }
  public Object getObject(int parameterIndex) throws SQLException {
    throw getNotSupported();
  }
//#ifdef JAVA2
  public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
//#ifdef JAVA2
  public Object getObject(int i,Map map) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets a REF(<structured-type>) parameter.
   *
   * @param i the first parameter is 1, the second is 2, ...
   * @param x an object representing data of an SQL REF Type
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public Ref getRef(int i) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
//#ifdef JAVA2
  public Blob getBlob(int i) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
//#ifdef JAVA2
  public Clob getClob(int i) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
//#ifdef JAVA2
  public Array getArray(int i) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
//#ifdef JAVA2
  public java.sql.Date getDate(int parameterIndex,Calendar cal)
  throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
//#ifdef JAVA2
  public Time getTime(int parameterIndex,Calendar cal) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
//#ifdef JAVA2
  public Timestamp getTimestamp(int parameterIndex,Calendar cal)
  throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
//#ifdef JAVA2
  public void registerOutParameter(int paramIndex,int sqlType,String typeName)
  throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Adds a set of parameters to the batch.
   *
   * @exception SQLException if a database access error occurs
   * @see Statement#addBatch
   */
//#ifdef JAVA2
  public void addBatch() throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets the designated parameter to a java.sql.Date value,
   * using the given <code>Calendar</code> object.  The driver uses
   * the <code>Calendar</code> object to construct an SQL DATE,
   * which the driver then sends to the database.  With a
   *  a <code>Calendar</code> object, the driver can calculate the date
   * taking into account a custom timezone and locale.  If no
   * <code>Calendar</code> object is specified, the driver uses the default
   * timezone and locale.
   *
   * @param parameterIndex the first parameter is 1, the second is 2, ...
   * @param x the parameter value
   * @param cal the <code>Calendar</code> object the driver will use
   *            to construct the date
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public void setDate(int parameterIndex,java.sql.Date x,Calendar cal)
  throws SQLException {
    setDate(parameterIndex,x);
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets the designated parameter to a java.sql.Time value,
   * using the given <code>Calendar</code> object.  The driver uses
   * the <code>Calendar</code> object to construct an SQL TIME,
   * which the driver then sends to the database.  With a
   * a <code>Calendar</code> object, the driver can calculate the time
   * taking into account a custom timezone and locale.  If no
   * <code>Calendar</code> object is specified, the driver uses the default
   * timezone and locale.
   *
   * @param parameterIndex the first parameter is 1, the second is 2, ...
   * @param x the parameter value
   * @param cal the <code>Calendar</code> object the driver will use
   *            to construct the time
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public void setTime(int parameterIndex,Time x,Calendar cal)
  throws SQLException {
    setTime(parameterIndex,x);
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets the designated parameter to a java.sql.Timestamp value,
   * using the given <code>Calendar</code> object.  The driver uses
   * the <code>Calendar</code> object to construct an SQL TIMESTAMP,
   *  which the driver then sends to the database.  With a
   * a <code>Calendar</code> object, the driver can calculate the timestamp
   * taking into account a custom timezone and locale.  If no
   * <code>Calendar</code> object is specified, the driver uses the default
   * timezone and locale.
   *
   * @param parameterIndex the first parameter is 1, the second is 2, ...
   * @param x the parameter value
   * @param cal the <code>Calendar</code> object the driver will use
   *            to construct the timestamp
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public void setTimestamp(int parameterIndex,Timestamp x,Calendar cal)
  throws SQLException {
    setTimestamp(parameterIndex,x);
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets the designated parameter to SQL NULL.  This version of setNull should
   * be used for user-named types and REF type parameters.  Examples
   * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and
   * named array types.
   *
   * <P><B>Note:</B> To be portable, applications must give the
   * SQL type code and the fully-qualified SQL type name when specifying
   * a NULL user-defined or REF parameter.  In the case of a user-named type
   * the name is the type name of the parameter itself.  For a REF
   * parameter the name is the type name of the referenced type.  If
   * a JDBC driver does not need the type code or type name information,
   * it may ignore it.
   *
   * Although it is intended for user-named and Ref parameters,
   * this method may be used to set a null parameter of any JDBC type.
   * If the parameter does not have a user-named or REF type, the given
   * typeName is ignored.
   *
   *
   * @param parameterIndex the first parameter is 1, the second is 2, ...
   * @param sqlType a value from java.sql.Types
   * @param typeName the fully-qualified name of an SQL user-named type,
   *  ignored if the parameter is not a user-named type or REF
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public void setNull(int parameterIndex,int sqlType,String typeName)
  throws SQLException {
    setNull(parameterIndex,sqlType);
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets the designated parameter to the given <code>Reader</code>
   * object, which is the given number of characters long.
   * When a very large UNICODE value is input to a LONGVARCHAR
   * parameter, it may be more practical to send it via a
   * java.io.Reader. JDBC will read the data from the stream
   * as needed, until it reaches end-of-file.  The JDBC driver will
   * do any necessary conversion from UNICODE to the database char format.
   *
   * <P><B>Note:</B> This stream object can either be a standard
   * Java stream object or your own subclass that implements the
   * standard interface.
   *
   * @param parameterIndex the first parameter is 1, the second is 2, ...
   * @param reader the java reader which contains the UNICODE data
   * @param length the number of characters in the stream
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public void setCharacterStream(int parameterIndex,Reader reader,int length)
  throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets a REF(&lt;structured-type&gt;) parameter.
   *
   * @param i the first parameter is 1, the second is 2, ...
   * @param x an object representing data of an SQL REF Type
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public void setRef(int i,Ref x) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets a BLOB parameter.
   *
   * @param i the first parameter is 1, the second is 2, ...
   * @param x an object representing a BLOB
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public void setBlob(int i,Blob x) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets a CLOB parameter.
   *
   * @param i the first parameter is 1, the second is 2, ...
   * @param x an object representing a CLOB
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public void setClob(int i,Clob x) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Sets an Array parameter.
   *
   * @param i the first parameter is 1, the second is 2, ...
   * @param x an object representing an SQL array
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public void setArray(int i,Array x) throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2
  /**
   * JDBC 2.0
   *
   * Gets the number, types and properties of a ResultSet's columns.
   *
   * @return the description of a ResultSet's columns
   * @exception SQLException if a database access error occurs
   */
//#ifdef JAVA2
  public ResultSetMetaData getMetaData() throws SQLException {
    throw getNotSupported();
  }
//#endif JAVA2

  jdbcPreparedStatement(jdbcConnection c,String s) {
    super(c);
    sSql=s;
    vParameter=new Vector();
  }
  private void setObjectInType(int parameterIndex,Object x,int type)
  throws SQLException {
    if(Trace.TRACE) Trace.trace();
    if(x==null) {
      setNull(parameterIndex);
      return;
    }
    switch(type) {
    case Types.BIT:
      setBoolean(parameterIndex,((Boolean)x).booleanValue());
      break;
    case Types.TINYINT:
      setByte(parameterIndex,((Byte)x).byteValue());
      break;
    case Types.SMALLINT:
      setShort(parameterIndex,((Short)x).shortValue());
      break;
    case Types.INTEGER:
      setInt(parameterIndex,((Integer)x).intValue());
      break;
    case Types.BIGINT:
      setLong(parameterIndex,((Long)x).longValue());
      break;
    case Types.REAL:
      setFloat(parameterIndex,((Float)x).floatValue());
      break;
    case Types.FLOAT:
    case Types.DOUBLE:
      setDouble(parameterIndex,((Double)x).doubleValue());
      break;
    case Types.NUMERIC:
      setBigDecimal(parameterIndex,(BigDecimal)x);
      break;
    case Types.CHAR:
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
      setString(parameterIndex,(String)x);
      break;
    case Types.DATE:
      setDate(parameterIndex,(java.sql.Date)x);
      break;
    case Types.TIME:
      setTime(parameterIndex,(Time)x);
      break;
    case Types.TIMESTAMP:
      setTimestamp(parameterIndex,(Timestamp)x);
      break;
    case Types.BINARY:
    case Types.VARBINARY:
    case Types.LONGVARBINARY:
      setBytes(parameterIndex,(byte[])x);
      break;
    case Types.OTHER:
      setParameter(parameterIndex,"'"+ByteArray.serializeToString(x)+"'");
      break;
    default:
      setParameter(parameterIndex,x.toString());
      break;
    }
  }
  private SQLException getNotSupported() {
    return Trace.error(Trace.FUNCTION_NOT_SUPPORTED);
  }

}

⌨️ 快捷键说明

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