if (isNumeric(trgType) == false && isString(trgType) == false) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType); } try { switch (trgType) { case java.sql.Types.BIT: Integer i = Integer.valueOf(srcObj.toString().trim()); return i.equals(Integer.valueOf((int)0)) ? Boolean.valueOf(false) : Boolean.valueOf(true); case java.sql.Types.TINYINT: return Byte.valueOf(srcObj.toString().trim()); case java.sql.Types.SMALLINT: return Short.valueOf(srcObj.toString().trim()); case java.sql.Types.INTEGER: return Integer.valueOf(srcObj.toString().trim()); case java.sql.Types.BIGINT: return Long.valueOf(srcObj.toString().trim()); case java.sql.Types.NUMERIC: case java.sql.Types.DECIMAL: return new BigDecimal(srcObj.toString().trim()); case java.sql.Types.REAL: case java.sql.Types.FLOAT: return new Float(srcObj.toString().trim()); case java.sql.Types.DOUBLE: return new Double(srcObj.toString().trim()); case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGVARCHAR: return srcObj.toString(); default: throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType); } } catch (NumberFormatException ex) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType); } } /** * Converts the given <code>Object</code> in the Java programming language * to the standard object mapping for the specified SQL target data type. * The conversion must be to a string or temporal type, and there are also * restrictions on the type to be converted. * <P> * <TABLE ALIGN="CENTER" BORDER CELLPADDING=10 BORDERCOLOR="#0000FF" * <CAPTION ALIGN="CENTER"><B>Parameters and Return Values</B></CAPTION> * <TR> * <TD><B>Source SQL Type</B> * <TD><B>Target SQL Type</B> * <TD><B>Object Returned</B> * </TR> * <TR> * <TD><code>TIMESTAMP</code> * <TD><code>DATE</code> * <TD><code>java.sql.Date</code> * </TR> * <TR> * <TD><code>TIMESTAMP</code> * <TD><code>TIME</code> * <TD><code>java.sql.Time</code> * </TR> * <TR> * <TD><code>TIME</code> * <TD><code>TIMESTAMP</code> * <TD><code>java.sql.Timestamp</code> * </TR> * <TR> * <TD><code>DATE</code>, <code>TIME</code>, or <code>TIMESTAMP</code> * <TD><code>CHAR</code>, <code>VARCHAR</code>, or <code>LONGVARCHAR</code> * <TD><code>java.lang.String</code> * </TR> * </TABLE> * <P> * If the source type and target type are the same, * the given object is simply returned. * * @param srcObj the <code>Object</code> in the Java programming language * that is to be converted to the target type * @param srcType the data type that is the standard mapping in SQL of the * object to be converted; must be one of the constants in * <code>java.sql.Types</code> * @param trgType the SQL data type to which to convert the given object; * must be one of the following constants in * <code>java.sql.Types</code>: <code>DATE</code>, * <code>TIME</code>, <code>TIMESTAMP</code>, <code>CHAR</code>, * <code>VARCHAR</code>, or <code>LONGVARCHAR</code> * @return an <code>Object</code> value.that is * the standard object mapping for the target SQL type * @throws SQLException if the given target type is not one of the string or * temporal types in <code>java.sql.Types</code> */ private Object convertTemporal(Object srcObj, int srcType, int trgType) throws SQLException { if (srcType == trgType) { return srcObj; } if (isNumeric(trgType) == true || (isString(trgType) == false && isTemporal(trgType) == false)) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } try { switch (trgType) { case java.sql.Types.DATE: if (srcType == java.sql.Types.TIMESTAMP) { return new java.sql.Date(((java.sql.Timestamp)srcObj).getTime()); } else { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } case java.sql.Types.TIMESTAMP: if (srcType == java.sql.Types.TIME) { return new Timestamp(((java.sql.Time)srcObj).getTime()); } else { return new Timestamp(((java.sql.Date)srcObj).getTime()); } case java.sql.Types.TIME: if (srcType == java.sql.Types.TIMESTAMP) { return new Time(((java.sql.Timestamp)srcObj).getTime()); } else { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGVARCHAR: return srcObj.toString(); default: throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } } catch (NumberFormatException ex) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } } /** * Converts the given <code>Object</code> in the Java programming language * to the standard mapping for the specified SQL target data type. * The conversion must be to a string or numeric type, but there are no * restrictions on the type to be converted. If the source type and target * type are the same, the given object is simply returned. * * @param srcObj the <code>Object</code> in the Java programming language * that is to be converted to the target type * @param srcType the data type that is the standard mapping in SQL of the * object to be converted; must be one of the constants in * <code>java.sql.Types</code> * @param trgType the SQL data type to which to convert the given object; * must be one of the following constants in * <code>java.sql.Types</code>: <code>BIT</code>, * or <code>BOOLEAN</code> * @return an <code>Object</code> value.that is * the standard object mapping for the target SQL type * @throws SQLException if the given target type is not one of the Boolean * types in <code>java.sql.Types</code> */ private Object convertBoolean(Object srcObj, int srcType, int trgType) throws SQLException { if (srcType == trgType) { return srcObj; } if (isNumeric(trgType) == true || (isString(trgType) == false && isBoolean(trgType) == false)) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } try { switch (trgType) { case java.sql.Types.BIT: Integer i = Integer.valueOf(srcObj.toString().trim()); return i.equals(Integer.valueOf((int)0)) ? Boolean.valueOf(false) : Boolean.valueOf(true); case java.sql.Types.BOOLEAN: return Boolean.valueOf(srcObj.toString().trim()); default: throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType); } } catch (NumberFormatException ex) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType); } } /** * Sets the designated nullable column in the current row or the * insert row of this <code>CachedRowSetImpl</code> object with * <code>null</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset; however, another method must be called to complete * the update process. If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to mark the row as updated * and to notify listeners that the row has changed. * If the cursor is on the insert row, the method {@link #insertRow} * must be called to insert the new row into this rowset and to notify * listeners that a row has changed. * <P> * In order to propagate updates in this rowset to the underlying * data source, an application must call the method {@link #acceptChanges} * after it calls either <code>updateRow</code> or <code>insertRow</code>. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateNull(int columnIndex) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); BaseRow row = getCurrentRow(); row.setColumnObject(columnIndex, null); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>boolean</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateBoolean(int columnIndex, boolean x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertBoolean(Boolean.valueOf(x), java.sql.Types.BIT, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>byte</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateByte(int columnIndex, byte x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(Byte.valueOf(x), java.sql.Types.TINYINT, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>short</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateShort(int columnIndex, short x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(Short.valueOf(x), java.sql.Types.SMALLINT, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>int</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateInt(int columnIndex, int x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(Integer.valueOf(x), java.sql.Types.INTEGER, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>long</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateLong(int columnIndex, long x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(Long.valueOf(x), java.sql.Types.BIGINT, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>float</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateFloat(int columnIndex, float x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(new Float(x), java.sql.Types.REAL, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>double</code> value. * * This method updates a column value in either the current row or * the insert row of this rowset, but it does not update the * database. If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateDouble(int columnIndex, double x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(new Double(x), java.sql.Types.DOUBLE, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.math.BigDecimal</code> object. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { // sanity check.Lines 4001–4500 of 10133. Previous lines Load more
if (isNumeric(trgType) == false && isString(trgType) == false) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType); } try { switch (trgType) { case java.sql.Types.BIT: Integer i = Integer.valueOf(srcObj.toString().trim()); return i.equals(Integer.valueOf((int)0)) ? Boolean.valueOf(false) : Boolean.valueOf(true); case java.sql.Types.TINYINT: return Byte.valueOf(srcObj.toString().trim()); case java.sql.Types.SMALLINT: return Short.valueOf(srcObj.toString().trim()); case java.sql.Types.INTEGER: return Integer.valueOf(srcObj.toString().trim()); case java.sql.Types.BIGINT: return Long.valueOf(srcObj.toString().trim()); case java.sql.Types.NUMERIC: case java.sql.Types.DECIMAL: return new BigDecimal(srcObj.toString().trim()); case java.sql.Types.REAL: case java.sql.Types.FLOAT: return new Float(srcObj.toString().trim()); case java.sql.Types.DOUBLE: return new Double(srcObj.toString().trim()); case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGVARCHAR: return srcObj.toString(); default: throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType); } } catch (NumberFormatException ex) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType); } } /** * Converts the given <code>Object</code> in the Java programming language * to the standard object mapping for the specified SQL target data type. * The conversion must be to a string or temporal type, and there are also * restrictions on the type to be converted. * <P> * <TABLE ALIGN="CENTER" BORDER CELLPADDING=10 BORDERCOLOR="#0000FF" * <CAPTION ALIGN="CENTER"><B>Parameters and Return Values</B></CAPTION> * <TR> * <TD><B>Source SQL Type</B> * <TD><B>Target SQL Type</B> * <TD><B>Object Returned</B> * </TR> * <TR> * <TD><code>TIMESTAMP</code> * <TD><code>DATE</code> * <TD><code>java.sql.Date</code> * </TR> * <TR> * <TD><code>TIMESTAMP</code> * <TD><code>TIME</code> * <TD><code>java.sql.Time</code> * </TR> * <TR> * <TD><code>TIME</code> * <TD><code>TIMESTAMP</code> * <TD><code>java.sql.Timestamp</code> * </TR> * <TR> * <TD><code>DATE</code>, <code>TIME</code>, or <code>TIMESTAMP</code> * <TD><code>CHAR</code>, <code>VARCHAR</code>, or <code>LONGVARCHAR</code> * <TD><code>java.lang.String</code> * </TR> * </TABLE> * <P> * If the source type and target type are the same, * the given object is simply returned. * * @param srcObj the <code>Object</code> in the Java programming language * that is to be converted to the target type * @param srcType the data type that is the standard mapping in SQL of the * object to be converted; must be one of the constants in * <code>java.sql.Types</code> * @param trgType the SQL data type to which to convert the given object; * must be one of the following constants in * <code>java.sql.Types</code>: <code>DATE</code>, * <code>TIME</code>, <code>TIMESTAMP</code>, <code>CHAR</code>, * <code>VARCHAR</code>, or <code>LONGVARCHAR</code> * @return an <code>Object</code> value.that is * the standard object mapping for the target SQL type * @throws SQLException if the given target type is not one of the string or * temporal types in <code>java.sql.Types</code> */ private Object convertTemporal(Object srcObj, int srcType, int trgType) throws SQLException { if (srcType == trgType) { return srcObj; } if (isNumeric(trgType) == true || (isString(trgType) == false && isTemporal(trgType) == false)) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } try { switch (trgType) { case java.sql.Types.DATE: if (srcType == java.sql.Types.TIMESTAMP) { return new java.sql.Date(((java.sql.Timestamp)srcObj).getTime()); } else { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } case java.sql.Types.TIMESTAMP: if (srcType == java.sql.Types.TIME) { return new Timestamp(((java.sql.Time)srcObj).getTime()); } else { return new Timestamp(((java.sql.Date)srcObj).getTime()); } case java.sql.Types.TIME: if (srcType == java.sql.Types.TIMESTAMP) { return new Time(((java.sql.Timestamp)srcObj).getTime()); } else { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGVARCHAR: return srcObj.toString(); default: throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } } catch (NumberFormatException ex) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } } /** * Converts the given <code>Object</code> in the Java programming language * to the standard mapping for the specified SQL target data type. * The conversion must be to a string or numeric type, but there are no * restrictions on the type to be converted. If the source type and target * type are the same, the given object is simply returned. * * @param srcObj the <code>Object</code> in the Java programming language * that is to be converted to the target type * @param srcType the data type that is the standard mapping in SQL of the * object to be converted; must be one of the constants in * <code>java.sql.Types</code> * @param trgType the SQL data type to which to convert the given object; * must be one of the following constants in * <code>java.sql.Types</code>: <code>BIT</code>, * or <code>BOOLEAN</code> * @return an <code>Object</code> value.that is * the standard object mapping for the target SQL type * @throws SQLException if the given target type is not one of the Boolean * types in <code>java.sql.Types</code> */ private Object convertBoolean(Object srcObj, int srcType, int trgType) throws SQLException { if (srcType == trgType) { return srcObj; } if (isNumeric(trgType) == true || (isString(trgType) == false && isBoolean(trgType) == false)) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } try { switch (trgType) { case java.sql.Types.BIT: Integer i = Integer.valueOf(srcObj.toString().trim()); return i.equals(Integer.valueOf((int)0)) ? Boolean.valueOf(false) : Boolean.valueOf(true); case java.sql.Types.BOOLEAN: return Boolean.valueOf(srcObj.toString().trim()); default: throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType); } } catch (NumberFormatException ex) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType); } } /** * Sets the designated nullable column in the current row or the * insert row of this <code>CachedRowSetImpl</code> object with * <code>null</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset; however, another method must be called to complete * the update process. If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to mark the row as updated * and to notify listeners that the row has changed. * If the cursor is on the insert row, the method {@link #insertRow} * must be called to insert the new row into this rowset and to notify * listeners that a row has changed. * <P> * In order to propagate updates in this rowset to the underlying * data source, an application must call the method {@link #acceptChanges} * after it calls either <code>updateRow</code> or <code>insertRow</code>. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateNull(int columnIndex) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); BaseRow row = getCurrentRow(); row.setColumnObject(columnIndex, null); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>boolean</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateBoolean(int columnIndex, boolean x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertBoolean(Boolean.valueOf(x), java.sql.Types.BIT, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>byte</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateByte(int columnIndex, byte x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(Byte.valueOf(x), java.sql.Types.TINYINT, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>short</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateShort(int columnIndex, short x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(Short.valueOf(x), java.sql.Types.SMALLINT, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>int</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateInt(int columnIndex, int x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(Integer.valueOf(x), java.sql.Types.INTEGER, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>long</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateLong(int columnIndex, long x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(Long.valueOf(x), java.sql.Types.BIGINT, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>float</code> value. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateFloat(int columnIndex, float x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(new Float(x), java.sql.Types.REAL, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>double</code> value. * * This method updates a column value in either the current row or * the insert row of this rowset, but it does not update the * database. If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateDouble(int columnIndex, double x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertNumeric(new Double(x), java.sql.Types.DOUBLE, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.math.BigDecimal</code> object. * <P> * This method updates a column value in the current row or the insert * row of this rowset, but it does not update the database. * If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) this rowset is * <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { // sanity check.