md.setColumnName(col, rsmd.getColumnName(col)); md.setSchemaName(col, rsmd.getSchemaName(col)); md.setPrecision(col, rsmd.getPrecision(col)); md.setScale(col, rsmd.getScale(col)); md.setTableName(col, rsmd.getTableName(col)); md.setCatalogName(col, rsmd.getCatalogName(col)); md.setColumnType(col, rsmd.getColumnType(col)); md.setColumnTypeName(col, rsmd.getColumnTypeName(col)); } } protected void checkState() throws SQLException { // If all the three i.e. conn, ps & rs are // simultaneously null implies we are not connected // to the db, implies undesirable state so throw exception if (conn == null && ps == null && rs == null ) { throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.invalstate").toString()); } } //--------------------------------------------------------------------- // Reading and writing data //--------------------------------------------------------------------- /** * Creates the internal <code>ResultSet</code> object for which this * <code>JdbcRowSet</code> object is a wrapper, effectively * making the result set a JavaBeans component. * <P> * Certain properties must have been set before this method is called * so that it can establish a connection to a database and execute the * query that will create the result set. If a <code>DataSource</code> * object will be used to create the connection, properties for the * data source name, user name, and password must be set. If the * <code>DriverManager</code> will be used, the properties for the * URL, user name, and password must be set. In either case, the * property for the command must be set. If the command has placeholder * parameters, those must also be set. This method throws * an exception if the required properties are not set. * <P> * Other properties have default values that may optionally be set * to new values. The <code>execute</code> method will use the value * for the command property to create a <code>PreparedStatement</code> * object and set its properties (escape processing, maximum field * size, maximum number of rows, and query timeout limit) to be those * of this rowset. * * @throws SQLException if (1) a database access error occurs, * (2) any required JDBC properties are not set, or (3) if an * invalid connection exists. */ public void execute() throws SQLException { /* * To execute based on the properties: * i) determine how to get a connection * ii) prepare the statement * iii) set the properties of the statement * iv) parse the params. and set them * v) execute the statement * * During all of this try to tolerate as many errors * as possible, many drivers will not support all of * the properties and will/should throw SQLException * at us... * */ prepare(); // set the properties of our shiny new statement setProperties(ps); // set the parameters decodeParams(getParams(), ps); // execute the statement rs = ps.executeQuery(); // notify listeners notifyRowSetChanged(); } protected void setProperties(PreparedStatement ps) throws SQLException { try { ps.setEscapeProcessing(getEscapeProcessing()); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setescapeprocessing").toString() + ex.getLocalizedMessage()); } try { ps.setMaxFieldSize(getMaxFieldSize()); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setmaxfieldsize").toString() + ex.getLocalizedMessage()); } try { ps.setMaxRows(getMaxRows()); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setmaxrows").toString() + ex.getLocalizedMessage()); } try { ps.setQueryTimeout(getQueryTimeout()); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setquerytimeout").toString() + ex.getLocalizedMessage()); } } // An alternate solution is required instead of having the // connect method as protected. // This is a work around to assist Rave Team // :ah protected Connection connect() throws SQLException { // Get a JDBC connection. // First check for Connection handle object as such if // "this" initialized using conn. if(conn != null) { return conn; } else if (getDataSourceName() != null) { // Connect using JNDI. try { Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup (getDataSourceName()); //return ds.getConnection(getUsername(),getPassword()); if(getUsername() != null && !getUsername().equals("")) { return ds.getConnection(getUsername(),getPassword()); } else { return ds.getConnection(); } } catch (javax.naming.NamingException ex) { throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.connect").toString()); } } else if (getUrl() != null) { // Check only for getUrl() != null because // user, passwd can be null // Connect using the driver manager. return DriverManager.getConnection (getUrl(), getUsername(), getPassword()); } else { return null; } } protected PreparedStatement prepare() throws SQLException { // get a connection conn = connect(); try { Map<String, Class<?>> aMap = getTypeMap(); if( aMap != null) { conn.setTypeMap(aMap); } ps = conn.prepareStatement(getCommand(),ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.prepare").toString() + ex.getLocalizedMessage()); if (ps != null) ps.close(); if (conn != null) conn.close(); throw new SQLException(ex.getMessage()); } return ps; } private void decodeParams(Object[] params, PreparedStatement ps) throws SQLException { // There is a corresponding decodeParams in JdbcRowSetImpl // which does the same as this method. This is a design flaw. // Update the CachedRowsetReader.decodeParams when you update // this method. // Adding the same comments to CachedRowsetReader.decodeParams. int arraySize; Object[] param = null; for (int i=0; i < params.length; i++) { if (params[i] instanceof Object[]) { param = (Object[])params[i]; if (param.length == 2) { if (param[0] == null) { ps.setNull(i + 1, ((Integer)param[1]).intValue()); continue; } if (param[0] instanceof java.sql.Date || param[0] instanceof java.sql.Time || param[0] instanceof java.sql.Timestamp) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.detecteddate")); if (param[1] instanceof java.util.Calendar) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.detectedcalendar")); ps.setDate(i + 1, (java.sql.Date)param[0], (java.util.Calendar)param[1]); continue; } else { throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); } } if (param[0] instanceof Reader) { ps.setCharacterStream(i + 1, (Reader)param[0], ((Integer)param[1]).intValue()); continue; } /* * What's left should be setObject(int, Object, scale) */ if (param[1] instanceof Integer) { ps.setObject(i + 1, param[0], ((Integer)param[1]).intValue()); continue; } } else if (param.length == 3) { if (param[0] == null) { ps.setNull(i + 1, ((Integer)param[1]).intValue(), (String)param[2]); continue; } if (param[0] instanceof java.io.InputStream) { switch (((Integer)param[2]).intValue()) { case JdbcRowSetImpl.UNICODE_STREAM_PARAM: ps.setUnicodeStream(i + 1, (java.io.InputStream)param[0], ((Integer)param[1]).intValue()); case JdbcRowSetImpl.BINARY_STREAM_PARAM: ps.setBinaryStream(i + 1, (java.io.InputStream)param[0], ((Integer)param[1]).intValue()); case JdbcRowSetImpl.ASCII_STREAM_PARAM: ps.setAsciiStream(i + 1, (java.io.InputStream)param[0], ((Integer)param[1]).intValue()); default: throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); } } /* * no point at looking at the first element now; * what's left must be the setObject() cases. */ if (param[1] instanceof Integer && param[2] instanceof Integer) { ps.setObject(i + 1, param[0], ((Integer)param[1]).intValue(), ((Integer)param[2]).intValue()); continue; } throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); } else { // common case - this catches all SQL92 types ps.setObject(i + 1, params[i]); continue; } } else { // Try to get all the params to be set here ps.setObject(i + 1, params[i]); } } } /** * Moves the cursor for this rowset's <code>ResultSet</code> * object down one row from its current position. * A <code>ResultSet</code> cursor is initially positioned * before the first row; the first call to the method * <code>next</code> makes the first row the current row; the * second call makes the second row the current row, and so on. * * <P>If an input stream is open for the current row, a call * to the method <code>next</code> will * implicitly close it. A <code>ResultSet</code> object's * warning chain is cleared when a new row is read. * * @return <code>true</code> if the new current row is valid; * <code>false</code> if there are no more rows * @throws SQLException if a database access error occurs * or this rowset does not currently have a valid connection, * prepared statement, and result set */ public boolean next() throws SQLException { checkState(); boolean b = rs.next(); notifyCursorMoved(); return b; } /** * Releases this rowset's <code>ResultSet</code> object's database and * JDBC resources immediately instead of waiting for * this to happen when it is automatically closed. * * <P><B>Note:</B> A <code>ResultSet</code> object * is automatically closed by the * <code>Statement</code> object that generated it when * that <code>Statement</code> object is closed, * re-executed, or is used to retrieve the next result from a * sequence of multiple results. A <code>ResultSet</code> object * is also automatically closed when it is garbage collected. * * @throws SQLException if a database access error occurs */ public void close() throws SQLException { if (rs != null) rs.close(); if (ps != null) ps.close(); if (conn != null) conn.close(); } /** * Reports whether the last column read from this rowset's * <code>ResultSet</code> object had a value of SQL <code>NULL</code>. * Note that you must first call one of the <code>getXXX</code> methods * on a column to try to read its value and then call * the method <code>wasNull</code> to see if the value read was * SQL <code>NULL</code>. * * @return <code>true</code> if the last column value read was SQL * <code>NULL</code> and <code>false</code> otherwise * @throws SQLException if a database access error occurs * or this rowset does not have a currently valid connection, * prepared statement, and result set */ public boolean wasNull() throws SQLException { checkState(); return rs.wasNull(); } //====================================================================== // Methods for accessing results by column index //====================================================================== /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>String</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>null</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not currently have a valid connection, * prepared statement, and result set */ public String getString(int columnIndex) throws SQLException { checkState(); return rs.getString(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>boolean</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>false</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public boolean getBoolean(int columnIndex) throws SQLException { checkState(); return rs.getBoolean(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>byte</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public byte getByte(int columnIndex) throws SQLException { checkState(); return rs.getByte(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>short</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public short getShort(int columnIndex) throws SQLException { checkState(); return rs.getShort(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * an <code>int</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public int getInt(int columnIndex) throws SQLException { checkState(); return rs.getInt(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>long</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public long getLong(int columnIndex) throws SQLException { checkState(); return rs.getLong(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>float</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public float getFloat(int columnIndex) throws SQLException { checkState(); return rs.getFloat(columnIndex);Lines 501–1000 of 7047. Previous lines Load more
md.setColumnName(col, rsmd.getColumnName(col)); md.setSchemaName(col, rsmd.getSchemaName(col)); md.setPrecision(col, rsmd.getPrecision(col)); md.setScale(col, rsmd.getScale(col)); md.setTableName(col, rsmd.getTableName(col)); md.setCatalogName(col, rsmd.getCatalogName(col)); md.setColumnType(col, rsmd.getColumnType(col)); md.setColumnTypeName(col, rsmd.getColumnTypeName(col)); } } protected void checkState() throws SQLException { // If all the three i.e. conn, ps & rs are // simultaneously null implies we are not connected // to the db, implies undesirable state so throw exception if (conn == null && ps == null && rs == null ) { throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.invalstate").toString()); } } //--------------------------------------------------------------------- // Reading and writing data //--------------------------------------------------------------------- /** * Creates the internal <code>ResultSet</code> object for which this * <code>JdbcRowSet</code> object is a wrapper, effectively * making the result set a JavaBeans component. * <P> * Certain properties must have been set before this method is called * so that it can establish a connection to a database and execute the * query that will create the result set. If a <code>DataSource</code> * object will be used to create the connection, properties for the * data source name, user name, and password must be set. If the * <code>DriverManager</code> will be used, the properties for the * URL, user name, and password must be set. In either case, the * property for the command must be set. If the command has placeholder * parameters, those must also be set. This method throws * an exception if the required properties are not set. * <P> * Other properties have default values that may optionally be set * to new values. The <code>execute</code> method will use the value * for the command property to create a <code>PreparedStatement</code> * object and set its properties (escape processing, maximum field * size, maximum number of rows, and query timeout limit) to be those * of this rowset. * * @throws SQLException if (1) a database access error occurs, * (2) any required JDBC properties are not set, or (3) if an * invalid connection exists. */ public void execute() throws SQLException { /* * To execute based on the properties: * i) determine how to get a connection * ii) prepare the statement * iii) set the properties of the statement * iv) parse the params. and set them * v) execute the statement * * During all of this try to tolerate as many errors * as possible, many drivers will not support all of * the properties and will/should throw SQLException * at us... * */ prepare(); // set the properties of our shiny new statement setProperties(ps); // set the parameters decodeParams(getParams(), ps); // execute the statement rs = ps.executeQuery(); // notify listeners notifyRowSetChanged(); } protected void setProperties(PreparedStatement ps) throws SQLException { try { ps.setEscapeProcessing(getEscapeProcessing()); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setescapeprocessing").toString() + ex.getLocalizedMessage()); } try { ps.setMaxFieldSize(getMaxFieldSize()); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setmaxfieldsize").toString() + ex.getLocalizedMessage()); } try { ps.setMaxRows(getMaxRows()); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setmaxrows").toString() + ex.getLocalizedMessage()); } try { ps.setQueryTimeout(getQueryTimeout()); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setquerytimeout").toString() + ex.getLocalizedMessage()); } } // An alternate solution is required instead of having the // connect method as protected. // This is a work around to assist Rave Team // :ah protected Connection connect() throws SQLException { // Get a JDBC connection. // First check for Connection handle object as such if // "this" initialized using conn. if(conn != null) { return conn; } else if (getDataSourceName() != null) { // Connect using JNDI. try { Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup (getDataSourceName()); //return ds.getConnection(getUsername(),getPassword()); if(getUsername() != null && !getUsername().equals("")) { return ds.getConnection(getUsername(),getPassword()); } else { return ds.getConnection(); } } catch (javax.naming.NamingException ex) { throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.connect").toString()); } } else if (getUrl() != null) { // Check only for getUrl() != null because // user, passwd can be null // Connect using the driver manager. return DriverManager.getConnection (getUrl(), getUsername(), getPassword()); } else { return null; } } protected PreparedStatement prepare() throws SQLException { // get a connection conn = connect(); try { Map<String, Class<?>> aMap = getTypeMap(); if( aMap != null) { conn.setTypeMap(aMap); } ps = conn.prepareStatement(getCommand(),ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); } catch (SQLException ex) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.prepare").toString() + ex.getLocalizedMessage()); if (ps != null) ps.close(); if (conn != null) conn.close(); throw new SQLException(ex.getMessage()); } return ps; } private void decodeParams(Object[] params, PreparedStatement ps) throws SQLException { // There is a corresponding decodeParams in JdbcRowSetImpl // which does the same as this method. This is a design flaw. // Update the CachedRowsetReader.decodeParams when you update // this method. // Adding the same comments to CachedRowsetReader.decodeParams. int arraySize; Object[] param = null; for (int i=0; i < params.length; i++) { if (params[i] instanceof Object[]) { param = (Object[])params[i]; if (param.length == 2) { if (param[0] == null) { ps.setNull(i + 1, ((Integer)param[1]).intValue()); continue; } if (param[0] instanceof java.sql.Date || param[0] instanceof java.sql.Time || param[0] instanceof java.sql.Timestamp) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.detecteddate")); if (param[1] instanceof java.util.Calendar) { System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.detectedcalendar")); ps.setDate(i + 1, (java.sql.Date)param[0], (java.util.Calendar)param[1]); continue; } else { throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); } } if (param[0] instanceof Reader) { ps.setCharacterStream(i + 1, (Reader)param[0], ((Integer)param[1]).intValue()); continue; } /* * What's left should be setObject(int, Object, scale) */ if (param[1] instanceof Integer) { ps.setObject(i + 1, param[0], ((Integer)param[1]).intValue()); continue; } } else if (param.length == 3) { if (param[0] == null) { ps.setNull(i + 1, ((Integer)param[1]).intValue(), (String)param[2]); continue; } if (param[0] instanceof java.io.InputStream) { switch (((Integer)param[2]).intValue()) { case JdbcRowSetImpl.UNICODE_STREAM_PARAM: ps.setUnicodeStream(i + 1, (java.io.InputStream)param[0], ((Integer)param[1]).intValue()); case JdbcRowSetImpl.BINARY_STREAM_PARAM: ps.setBinaryStream(i + 1, (java.io.InputStream)param[0], ((Integer)param[1]).intValue()); case JdbcRowSetImpl.ASCII_STREAM_PARAM: ps.setAsciiStream(i + 1, (java.io.InputStream)param[0], ((Integer)param[1]).intValue()); default: throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); } } /* * no point at looking at the first element now; * what's left must be the setObject() cases. */ if (param[1] instanceof Integer && param[2] instanceof Integer) { ps.setObject(i + 1, param[0], ((Integer)param[1]).intValue(), ((Integer)param[2]).intValue()); continue; } throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); } else { // common case - this catches all SQL92 types ps.setObject(i + 1, params[i]); continue; } } else { // Try to get all the params to be set here ps.setObject(i + 1, params[i]); } } } /** * Moves the cursor for this rowset's <code>ResultSet</code> * object down one row from its current position. * A <code>ResultSet</code> cursor is initially positioned * before the first row; the first call to the method * <code>next</code> makes the first row the current row; the * second call makes the second row the current row, and so on. * * <P>If an input stream is open for the current row, a call * to the method <code>next</code> will * implicitly close it. A <code>ResultSet</code> object's * warning chain is cleared when a new row is read. * * @return <code>true</code> if the new current row is valid; * <code>false</code> if there are no more rows * @throws SQLException if a database access error occurs * or this rowset does not currently have a valid connection, * prepared statement, and result set */ public boolean next() throws SQLException { checkState(); boolean b = rs.next(); notifyCursorMoved(); return b; } /** * Releases this rowset's <code>ResultSet</code> object's database and * JDBC resources immediately instead of waiting for * this to happen when it is automatically closed. * * <P><B>Note:</B> A <code>ResultSet</code> object * is automatically closed by the * <code>Statement</code> object that generated it when * that <code>Statement</code> object is closed, * re-executed, or is used to retrieve the next result from a * sequence of multiple results. A <code>ResultSet</code> object * is also automatically closed when it is garbage collected. * * @throws SQLException if a database access error occurs */ public void close() throws SQLException { if (rs != null) rs.close(); if (ps != null) ps.close(); if (conn != null) conn.close(); } /** * Reports whether the last column read from this rowset's * <code>ResultSet</code> object had a value of SQL <code>NULL</code>. * Note that you must first call one of the <code>getXXX</code> methods * on a column to try to read its value and then call * the method <code>wasNull</code> to see if the value read was * SQL <code>NULL</code>. * * @return <code>true</code> if the last column value read was SQL * <code>NULL</code> and <code>false</code> otherwise * @throws SQLException if a database access error occurs * or this rowset does not have a currently valid connection, * prepared statement, and result set */ public boolean wasNull() throws SQLException { checkState(); return rs.wasNull(); } //====================================================================== // Methods for accessing results by column index //====================================================================== /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>String</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>null</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not currently have a valid connection, * prepared statement, and result set */ public String getString(int columnIndex) throws SQLException { checkState(); return rs.getString(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>boolean</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>false</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public boolean getBoolean(int columnIndex) throws SQLException { checkState(); return rs.getBoolean(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>byte</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public byte getByte(int columnIndex) throws SQLException { checkState(); return rs.getByte(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>short</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public short getShort(int columnIndex) throws SQLException { checkState(); return rs.getShort(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * an <code>int</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public int getInt(int columnIndex) throws SQLException { checkState(); return rs.getInt(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>long</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public long getLong(int columnIndex) throws SQLException { checkState(); return rs.getLong(columnIndex); } /** * Gets the value of the designated column in the current row * of this rowset's <code>ResultSet</code> object as * a <code>float</code>. * * @param columnIndex the first column is 1, the second is 2, and so on * @return the column value; if the value is SQL <code>NULL</code>, the * value returned is <code>0</code> * @throws SQLException if (1) a database access error occurs * or (2) this rowset does not have a currently valid connection, * prepared statement, and result set */ public float getFloat(int columnIndex) throws SQLException { checkState(); return rs.getFloat(columnIndex);