Update of /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3005/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer
Modified Files:
ResultSetDataSet.java
Log Message:
Feature request 2826175:
Number of rows read is now visible on message panel and results tab.
Index: ResultSetDataSet.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/ResultSetDataSet.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** ResultSetDataSet.java 11 Apr 2009 19:06:49 -0000 1.25
--- ResultSetDataSet.java 1 Sep 2009 18:11:01 -0000 1.26
***************
*** 80,86 ****
* @throws DataSetException
*/
! public void setResultSet(ResultSet rs, DialectType dialectType)
throws DataSetException {
! setResultSet(rs, null, false, dialectType);
}
--- 80,86 ----
* @throws DataSetException
*/
! public int setResultSet(ResultSet rs, DialectType dialectType)
throws DataSetException {
! return setResultSet(rs, null, false, dialectType);
}
***************
*** 96,102 ****
* @throws DataSetException
*/
! public void setContentsTabResultSet(ResultSet rs, String fullTableName,
DialectType dialectType) throws DataSetException {
! setResultSet(rs, fullTableName, null, false, true, dialectType);
}
--- 96,102 ----
* @throws DataSetException
*/
! public int setContentsTabResultSet(ResultSet rs, String fullTableName,
DialectType dialectType) throws DataSetException {
! return setResultSet(rs, fullTableName, null, false, true, dialectType);
}
***************
*** 112,118 ****
* @throws DataSetException
*/
! public void setResultSet(ResultSet rs, int[] columnIndices,
DialectType dialectType) throws DataSetException {
! setResultSet(rs, columnIndices, false, dialectType);
}
--- 112,118 ----
* @throws DataSetException
*/
! public int setResultSet(ResultSet rs, int[] columnIndices,
DialectType dialectType) throws DataSetException {
! return setResultSet(rs, columnIndices, false, dialectType);
}
***************
*** 122,128 ****
* simplicity of operation.
*/
! public void setResultSet(ResultSet rs, int[] columnIndices,
boolean computeWidths, DialectType dialectType) throws DataSetException {
! setResultSet(rs, null, columnIndices, computeWidths, false, dialectType);
}
--- 122,128 ----
* simplicity of operation.
*/
! public int setResultSet(ResultSet rs, int[] columnIndices,
boolean computeWidths, DialectType dialectType) throws DataSetException {
! return setResultSet(rs, null, columnIndices, computeWidths, false, dialectType);
}
***************
*** 130,135 ****
* Internal method to read the contents of a ResultSet that is used by all
* Tab classes
*/
! private void setResultSet(ResultSet rs, String fullTableName,
int[] columnIndices, boolean computeWidths, boolean useColumnDefs,
DialectType dialectType) throws DataSetException {
--- 130,138 ----
* Internal method to read the contents of a ResultSet that is used by all
* Tab classes
+ *
+ * @return The number of rows read from the ResultSet
+ *
*/
! private int setResultSet(ResultSet rs, String fullTableName,
int[] columnIndices, boolean computeWidths, boolean useColumnDefs,
DialectType dialectType) throws DataSetException {
***************
*** 142,207 ****
_alData = new ArrayList<Object[]>();
! if (rs != null) {
! try {
! ResultSetMetaData md = rs.getMetaData();
! _columnCount = columnIndices != null ? columnIndices.length
! : md.getColumnCount();
! // Done before actually reading the data from the ResultSet. If done
! // after
! // reading the data from the ResultSet Oracle throws a
! // NullPointerException
! // when processing ResultSetMetaData methods for the ResultSet
! // returned for
! // DatabasemetaData.getExportedKeys.
! ColumnDisplayDefinition[] colDefs = createColumnDefinitions(md,
! fullTableName,
! columnIndices,
! computeWidths);
! _dataSetDefinition = new DataSetDefinition(colDefs);
! // Read the entire row, since some drivers complain if columns are
! // read out of sequence
! rdr = new ResultSetReader(rs, dialectType);
! Object[] row = null;
! while (true) {
! if (useColumnDefs)
! row = rdr.readRow(colDefs);
! else
! row = rdr.readRow();
! if (row == null)
! break;
! if (_cancel) {
! return;
! }
! // SS: now select/reorder columns
! if (columnIndices != null) {
! Object[] newRow = new Object[_columnCount];
! for (int i = 0; i < _columnCount; i++) {
! if (columnIndices[i] - 1 < row.length) {
! newRow[i] = row[columnIndices[i] - 1];
! } else {
! newRow[i] = "Unknown";
! }
}
- row = newRow;
}
! _alData.add(row);
}
!
! // ColumnDisplayDefinition[] colDefs = createColumnDefinitions(md,
! // columnIndices, computeWidths);
! // _dataSetDefinition = new DataSetDefinition(colDefs);
! } catch (SQLException ex) {
! // Don't log an error message here. It is possible that the user
! // interrupted the query because it was taking too long. Just
! // throw the exception, and let the caller decide whether or not
! // the exception should be logged.
! throw new DataSetException(ex);
}
}
}
--- 145,215 ----
_alData = new ArrayList<Object[]>();
! if (rs == null)
! {
! return 0;
! }
! try {
! ResultSetMetaData md = rs.getMetaData();
! _columnCount = columnIndices != null ? columnIndices.length
! : md.getColumnCount();
! // Done before actually reading the data from the ResultSet. If done
! // after
! // reading the data from the ResultSet Oracle throws a
! // NullPointerException
! // when processing ResultSetMetaData methods for the ResultSet
! // returned for
! // DatabasemetaData.getExportedKeys.
! ColumnDisplayDefinition[] colDefs = createColumnDefinitions(md,
! fullTableName,
! columnIndices,
! computeWidths);
! _dataSetDefinition = new DataSetDefinition(colDefs);
! // Read the entire row, since some drivers complain if columns are
! // read out of sequence
! rdr = new ResultSetReader(rs, dialectType);
! Object[] row = null;
! while (true) {
! if (useColumnDefs)
! row = rdr.readRow(colDefs);
! else
! row = rdr.readRow();
! if (row == null)
! break;
! if (_cancel) {
! return _alData.size();
! }
!
! // SS: now select/reorder columns
! if (columnIndices != null) {
! Object[] newRow = new Object[_columnCount];
! for (int i = 0; i < _columnCount; i++) {
! if (columnIndices[i] - 1 < row.length) {
! newRow[i] = row[columnIndices[i] - 1];
! } else {
! newRow[i] = "Unknown";
}
}
! row = newRow;
}
! _alData.add(row);
}
+
+ return _alData.size();
+
+ // ColumnDisplayDefinition[] colDefs = createColumnDefinitions(md,
+ // columnIndices, computeWidths);
+ // _dataSetDefinition = new DataSetDefinition(colDefs);
+ } catch (SQLException ex) {
+ // Don't log an error message here. It is possible that the user
+ // interrupted the query because it was taking too long. Just
+ // throw the exception, and let the caller decide whether or not
+ // the exception should be logged.
+ throw new DataSetException(ex);
}
}
|