📄 embedresultset.java
字号:
* @return the column value; if the value is SQL NULL, the result is 0 * @exception SQLException thrown on failure. */ public final byte getByte(String columnName) throws SQLException { return (getByte(findColumnName(columnName))); } /** * Get the value of a column in the current row as a Java short. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 * @exception SQLException thrown on failure. */ public final short getShort(String columnName) throws SQLException { return (getShort(findColumnName(columnName))); } /** * Get the value of a column in the current row as a Java int. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 * @exception SQLException thrown on failure. */ public final int getInt(String columnName) throws SQLException { return (getInt(findColumnName(columnName))); } /** * Get the value of a column in the current row as a Java long. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 * @exception SQLException thrown on failure. */ public final long getLong(String columnName) throws SQLException { return (getLong(findColumnName(columnName))); } /** * Get the value of a column in the current row as a Java float. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 * @exception SQLException thrown on failure. */ public final float getFloat(String columnName) throws SQLException { return (getFloat(findColumnName(columnName))); } /** * Get the value of a column in the current row as a Java double. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 * @exception SQLException thrown on failure. */ public final double getDouble(String columnName) throws SQLException { return (getDouble(findColumnName(columnName))); } /** * Get the value of a column in the current row as a Java byte array. * The bytes represent the raw values returned by the driver. * * @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 byte[] getBytes(String columnName) throws SQLException { return (getBytes(findColumnName(columnName))); } /** * Get the value of a column in the current row as a java.sql.Date object. * * @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 Date getDate(String columnName) throws SQLException { return (getDate(findColumnName(columnName))); } /** * Get the value of a column in the current row as a java.sql.Time object. * * @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 Time getTime(String columnName) throws SQLException { return (getTime(findColumnName(columnName))); } /** * Get the value of a column in the current row as a java.sql.Timestamp object. * * @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 Timestamp getTimestamp(String columnName) throws SQLException { return (getTimestamp(findColumnName(columnName))); } /** * JDBC 2.0 * * <p>Get the value of a column in the current row as a java.io.Reader. * * @exception SQLException Feature not implemented for now. */ public final java.io.Reader getCharacterStream(String columnName) throws SQLException { return (getCharacterStream(findColumnName(columnName))); } /** * A column value can be retrieved as a stream of ASCII characters * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARCHAR values. The JDBC driver will * do any necessary conversion from the database format into ASCII. * * <P><B>Note:</B> All the data in the returned stream must * be read prior to getting the value of any other column. The * next call to a get method implicitly closes the stream. * * @param columnName is the SQL name of the column * @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(String columnName) throws SQLException { return (getAsciiStream(findColumnName(columnName))); } /** * A column value can be retrieved as a stream of uninterpreted bytes * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARBINARY values. * * <P><B>Note:</B> All the data in the returned stream must * be read prior to getting the value of any other column. The * next call to a get method implicitly closes the stream. * * @param columnName is the SQL name of the column * @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(String columnName) throws SQLException { return (getBinaryStream(findColumnName(columnName))); } /** * JDBC 3.0 * * Retrieves the value of the designated column in the current row of this * ResultSet object as a java.net.URL object in the Java programming * language. * * @param columnIndex - * the first column is 1, the second is 2 * @return the column value as a java.net.URL object, if the value is SQL * NULL, the value returned is null in the Java programming language * @exception SQLException * Feature not implemented for now. */ public URL getURL(int columnIndex) throws SQLException { throw Util.notImplemented(); } /** * JDBC 3.0 * * Retrieves the value of the designated column in the current row of this * ResultSet object as a java.net.URL object in the Java programming * language. * * @param columnName - * the SQL name of the column * @return the column value as a java.net.URL object, if the value is SQL * NULL, the value returned is null in the Java programming language * @exception SQLException * Feature not implemented for now. */ public URL getURL(String columnName) throws SQLException { throw Util.notImplemented(); } //===================================================================== // Advanced features: //===================================================================== /** * <p>The first warning reported by calls on this ResultSet is * returned. Subsequent ResultSet warnings will be chained to this * SQLWarning. * * <P>The warning chain is automatically cleared each time a new * row is read. * * <P><B>Note:</B> This warning chain only covers warnings caused * by ResultSet methods. Any warning caused by statement methods * (such as reading OUT parameters) will be chained on the * Statement object. * * @return the first SQLWarning or null * * @exception SQLException Thrown if this ResultSet is closed */ public final SQLWarning getWarnings() throws SQLException { checkIfClosed("getWarnings"); return topWarning; } /** * After this call getWarnings returns null until a new warning is * reported for this ResultSet. * * @exception SQLException Thrown if this ResultSet is closed */ public final void clearWarnings() throws SQLException { checkIfClosed("clearWarnings"); topWarning = null; } /** * Get the name of the SQL cursor used by this ResultSet. * * <P>In SQL, a result table is retrieved through a cursor that is * named. The current row of a result can be updated or deleted * using a positioned update/delete statement that references the * cursor name. * * <P>JDBC supports this SQL feature by providing the name of the * SQL cursor used by a ResultSet. The current row of a ResultSet * is also the current row of this SQL cursor. * * <P><B>Note:</B> If positioned update is not supported a * SQLException is thrown * * @return the ResultSet's SQL cursor name * @exception SQLException thrown on failure. */ public final String getCursorName() throws SQLException { checkIfClosed("getCursorName"); // checking result set closure does not depend // on the underlying connection. Do this // outside of the connection synchronization. return theResults.getCursorName(); } /** * The number, types and properties of a ResultSet's columns * are provided by the getMetaData method. * * @return the description of a ResultSet's columns * @exception SQLException thrown on failure. */ public ResultSetMetaData getMetaData() throws SQLException { checkIfClosed("getMetaData"); // checking result set closure does not depend // on the underlying connection. Do this // outside of the connection synchronization. synchronized (getConnectionSynchronization()) { if (rMetaData == null) { // cache this object and keep returning it rMetaData = newEmbedResultSetMetaData(resultDescription); } return rMetaData; } } /** * <p>Get the value of a column in the current row as a Java object. * * <p>This method will return the value of the given column as a * Java object. The type of the Java object will be the default * Java Object type corresponding to the column's SQL type, * following the mapping specified in the JDBC spec. * * <p>This method may also be used to read datatabase specific abstract * data types. * * JDBC 2.0 * * New behavior for getObject(). * The behavior of method getObject() is extended to materialize * data of SQL user-defined types. When the column @columnIndex is * a structured or distinct value, the behavior of this method is as * if it were a call to: getObject(columnIndex, * this.getStatement().getConnection().getTypeMap()). * * @param columnIndex the first column is 1, the second is 2, ... * @return A java.lang.Object holding the column value. * @exception SQLException thrown on failure. */ public final Object getObject(int columnIndex) throws SQLException { // need special handling for some types. int colType = getColumnType(columnIndex); switch (colType) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: // handles maxfield size correctly return getString(columnIndex); case Types.CLOB: return getClob(columnIndex); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: // handles maxfield size correctly return getBytes(columnIndex); case Types.BLOB: return getBlob(columnIndex); default: break; } try { DataValueDescriptor dvd = getColumn(columnIndex); if (wasNull = dvd.isNull()) return null; return dvd.getObject(); } catch (StandardException t) { throw noStateChangeException(t); } } /** * <p>Get the value of a column in the current row as a Java object. * * <p>This method will return the value of the given column as a * Java object. The type of the Java object will be the default * Java Object type corresponding to the column's SQL type, * following the mapping specified in the JDBC spec. * * <p>This method may also be used to read datatabase specific abstract * data types. * * JDBC 2.0 * * New behavior for getObject(). * The behavior of method getObject() is extended to materialize * data of SQL user-defined types. When the column @columnName is * a structured or distinct value, the behavior of this method is as * if it were a call to: getObject(columnName, * this.getStatement().getConnection().getTypeMap()). * * @param columnName is the SQL name of the column * @return A java.lang.Object holding the column value. * @exception SQLException thrown on failure. */ public final Object getObject(String columnName) throws SQLException { return (getObject(findColumnName(columnName))); } //---------------------------------------------------------------- /** * Map a Resultset column name to a ResultSet column index. * * @param columnName the name of the column * @return the column index * @exception SQLException thrown on failure. */ public final int findColumn(String columnName) throws SQLException { checkIfClosed("findColumn"); return findColumnName(columnName); } ///////////////////////////////////////////////////////////////////////// // // JDBC 2.0 - New public methods // ///////////////////////////////////////////////////////////////////////// //--------------------------------------------------------------------- // Getter's and Setter's //--------------------------------------------------------------------- /** * JDBC 2.0 * * Return the Statement that produced the ResultSet. * * @return the Statment that produced the result set, or null if the result * was produced some other way. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -