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

📄 sqloutputimpl.java

📁 JAVA的一些源码 JAVA2 STANDARD EDITION DEVELOPMENT KIT 5.0
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     *        values of a UDT to the database.     */    public void writeTimestamp(java.sql.Timestamp x) throws SQLException {        attribs.add(x);    }    /**     * Writes a stream of Unicode characters to this     * <code>SQLOutputImpl</code> object. The driver will do any necessary     * conversion from Unicode to the database <code>CHAR</code> format.     *     * @param x the value to pass to the database                * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeCharacterStream(java.io.Reader x) throws SQLException {         BufferedReader bufReader = new BufferedReader(x);         try {             int i;             while( (i = bufReader.read()) != -1 ) {                char ch = (char)i;		StringBuffer strBuf = new StringBuffer();		strBuf.append(ch);				String str = new String(strBuf);                                String strLine = bufReader.readLine();                                writeString(str.concat(strLine));             }            } catch(IOException ioe) {                  }    }    /**     * Writes a stream of ASCII characters to this     * <code>SQLOutputImpl</code> object. The driver will do any necessary     * conversion from ASCII to the database <code>CHAR</code> format.     *     * @param x the value to pass to the database     * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeAsciiStream(java.io.InputStream x) throws SQLException {         BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));         try {               int i;               while( (i=bufReader.read()) != -1 ) {                char ch = (char)i;               		StringBuffer strBuf = new StringBuffer();		strBuf.append(ch);				String str = new String(strBuf);                                String strLine = bufReader.readLine();                                writeString(str.concat(strLine));            }          }catch(IOException ioe) {            throw new SQLException(ioe.getMessage());        }    }    /**     * Writes a stream of uninterpreted bytes to this <code>SQLOutputImpl</code>     * object.     *     * @param x the value to pass to the database     * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeBinaryStream(java.io.InputStream x) throws SQLException {         BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));         try {               int i;             while( (i=bufReader.read()) != -1 ) {                char ch = (char)i;               		StringBuffer strBuf = new StringBuffer();		strBuf.append(ch);				String str = new String(strBuf);                                String strLine = bufReader.readLine();                                writeString(str.concat(strLine));             }        } catch(IOException ioe) {            throw new SQLException(ioe.getMessage());        }    }        //================================================================    // Methods for writing items of SQL user-defined types to the stream.    // These methods pass objects to the database as values of SQL    // Structured Types, Distinct Types, Constructed Types, and Locator    // Types.  They decompose the Java object(s) and write leaf data    // items using the methods above.    //================================================================    /**     * Writes to the stream the data contained in the given      * <code>SQLData</code> object.     * When the <code>SQLData</code> object is <code>null</code>, this     * method writes an SQL <code>NULL</code> to the stream.       * Otherwise, it calls the <code>SQLData.writeSQL</code>     * method of the given object, which      * writes the object's attributes to the stream.     * <P>     * The implementation of the method <code>SQLData.writeSQ</code>     * calls the appropriate <code>SQLOutputImpl.writeXXX</code> method(s)     * for writing each of the object's attributes in order.     * The attributes must be read from an <code>SQLInput</code>     * input stream and written to an <code>SQLOutputImpl</code>     * output stream in the same order in which they were     * listed in the SQL definition of the user-defined type.     *      * @param x the object representing data of an SQL structured or     *          distinct type     * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeObject(SQLData x) throws SQLException {                /*         * Except for the types that are passed as objects         * this seems to be the only way for an object to         * get a null value for a field in a structure.         *         * Note: this means that the class defining SQLData          * will need to track if a field is SQL null for itself         */        if (x == null) {            attribs.add(x);            return;        }                /*          * We have to write out a SerialStruct that contains         * the name of this class otherwise we don't know         * what to re-instantiate during readSQL()         */        attribs.add(new SerialStruct((SQLData)x, map));    }    /**     * Writes a <code>Ref</code> object in the Java programming language     * to this <code>SQLOutputImpl</code> object.  The driver converts     * it to a serializable <code>SerialRef</code> SQL <code>REF</code> value      * before returning it to the database.     *     * @param x an object representing an SQL <code>REF</code> value     * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeRef(Ref x) throws SQLException {        if (x == null) {            attribs.add(x);            return;        }        attribs.add(new SerialRef(x));    }    /**     * Writes a <code>Blob</code> object in the Java programming language     * to this <code>SQLOutputImpl</code> object.  The driver converts     * it to a serializable <code>SerialBlob</code> SQL <code>BLOB</code> value      * before returning it to the database.     *     * @param x an object representing an SQL <code>BLOB</code> value     * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeBlob(Blob x) throws SQLException {        if (x == null) {            attribs.add(x);            return;        }        attribs.add(new SerialBlob(x));    }        /**     * Writes a <code>Clob</code> object in the Java programming language     * to this <code>SQLOutputImpl</code> object.  The driver converts     * it to a serializable <code>SerialClob</code> SQL <code>CLOB</code> value      * before returning it to the database.     *     * @param x an object representing an SQL <code>CLOB</code> value     * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeClob(Clob x) throws SQLException {        if (x == null) {            attribs.add(x);            return;        }        attribs.add(new SerialClob(x));    }    /**     * Writes a <code>Struct</code> object in the Java     * programming language to this <code>SQLOutputImpl</code>     * object. The driver converts this value to an SQL structured type     * before returning it to the database.     * <P>     * This method should be used when an SQL structured type has been     * mapped to a <code>Struct</code> object in the Java programming     * language (the standard mapping).  The method      * <code>writeObject</code> should be used if an SQL structured type     * has been custom mapped to a class in the Java programming language.     *     * @param x an object representing the attributes of an SQL structured type               * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeStruct(Struct x) throws SQLException {        SerialStruct s = new SerialStruct(x,map);;        attribs.add(s);            }        /**     * Writes an <code>Array</code> object in the Java     * programming language to this <code>SQLOutputImpl</code>     * object. The driver converts this value to a serializable      * <code>SerialArray</code> SQL <code>ARRAY</code>     * value before returning it to the database.     *     * @param x an object representing an SQL <code>ARRAY</code> value     * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeArray(Array x) throws SQLException {        if (x == null) {            attribs.add(x);            return;        }        attribs.add(new SerialArray(x, map));    }    /**     * Writes an <code>java.sql.Type.DATALINK</code> object in the Java      * programming language to this <code>SQLOutputImpl</code> object. The     * driver converts this value to a serializable <code>SerialDatalink</code>     * SQL <code>DATALINK</code> value before return it to the database.     *          * @param url an object representing a SQL <code>DATALINK</code> value     * @throws SQLException if the <code>SQLOutputImpl</code> object is in     *        use by a <code>SQLData</code> object attempting to write the attribute     *        values of a UDT to the database.     */    public void writeURL(java.net.URL url) throws SQLException {        if (url == null) {            attribs.add(url);            return;        }        attribs.add(new SerialDatalink(url));            }}

⌨️ 快捷键说明

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