// make sure the cursor is on a valid row checkCursor(); // SerialClob will help in getting the byte array and storing it. // We need to be checking DatabaseMetaData.locatorsUpdatorCopy() // or through RowSetMetaData.locatorsUpdatorCopy() getCurrentRow().setColumnObject(columnIndex, new SerialRef(ref)); } /** * 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 columnName a <code>String</code> object that must match the * SQL name of a column in this rowset, ignoring case * @param ref the new column <code>java.sql.Ref</code> value * @throws SQLException if (1) the given column name does not match the * name of a column in this rowset, (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 updateRef(String columnName, java.sql.Ref ref) throws SQLException { updateRef(getColIdxByName(columnName), ref); } /** * 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 c the new column <code>Clob</code> 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 updateClob(int columnIndex, Clob c) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); // SerialClob will help in getting the byte array and storing it. // We need to be checking DatabaseMetaData.locatorsUpdatorCopy() // or through RowSetMetaData.locatorsUpdatorCopy() if(dbmslocatorsUpdateCopy){ getCurrentRow().setColumnObject(columnIndex, new SerialClob(c)); } else{ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString()); } } /** * 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 columnName a <code>String</code> object that must match the * SQL name of a column in this rowset, ignoring case * @param c the new column <code>Clob</code> value * @throws SQLException if (1) the given column name does not match the * name of a column in this rowset, (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 updateClob(String columnName, Clob c) throws SQLException { updateClob(getColIdxByName(columnName), c); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.sql.Blob</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 b the new column <code>Blob</code> 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 updateBlob(int columnIndex, Blob b) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); // SerialBlob will help in getting the byte array and storing it. // We need to be checking DatabaseMetaData.locatorsUpdatorCopy() // or through RowSetMetaData.locatorsUpdatorCopy() if(dbmslocatorsUpdateCopy){ getCurrentRow().setColumnObject(columnIndex, new SerialBlob(b)); } else{ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString()); } } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.sql.Blob </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 columnName a <code>String</code> object that must match the * SQL name of a column in this rowset, ignoring case * @param b the new column <code>Blob</code> value * @throws SQLException if (1) the given column name does not match the * name of a column in this rowset, (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 updateBlob(String columnName, Blob b) throws SQLException { updateBlob(getColIdxByName(columnName), b); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.sql.Array</code> values. * * 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 a the new column <code>Array</code> 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 updateArray(int columnIndex, Array a) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); // SerialArray will help in getting the byte array and storing it. // We need to be checking DatabaseMetaData.locatorsUpdatorCopy() // or through RowSetMetaData.locatorsUpdatorCopy() getCurrentRow().setColumnObject(columnIndex, new SerialArray(a)); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.sql.Array</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 columnName a <code>String</code> object that must match the * SQL name of a column in this rowset, ignoring case * @param a the new column <code>Array</code> value * @throws SQLException if (1) the given column name does not match the * name of a column in this rowset, (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 updateArray(String columnName, Array a) throws SQLException { updateArray(getColIdxByName(columnName), a); } /** * Retrieves the value of the designated column in this * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object * in the Java programming language. * * @return a java.net.URL object containing the resource reference described by * the URL * @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) the designated column does not store an * SQL <code>DATALINK</code> value. * @see #getURL(String) */ public java.net.URL getURL(int columnIndex) throws SQLException { //throw new SQLException("Operation not supported"); java.net.URL value; // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.DATALINK) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } setLastValueNull(false); value = (java.net.URL)(getCurrentRow().getColumnObject(columnIndex)); // check for SQL NULL if (value == null) { setLastValueNull(true); return null; } return value; } /** * Retrieves the value of the designated column in this * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object * in the Java programming language. * * @return a java.net.URL object containing the resource reference described by * the URL * @throws SQLException if (1) the given column name not the name of a column * in this rowset, or * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) the designated column does not store an * SQL <code>DATALINK</code> value. * @see #getURL(int) */ public java.net.URL getURL(String columnName) throws SQLException { return getURL(getColIdxByName(columnName)); } /** * The first warning reported by calls on this <code>CachedRowSetImpl</code> * object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will * be chained to this <code>SQLWarning</code>. All <code>RowSetWarnings</code> * warnings are generated in the disconnected environment and remain a * seperate warning chain to that provided by the <code>getWarnings</code> * method. * * <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 <code>CachedRowSet</code> (and their child interface) * methods. All <code>SQLWarnings</code> can be obtained using the * <code>getWarnings</code> method which tracks warnings generated * by the underlying JDBC driver. * @return the first SQLWarning or null * */ public RowSetWarning getRowSetWarnings() { try { notifyCursorMoved(); } catch (SQLException e) {} // mask exception return rowsetWarning; } /** * The function tries to isolate the tablename when only setCommand * is set and not setTablename is called provided there is only one table * name in the query else just leaves the setting of table name as such. * If setTablename is set later it will over ride this table name * value so retrieved. * * @return the tablename if only one table in query else return "" */ private String buildTableName(String command) throws SQLException { // If we have a query from one table, // we set the table name implicitly // else user has to explicitly set the table name. int indexFrom, indexComma; String strTablename =""; command = command.trim(); // Query can be a select, insert or update if(command.toLowerCase().startsWith("select")) { // look for "from" keyword, after that look for a // comma after from. If comma is there don't set // table name else isolate table name. indexFrom = command.toLowerCase().indexOf("from"); indexComma = command.indexOf(",", indexFrom); if(indexComma == -1) { // implies only one table strTablename = (command.substring(indexFrom+"from".length(),command.length())).trim(); String tabName = strTablename; int idxWhere = tabName.toLowerCase().indexOf("where"); /** * Adding the addtional check for conditions following the table name. * If a condition is found truncate it. **/ if(idxWhere != -1) { tabName = tabName.substring(0,idxWhere).trim(); } strTablename = tabName; } else { //strTablename=""; } } else if(command.toLowerCase().startsWith("insert")) { //strTablename=""; } else if(command.toLowerCase().startsWith("update")) { //strTablename=""; } return strTablename; } /** * Commits all changes performed by the <code>acceptChanges()</code> * methods * * @see java.sql.Connection#commit */ public void commit() throws SQLException { conn.commit(); } /** * Rolls back all changes performed by the <code>acceptChanges()</code> * methods * * @see java.sql.Connection#rollback */ public void rollback() throws SQLException { conn.rollback(); } /** * Rolls back all changes performed by the <code>acceptChanges()</code> * to the last <code>Savepoint</code> transaction marker. * * @see java.sql.Connection#rollback(Savepoint) */ public void rollback(Savepoint s) throws SQLException { conn.rollback(s); } /** * Unsets the designated parameter to the given int array. * This was set using <code>setMatchColumn</code> * as the column which will form the basis of the join. * <P> * The parameter value unset by this method should be same * as was set. * * @param columnIdxes the index into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds or if the columnIdx is * not the same as set using <code>setMatchColumn(int [])</code> */ public void unsetMatchColumn(int[] columnIdxes) throws SQLException { int i_val; for( int j= 0 ;j < columnIdxes.length; j++) { i_val = (Integer.parseInt(iMatchColumns.get(j).toString())); if(columnIdxes[j] != i_val) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString()); } } for( int i = 0;i < columnIdxes.length ;i++) { iMatchColumns.set(i,Integer.valueOf(-1)); } } /** * Unsets the designated parameter to the given String array. * This was set using <code>setMatchColumn</code> * as the column which will form the basis of the join. * <P> * The parameter value unset by this method should be same * as was set. * * @param columnIdxes the index into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds or if the columnName is * not the same as set using <code>setMatchColumn(String [])</code> */ public void unsetMatchColumn(String[] columnIdxes) throws SQLException { for(int j = 0 ;j < columnIdxes.length; j++) { if( !columnIdxes[j].equals(strMatchColumns.get(j)) ){ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString()); } } for(int i = 0 ; i < columnIdxes.length; i++) { strMatchColumns.set(i,null); } } /** * Retrieves the column name as <code>String</code> array * that was set using <code>setMatchColumn(String [])</code> * for this rowset. * * @return a <code>String</code> array object that contains the column names * for the rowset which has this the match columns * * @throws SQLException if an error occurs or column name is not set */ public String[] getMatchColumnNames() throws SQLException { String []str_temp = new String[strMatchColumns.size()]; if( strMatchColumns.get(0) == null) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString()); } strMatchColumns.copyInto(str_temp); return str_temp; } /** * Retrieves the column id as <code>int</code> array that was set using * <code>setMatchColumn(int [])</code> for this rowset. * * @return a <code>int</code> array object that contains the column ids * for the rowset which has this as the match columns. * * @throws SQLException if an error occurs or column index is not set */ public int[] getMatchColumnIndexes() throws SQLException { Integer []int_temp = new Integer[iMatchColumns.size()]; int [] i_temp = new int[iMatchColumns.size()]; int i_val; Lines 6501–7000 of 10133. Previous lines Load more
// make sure the cursor is on a valid row checkCursor(); // SerialClob will help in getting the byte array and storing it. // We need to be checking DatabaseMetaData.locatorsUpdatorCopy() // or through RowSetMetaData.locatorsUpdatorCopy() getCurrentRow().setColumnObject(columnIndex, new SerialRef(ref)); } /** * 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 columnName a <code>String</code> object that must match the * SQL name of a column in this rowset, ignoring case * @param ref the new column <code>java.sql.Ref</code> value * @throws SQLException if (1) the given column name does not match the * name of a column in this rowset, (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 updateRef(String columnName, java.sql.Ref ref) throws SQLException { updateRef(getColIdxByName(columnName), ref); } /** * 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 c the new column <code>Clob</code> 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 updateClob(int columnIndex, Clob c) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); // SerialClob will help in getting the byte array and storing it. // We need to be checking DatabaseMetaData.locatorsUpdatorCopy() // or through RowSetMetaData.locatorsUpdatorCopy() if(dbmslocatorsUpdateCopy){ getCurrentRow().setColumnObject(columnIndex, new SerialClob(c)); } else{ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString()); } } /** * 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 columnName a <code>String</code> object that must match the * SQL name of a column in this rowset, ignoring case * @param c the new column <code>Clob</code> value * @throws SQLException if (1) the given column name does not match the * name of a column in this rowset, (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 updateClob(String columnName, Clob c) throws SQLException { updateClob(getColIdxByName(columnName), c); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.sql.Blob</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 b the new column <code>Blob</code> 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 updateBlob(int columnIndex, Blob b) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); // SerialBlob will help in getting the byte array and storing it. // We need to be checking DatabaseMetaData.locatorsUpdatorCopy() // or through RowSetMetaData.locatorsUpdatorCopy() if(dbmslocatorsUpdateCopy){ getCurrentRow().setColumnObject(columnIndex, new SerialBlob(b)); } else{ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString()); } } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.sql.Blob </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 columnName a <code>String</code> object that must match the * SQL name of a column in this rowset, ignoring case * @param b the new column <code>Blob</code> value * @throws SQLException if (1) the given column name does not match the * name of a column in this rowset, (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 updateBlob(String columnName, Blob b) throws SQLException { updateBlob(getColIdxByName(columnName), b); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.sql.Array</code> values. * * 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 a the new column <code>Array</code> 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 updateArray(int columnIndex, Array a) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); // SerialArray will help in getting the byte array and storing it. // We need to be checking DatabaseMetaData.locatorsUpdatorCopy() // or through RowSetMetaData.locatorsUpdatorCopy() getCurrentRow().setColumnObject(columnIndex, new SerialArray(a)); } /** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>java.sql.Array</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 columnName a <code>String</code> object that must match the * SQL name of a column in this rowset, ignoring case * @param a the new column <code>Array</code> value * @throws SQLException if (1) the given column name does not match the * name of a column in this rowset, (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 updateArray(String columnName, Array a) throws SQLException { updateArray(getColIdxByName(columnName), a); } /** * Retrieves the value of the designated column in this * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object * in the Java programming language. * * @return a java.net.URL object containing the resource reference described by * the URL * @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) the designated column does not store an * SQL <code>DATALINK</code> value. * @see #getURL(String) */ public java.net.URL getURL(int columnIndex) throws SQLException { //throw new SQLException("Operation not supported"); java.net.URL value; // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.DATALINK) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } setLastValueNull(false); value = (java.net.URL)(getCurrentRow().getColumnObject(columnIndex)); // check for SQL NULL if (value == null) { setLastValueNull(true); return null; } return value; } /** * Retrieves the value of the designated column in this * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object * in the Java programming language. * * @return a java.net.URL object containing the resource reference described by * the URL * @throws SQLException if (1) the given column name not the name of a column * in this rowset, or * (2) the cursor is not on one of this rowset's rows or its * insert row, or (3) the designated column does not store an * SQL <code>DATALINK</code> value. * @see #getURL(int) */ public java.net.URL getURL(String columnName) throws SQLException { return getURL(getColIdxByName(columnName)); } /** * The first warning reported by calls on this <code>CachedRowSetImpl</code> * object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will * be chained to this <code>SQLWarning</code>. All <code>RowSetWarnings</code> * warnings are generated in the disconnected environment and remain a * seperate warning chain to that provided by the <code>getWarnings</code> * method. * * <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 <code>CachedRowSet</code> (and their child interface) * methods. All <code>SQLWarnings</code> can be obtained using the * <code>getWarnings</code> method which tracks warnings generated * by the underlying JDBC driver. * @return the first SQLWarning or null * */ public RowSetWarning getRowSetWarnings() { try { notifyCursorMoved(); } catch (SQLException e) {} // mask exception return rowsetWarning; } /** * The function tries to isolate the tablename when only setCommand * is set and not setTablename is called provided there is only one table * name in the query else just leaves the setting of table name as such. * If setTablename is set later it will over ride this table name * value so retrieved. * * @return the tablename if only one table in query else return "" */ private String buildTableName(String command) throws SQLException { // If we have a query from one table, // we set the table name implicitly // else user has to explicitly set the table name. int indexFrom, indexComma; String strTablename =""; command = command.trim(); // Query can be a select, insert or update if(command.toLowerCase().startsWith("select")) { // look for "from" keyword, after that look for a // comma after from. If comma is there don't set // table name else isolate table name. indexFrom = command.toLowerCase().indexOf("from"); indexComma = command.indexOf(",", indexFrom); if(indexComma == -1) { // implies only one table strTablename = (command.substring(indexFrom+"from".length(),command.length())).trim(); String tabName = strTablename; int idxWhere = tabName.toLowerCase().indexOf("where"); /** * Adding the addtional check for conditions following the table name. * If a condition is found truncate it. **/ if(idxWhere != -1) { tabName = tabName.substring(0,idxWhere).trim(); } strTablename = tabName; } else { //strTablename=""; } } else if(command.toLowerCase().startsWith("insert")) { //strTablename=""; } else if(command.toLowerCase().startsWith("update")) { //strTablename=""; } return strTablename; } /** * Commits all changes performed by the <code>acceptChanges()</code> * methods * * @see java.sql.Connection#commit */ public void commit() throws SQLException { conn.commit(); } /** * Rolls back all changes performed by the <code>acceptChanges()</code> * methods * * @see java.sql.Connection#rollback */ public void rollback() throws SQLException { conn.rollback(); } /** * Rolls back all changes performed by the <code>acceptChanges()</code> * to the last <code>Savepoint</code> transaction marker. * * @see java.sql.Connection#rollback(Savepoint) */ public void rollback(Savepoint s) throws SQLException { conn.rollback(s); } /** * Unsets the designated parameter to the given int array. * This was set using <code>setMatchColumn</code> * as the column which will form the basis of the join. * <P> * The parameter value unset by this method should be same * as was set. * * @param columnIdxes the index into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds or if the columnIdx is * not the same as set using <code>setMatchColumn(int [])</code> */ public void unsetMatchColumn(int[] columnIdxes) throws SQLException { int i_val; for( int j= 0 ;j < columnIdxes.length; j++) { i_val = (Integer.parseInt(iMatchColumns.get(j).toString())); if(columnIdxes[j] != i_val) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString()); } } for( int i = 0;i < columnIdxes.length ;i++) { iMatchColumns.set(i,Integer.valueOf(-1)); } } /** * Unsets the designated parameter to the given String array. * This was set using <code>setMatchColumn</code> * as the column which will form the basis of the join. * <P> * The parameter value unset by this method should be same * as was set. * * @param columnIdxes the index into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds or if the columnName is * not the same as set using <code>setMatchColumn(String [])</code> */ public void unsetMatchColumn(String[] columnIdxes) throws SQLException { for(int j = 0 ;j < columnIdxes.length; j++) { if( !columnIdxes[j].equals(strMatchColumns.get(j)) ){ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString()); } } for(int i = 0 ; i < columnIdxes.length; i++) { strMatchColumns.set(i,null); } } /** * Retrieves the column name as <code>String</code> array * that was set using <code>setMatchColumn(String [])</code> * for this rowset. * * @return a <code>String</code> array object that contains the column names * for the rowset which has this the match columns * * @throws SQLException if an error occurs or column name is not set */ public String[] getMatchColumnNames() throws SQLException { String []str_temp = new String[strMatchColumns.size()]; if( strMatchColumns.get(0) == null) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString()); } strMatchColumns.copyInto(str_temp); return str_temp; } /** * Retrieves the column id as <code>int</code> array that was set using * <code>setMatchColumn(int [])</code> for this rowset. * * @return a <code>int</code> array object that contains the column ids * for the rowset which has this as the match columns. * * @throws SQLException if an error occurs or column index is not set */ public int[] getMatchColumnIndexes() throws SQLException { Integer []int_temp = new Integer[iMatchColumns.size()]; int [] i_temp = new int[iMatchColumns.size()]; int i_val;