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

📄 preparedstatement_base.java

📁 Java写的TDS协议(JDBC/ODBC)实现
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     *@exception  SQLException  if a database-access error occurs.
     */
    public void setObject( int parameterIndex, Object x, int targetSqlType, int scale )
             throws SQLException
    {
        if ( x == null ) {
            setParam( parameterIndex, x, targetSqlType, scale );
            return;
        }
        else {
            switch ( targetSqlType ) {
                case java.sql.Types.CHAR:
                case java.sql.Types.VARCHAR:
                    setString( parameterIndex, ( String ) x );
                    break;
                case java.sql.Types.REAL:
                    setFloat( parameterIndex, ( ( Float ) x ).floatValue() );
                    break;
                case java.sql.Types.DOUBLE:
                    setDouble( parameterIndex, ( ( Double ) x ).doubleValue() );
                    break;
                case java.sql.Types.INTEGER:
                    setInt( parameterIndex, ( ( Integer ) x ).intValue() );
                    break;
                case java.sql.Types.BIGINT:
                    setLong( parameterIndex, ( ( Long ) x ).longValue() );
                    break;
                default:
                    setParam( parameterIndex, x, targetSqlType, scale );
            }
        }
    }


    /**
     *  Set a parameter to a Java short value. The driver converts this to a SQL
     *  SMALLINT value when it sends it to the database.
     *
     *@param  index    the first parameter is 1, the second is 2, ...
     *@param  value    the parameter value
     *@exception  SQLException  if a database-access error occurs.
     */
    public void setShort( int index, short value ) throws SQLException
    {
        setParam( index, new Integer( value ), java.sql.Types.SMALLINT, -1 );
    }


    /**
     *  Set a parameter to a Java String value. The driver converts this to a
     *  SQL VARCHAR or LONGVARCHAR value (depending on the arguments size
     *  relative to the driver's limits on VARCHARs) when it sends it to the
     *  database.
     *
     *@param  index    the first parameter is 1, the second is 2, ...
     *@param  str      the parameter value
     *@exception  SQLException  if a database-access error occurs.
     */
    public void setString( int index, String str ) throws SQLException
    {
        setParam(index, str, java.sql.Types.VARCHAR, str==null ? -1 : str.length());
    }


    /**
     *  Set a parameter to a java.sql.Time value. The driver converts this to a
     *  SQL TIME value when it sends it to the database.
     *
     *@param  parameterIndex    the first parameter is 1, the second is 2, ...
     *@param  value             the parameter value
     *@exception  SQLException  if a database-access error occurs.
     */
    public void setTime( int parameterIndex, java.sql.Time value )
        throws SQLException
    {
        setParam( parameterIndex, value, java.sql.Types.TIME, -1 );
    }


    /**
     *  Set a parameter to a java.sql.Timestamp value. The driver converts this
     *  to a SQL TIMESTAMP value when it sends it to the database.
     *
     *@param  index    the first parameter is 1, the second is 2, ...
     *@param  value    the parameter value
     *@exception  SQLException  if a database-access error occurs.
     */
    public void setTimestamp( int index, java.sql.Timestamp value )
             throws SQLException
    {
        setParam( index, value, java.sql.Types.TIMESTAMP, -1 );
    }


    /**
     *  When a very large UNICODE value is input to a LONGVARCHAR parameter, it
     *  may be more practical to send it via a java.io.InputStream. 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  x                 the java input stream which contains the UNICODE
     *      parameter value
     *@param  length            the number of bytes in the stream
     *@exception  SQLException  if a database-access error occurs.
     */
    public void setUnicodeStream( int parameterIndex, java.io.InputStream x, int length )
             throws SQLException
    {
        throw new SQLException( "Not implemented" );
    }


    //--------------------------JDBC 2.0-----------------------------

    /**
     *  JDBC 2.0 Adds a set of parameters to the batch.
     *
     *@exception  SQLException  if a database access error occurs
     *@see                      Statement#addBatch
     */
    public void addBatch() throws java.sql.SQLException
    {
        NotImplemented();
    }


    /**
     *  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
     */
    public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws java.sql.SQLException
    {
        NotImplemented();
    }


    /**
     *  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
     */
    public void setRef( int i, java.sql.Ref x ) throws java.sql.SQLException
    {
        NotImplemented();
    }


    /**
     *  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
     */
    public void setBlob( int i, java.sql.Blob x ) throws java.sql.SQLException
    {
        NotImplemented();
    }


    /**
     *  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
     */
    public void setClob( int i, java.sql.Clob x ) throws java.sql.SQLException
    {
        NotImplemented();
    }


    /**
     *  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
     */
    public void setArray( int i, java.sql.Array x ) throws java.sql.SQLException
    {
        NotImplemented();
    }


    /**
     *  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
     */
    public java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLException
    {
        NotImplemented();
        return null;
    }


    /**
     *  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
     */
    public void setDate( int parameterIndex, java.sql.Date x, java.util.Calendar cal )
             throws java.sql.SQLException
    {
        NotImplemented();
    }


    /**
     *  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
     */
    public void setTime( int parameterIndex, java.sql.Time x, java.util.Calendar cal )
             throws java.sql.SQLException
    {
        NotImplemented();
    }


    /**
     *  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
     */
    public void setTimestamp( int parameterIndex,
            java.sql.Timestamp x,
            java.util.Calendar cal )
             throws java.sql.SQLException
    {
        NotImplemented();
    }


    /**
     *  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  paramIndex        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
     */
    public void setNull( int paramIndex, int sqlType, String typeName )
             throws java.sql.SQLException
    {
        NotImplemented();
    }

    public java.sql.ParameterMetaData getParameterMetaData() throws java.sql.SQLException
    {
        NotImplemented();
        return null;
    }

    public void setURL(int param, java.net.URL url) throws java.sql.SQLException
    {
        NotImplemented();
    }

}

⌨️ 快捷键说明

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