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

📄 embedresultset.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     * @param columnIndex the first column is 1, the second is 2, ...     * @return the column value; if the value is SQL NULL, the result is null	 * @exception SQLException thrown on failure.     */    public final Date getDate(int columnIndex) throws SQLException {        return getDate( columnIndex, (Calendar) null);	}    /**     * Get the value of a column in the current row as a java.sql.Time object.     *     * @param columnIndex the first column is 1, the second is 2, ...     * @return the column value; if the value is SQL NULL, the result is null	 * @exception SQLException thrown on failure.     */    public final Time getTime(int columnIndex) throws SQLException {        return getTime( columnIndex, (Calendar) null);	}    /**     * Get the value of a column in the current row as a java.sql.Timestamp object.     *     * @param columnIndex the first column is 1, the second is 2, ...     * @return the column value; if the value is SQL NULL, the result is null	 * @exception SQLException thrown on failure.     */    public final Timestamp getTimestamp(int columnIndex) throws SQLException {        return getTimestamp( columnIndex, (Calendar) null);	}    /**     * JDBC 2.0     *     * Get the value of a column in the current row as a java.sql.Date      * object.  Use the calendar to construct an appropriate millisecond     * value for the Date, if the underlying database doesn't store     * timezone information.     *     * @param columnIndex the first column is 1, the second is 2, ...     * @param cal the calendar to use in constructing the date     * @return the column value; if the value is SQL NULL, the result is null     * @exception SQLException if a database-access error occurs.     */    public java.sql.Date getDate(int columnIndex, Calendar cal)        throws SQLException     {		try {			DataValueDescriptor dvd = getColumn(columnIndex);			if (wasNull = dvd.isNull())				return null;            if( cal == null)                cal = getCal();            			return dvd.getDate( cal);		} catch (StandardException t) {			throw noStateChangeException(t);		}    }    /**     * JDBC 2.0     *     * Get the value of a column in the current row as a java.sql.Date      * object. Use the calendar to construct an appropriate millisecond     * value for the Date, if the underlying database doesn't store     * timezone information.     *     * @param columnName is the SQL name of the column     * @param cal the calendar to use in constructing the date     * @return the column value; if the value is SQL NULL, the result is null     * @exception SQLException if a database-access error occurs.     */    public java.sql.Date getDate(String columnName, Calendar cal)                 throws SQLException         {                return getDate( findColumnName(columnName), cal);        }    /**     * JDBC 2.0     *     * Get the value of a column in the current row as a java.sql.Time      * object. Use the calendar to construct an appropriate millisecond     * value for the Time, if the underlying database doesn't store     * timezone information.     *     * @param columnIndex the first column is 1, the second is 2, ...     * @param cal the calendar to use in constructing the time     * @return the column value; if the value is SQL NULL, the result is null     * @exception SQLException if a database-access error occurs.     */    public java.sql.Time getTime(int columnIndex, Calendar cal)        throws SQLException     {		try {			DataValueDescriptor dvd = getColumn(columnIndex);			if (wasNull = dvd.isNull())				return null;            if( cal == null)                cal = getCal();			return dvd.getTime( cal);		} catch (StandardException t) {			throw noStateChangeException(t);		}    }    /**     * JDBC 2.0     *     * Get the value of a column in the current row as a java.sql.Time      * object. Use the calendar to construct an appropriate millisecond     * value for the Time, if the underlying database doesn't store     * timezone information.     *     * @param columnName is the SQL name of the column     * @param cal the calendar to use in constructing the time     * @return the column value; if the value is SQL NULL, the result is null     * @exception SQLException if a database-access error occurs.     */    public java.sql.Time getTime(String columnName, Calendar cal)           throws SQLException         {                return getTime( findColumnName( columnName), cal);        }    /**     * JDBC 2.0     *     * Get the value of a column in the current row as a java.sql.Timestamp      * object. Use the calendar to construct an appropriate millisecond     * value for the Timestamp, if the underlying database doesn't store     * timezone information.     *     * @param columnName is the SQL name of the column     * @param cal the calendar to use in constructing the timestamp     * @return the column value; if the value is SQL NULL, the result is null     * @exception SQLException if a database-access error occurs.     */    public java.sql.Timestamp getTimestamp(String columnName, Calendar cal)           throws SQLException         {                return getTimestamp(findColumnName(columnName), cal);        }    /**     * JDBC 2.0     *     * Get the value of a column in the current row as a java.sql.Timestamp      * object. Use the calendar to construct an appropriate millisecond     * value for the Timestamp, if the underlying database doesn't store     * timezone information.     *     * @param columnIndex the first column is 1, the second is 2, ...     * @param cal the calendar to use in constructing the timestamp     * @return the column value; if the value is SQL NULL, the result is null     * @exception SQLException if a database-access error occurs.     */    public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal)         throws SQLException     {		try {			DataValueDescriptor dvd = getColumn(columnIndex);			if (wasNull = dvd.isNull())				return null;            if( cal == null)                cal = getCal();			return dvd.getTimestamp( cal);		} catch (StandardException t) {			throw noStateChangeException(t);		}    }	/**     * JDBC 2.0     *     * <p>Get the value of a column in the current row as a java.io.Reader.     *     * @exception SQLException database error.     */    public final java.io.Reader getCharacterStream(int columnIndex)		throws SQLException	{		int lmfs;		int colType = getColumnType(columnIndex);		switch (colType) {		case Types.CHAR:		case Types.VARCHAR:		case Types.LONGVARCHAR:			lmfs = maxFieldSize;			break;		case Types.CLOB: // Embedded and JCC extension - CLOB is not subject to max field size.			lmfs = 0;			break;		// JDBC says to support these, but no defintion exists for the output.		// match JCC which treats the bytes as a UTF16-BE stream		case Types.BINARY:		case Types.VARBINARY:		case Types.LONGVARBINARY:		case Types.BLOB:			try {				java.io.InputStream is = getBinaryStream(columnIndex);				if (is == null)					return null;				java.io.Reader r = new java.io.InputStreamReader(is, "UTF-16BE");				currentStream = r;				return r;			} catch (java.io.UnsupportedEncodingException uee) {				throw new SQLException(uee.getMessage());			}		default:			throw dataTypeConversion("java.io.Reader", columnIndex);		}		Object syncLock = getConnectionSynchronization();		synchronized (syncLock) {		boolean pushStack = false;		try {			DataValueDescriptor dvd = getColumn(columnIndex);			if (wasNull = dvd.isNull()) { return null; }			pushStack = true;			setupContextStack();			StreamStorable ss = (StreamStorable) dvd;			InputStream stream = ss.returnStream();			if (stream == null) {				String val = dvd.getString();				if (lmfs > 0) {					if (val.length() > lmfs)						val = val.substring(0, lmfs);				}				java.io.Reader ret = new java.io.StringReader(val);				currentStream = ret;				return ret;			}			java.io.Reader ret = new UTF8Reader(stream, lmfs, this, syncLock);			currentStream = ret;			return ret;		} catch (Throwable t) {			throw noStateChangeException(t);		} finally {			if (pushStack) { restoreContextStack(); }		}	  }     }    /**		Pushes a converter on top of getCharacterStream().	 *     * @param columnIndex the first column is 1, the second is 2, ...     * @return a Java input stream that delivers the database column value     * as a stream of one byte ASCII characters.  If the value is SQL NULL     * then the result is null.	 * @exception SQLException thrown on failure.     */    public final InputStream getAsciiStream(int columnIndex) throws SQLException {		int colType = getColumnType(columnIndex);		switch (colType) {		case Types.CHAR:		case Types.VARCHAR:		case Types.LONGVARCHAR:		case Types.CLOB: // Embedded and JCC extension			break;		// JDBC says to support these, we match JCC by returning the raw bytes.		case Types.BINARY:		case Types.VARBINARY:		case Types.LONGVARBINARY:		case Types.BLOB:			return getBinaryStream(columnIndex);		default:			throw dataTypeConversion("java.io.InputStream(ASCII)", columnIndex);		}		java.io.Reader reader = getCharacterStream(columnIndex);		if (reader == null)			return null;		return new ReaderToAscii(reader);	}    /**	 * Get the column as an InputStream. If the column is already of type	   InputStream then just return it, otherwise convert the column to a set	   of bytes and create a stream out of the bytes.     *     * @param columnIndex the first column is 1, the second is 2, ...     * @return a Java input stream that delivers the database column value     * as a stream of uninterpreted bytes.  If the value is SQL NULL     * then the result is null.	 * @exception SQLException thrown on failure.     */    public final InputStream getBinaryStream(int columnIndex) throws SQLException {		int lmfs;		int colType = getColumnType(columnIndex);		switch (colType) {		case Types.BINARY:		case Types.VARBINARY:		case Types.LONGVARBINARY:			lmfs = maxFieldSize;			break;		case Types.BLOB:			lmfs = 0;			break;		default:			throw dataTypeConversion("java.io.InputStream", columnIndex);		}		Object syncLock = getConnectionSynchronization();		synchronized (syncLock) {		boolean pushStack = false;		try {			DataValueDescriptor dvd = getColumn(columnIndex);			if (wasNull = dvd.isNull()) { return null; }			pushStack = true;			setupContextStack();			StreamStorable ss = (StreamStorable) dvd;			InputStream stream = ss.returnStream();			if (stream == null)			{				stream = new NewByteArrayInputStream(dvd.getBytes());			} else			{				stream = new BinaryToRawStream(stream, dvd);			}            if (lmfs > 0)            {                // Just wrap the InputStream with a LimitInputStream class                LimitInputStream  limitResultIn = new  LimitInputStream(stream);                limitResultIn.setLimit(lmfs);                stream = limitResultIn;            }			currentStream = stream;			return stream;		} catch (Throwable t) {			throw noStateChangeException(t);		} finally {			if (pushStack) { restoreContextStack(); }		}	  }	}    //======================================================================    // Methods for accessing results by column name    //======================================================================    /**     * Get the value of a column in the current row as a Java String.     *     * @param columnName is the SQL name of the column     * @return the column value; if the value is SQL NULL, the result is null	 * @exception SQLException thrown on failure.     */    public final String getString(String columnName) throws SQLException {    	return (getString(findColumnName(columnName)));	}    /**     * Get the value of a column in the current row as a Java boolean.     *     * @param columnName is the SQL name of the column     * @return the column value; if the value is SQL NULL, the result is false	 * @exception SQLException thrown on failure.     */    public final boolean getBoolean(String columnName) throws SQLException {    	return (getBoolean(findColumnName(columnName)));	}    /**     * Get the value of a column in the current row as a Java byte.     *     * @param columnName is the SQL name of the column

⌨️ 快捷键说明

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