You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2007/05/08 08:49:56 UTC
svn commit: r536100 - in /db/derby/code/trunk/java:
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/tests/tools/
tools/org/apache/derby/impl/tools/ij/ tools/org/apache/derby/loc/
tools/org/apache/derb...
Author: kristwaa
Date: Mon May 7 23:49:55 2007
New Revision: 536100
URL: http://svn.apache.org/viewvc?view=rev&rev=536100
Log:
DERBY-2222: 'show indexes in SCHEMANAME' does not work with the client driver.
Patch file: DERBY-2222-3.diff
Patch contributed by Jørgen Løland.
Added:
db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijMultipleResultSetResult.java (with props)
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql
db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj
db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java
db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResultImpl.java
db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java
db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties
db/derby/code/trunk/java/tools/org/apache/derby/tools/JDBCDisplayUtil.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out?view=diff&rev=536100&r1=536099&r2=536100
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out Mon May 7 23:49:55 2007
@@ -142,6 +142,11 @@
------------------------------------------------------------------------
USER1 |T3 |
1 row selected
+ij> SHOW INDEXES IN APP;
+TABLE_NAME |COLUMN_NAME |NON_U&|TYPE|ASC&|CARDINA&|PAGES
+----------------------------------------------------------------------------
+T1 |TEST |true |3 |A |NULL |NULL
+1 row selected
ij> SHOW INDEXES FROM APP.t1;
TABLE_NAME |COLUMN_NAME |NON_U&|TYPE|ASC&|CARDINA&|PAGES
----------------------------------------------------------------------------
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql?view=diff&rev=536100&r1=536099&r2=536100
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql Mon May 7 23:49:55 2007
@@ -51,5 +51,6 @@
SHOW VIEWS IN USER1;
SHOW PROCEDURES IN APP;
SHOW SYNONYMS IN USER1;
+SHOW INDEXES IN APP;
SHOW INDEXES FROM APP.t1;
Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj?view=diff&rev=536100&r1=536099&r2=536100
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj Mon May 7 23:49:55 2007
@@ -64,6 +64,8 @@
import java.util.Vector;
import java.util.Enumeration;
import java.util.Locale;
+import java.util.List;
+import java.util.ArrayList;
/**
@@ -642,51 +644,129 @@
Return a resultset of indexes for the given table or schema
@param schema schema to find indexes for
- @param table table to find indexes for
- */
- public ijResult showIndexes(String schema, String table) throws SQLException {
- ResultSet rs = null;
- try {
- haveConnection();
- verifyTableExists(schema, table);
-
- DatabaseMetaData dbmd = theConnection.getMetaData();
- rs = dbmd.getIndexInfo(null, schema, table, false, true);
+ @param table the exact name of the table to find indexes for
+ */
+ private ResultSet getIndexInfoForTable(String schema, String table)
+ throws SQLException {
- int[] displayColumns = new int[] {
- rs.findColumn("TABLE_SCHEM"),
- rs.findColumn("TABLE_NAME"),
- rs.findColumn("COLUMN_NAME"),
- rs.findColumn("NON_UNIQUE"),
- rs.findColumn("TYPE"),
- rs.findColumn("ASC_OR_DESC"),
- rs.findColumn("CARDINALITY"),
- rs.findColumn("PAGES"),
- };
- int[] columnWidths = new int[] {
- 20,
- 20,
- 20,
- 6,
- 4,
- 4,
- 8,
- 8,
- };
+ ResultSet rs = null;
+ try {
+ haveConnection();
+ verifyTableExists(schema, table);
+
+ DatabaseMetaData dbmd = theConnection.getMetaData();
+ rs = dbmd.getIndexInfo(null, schema, table, false, true);
+
+ } catch (SQLException e) {
+ if(rs!=null)
+ rs.close();
+ throw e;
+ }
+ return rs;
+ }
+
+ /**
+ * Used by showIndexes to get columns in correct order
+ */
+ private int[] getDisplayColumnsForIndex(String schema, ResultSet rs)
+ throws SQLException{
+ int[] displayColumns = new int[] {
+ rs.findColumn("TABLE_SCHEM"),
+ rs.findColumn("TABLE_NAME"),
+ rs.findColumn("COLUMN_NAME"),
+ rs.findColumn("NON_UNIQUE"),
+ rs.findColumn("TYPE"),
+ rs.findColumn("ASC_OR_DESC"),
+ rs.findColumn("CARDINALITY"),
+ rs.findColumn("PAGES"),
+ };
+ if(schema!=null) {
+ displayColumns = intArraySubset(displayColumns, 1,
+ displayColumns.length);
+ }
+ return displayColumns;
+ }
+
+ /**
+ * Used by showIndexes to get correct column widths
+ */
+ private int[] getColumnWidthsForIndex(String schema){
+ int[] columnWidths = new int[] {
+ 20,
+ 20,
+ 20,
+ 6,
+ 4,
+ 4,
+ 8,
+ 8,
+ };
+ if(schema!=null) {
+ columnWidths = intArraySubset(columnWidths, 1,
+ columnWidths.length);
+ }
+ return columnWidths;
+ }
+
+ /**
+ * Used to show all indices
+ * @param schema the schema indices are shown from.
+ * @param table the table name to show indices for. If null, all
+ * indices of the schema are returned.
+ */
+ public ijResult showIndexes(String schema, String table) throws SQLException {
+
+ ijResult result = null;
+
+ int[] displayColumns = null;
+ int[] columnWidths = null;
+
+ try {
+ if (table != null) {
+ ResultSet rs = getIndexInfoForTable(schema, table);
+ displayColumns = getDisplayColumnsForIndex(schema, rs);
+ columnWidths = getColumnWidthsForIndex(schema);
+ result = new ijResultSetResult(rs, displayColumns,
+ columnWidths);
+ }
+ else {
+ /* DatabaseMetaData#getIndexInfo requires exact table names.
+ * If table is null, we must first get all table names in
+ * the appropriate schema, and then get all indices for each
+ * of these.
+ */
+ haveConnection();
+ verifyTableExists(schema, table);
- if(schema!=null) {
- displayColumns = intArraySubset(displayColumns, 1,
- displayColumns.length);
- columnWidths = intArraySubset(columnWidths, 1,
- columnWidths.length);
- }
- return new ijResultSetResult(rs, displayColumns, columnWidths);
- } catch (SQLException e) {
- if(rs!=null)
- rs.close();
- throw e;
- }
- }
+ DatabaseMetaData dbmd = theConnection.getMetaData();
+ ResultSet tablers = dbmd.getTables(null,schema,null,null);
+
+ List resultSets = new ArrayList();
+ boolean firstIteration = true;
+ ResultSet current_rs = null;
+ while (tablers.next()){
+ String tableName = tablers.getString("TABLE_NAME");
+ current_rs = getIndexInfoForTable(schema, tableName);
+ resultSets.add(current_rs);
+
+ if (firstIteration) {
+ displayColumns = getDisplayColumnsForIndex(schema,
+ current_rs);
+ columnWidths = getColumnWidthsForIndex(schema);
+ firstIteration = false;
+ }
+ }
+ result = new ijMultipleResultSetResult(resultSets,
+ displayColumns,
+ columnWidths);
+ }
+ return result;
+ } catch (SQLException e) {
+ if(result!=null)
+ result.closeStatement();
+ throw e;
+ }
+ }
/**
Return a resultset of procedures from database metadata
Added: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijMultipleResultSetResult.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijMultipleResultSetResult.java?view=auto&rev=536100
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijMultipleResultSetResult.java (added)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijMultipleResultSetResult.java Mon May 7 23:49:55 2007
@@ -0,0 +1,123 @@
+/*
+
+Derby - Class org.apache.derby.impl.tools.ij.ijResultSetResult
+
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+
+package org.apache.derby.impl.tools.ij;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * This impl is intended to be used with multiple resultsets, where
+ * the execution of the statement is already complete.
+ */
+public class ijMultipleResultSetResult extends ijResultImpl {
+
+ List resultSets = null;
+
+ int[] displayColumns = null;
+ int[] columnWidths = null;
+
+ /**
+ * Create a ijResultImpl that represents multiple result set.
+ */
+ public ijMultipleResultSetResult(List resultSets) throws SQLException {
+ resultSets = new ArrayList();
+ resultSets.addAll(resultSets);
+ }
+
+ /**
+ * Create a ijResultImpl that represents multiple result sets, only
+ * displaying a subset of the columns, using specified column widths.
+ *
+ * @param resultSets The result sets to display
+ * @param display Which column numbers to display, or null to display
+ * all columns.
+ * @param widths The widths of the columns specified in 'display', or
+ * null to display using default column sizes.
+ */
+ public ijMultipleResultSetResult(List resultSets, int[] display,
+ int[] widths) throws SQLException {
+ this.resultSets = new ArrayList();
+ this.resultSets.addAll(resultSets);
+
+ displayColumns = display;
+ columnWidths = widths;
+ }
+
+
+ public void addResultSet(ResultSet rs){
+ resultSets.add(rs);
+ }
+
+ public boolean isMultipleResultSetResult(){
+ return true;
+ }
+
+ public List getMultipleResultSets() {
+ return resultSets;
+ }
+
+ public void closeStatement() throws SQLException {
+ if (resultSets != null) {
+ ResultSet rs = null;
+ for (int i = 0; i<resultSets.size(); i++){
+ rs = (ResultSet)resultSets.get(i);
+ if(rs.getStatement() != null) rs.getStatement().close();
+ else rs.close();
+ }
+ }
+ }
+
+ public int[] getColumnDisplayList() { return displayColumns; }
+ public int[] getColumnWidthList() { return columnWidths; }
+
+ /**
+ * @return the warnings from all resultsets as one SQLWarning chain
+ */
+ public SQLWarning getSQLWarnings() throws SQLException {
+ SQLWarning warning = null;
+ ResultSet rs = null;
+ for (int i=0; i<resultSets.size(); i++){
+ rs = (ResultSet)resultSets.get(i);
+ if (rs.getWarnings() != null) {
+ if (warning == null) warning = rs.getWarnings();
+ else warning.setNextWarning(rs.getWarnings());
+ }
+ }
+ return warning;
+ }
+
+ /**
+ * Clears the warnings in all resultsets
+ */
+ public void clearSQLWarnings() throws SQLException {
+ for (int i=0; i<resultSets.size(); i++){
+ ((ResultSet)resultSets.get(i)).clearWarnings();
+ }
+ }
+}
Propchange: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijMultipleResultSetResult.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java?view=diff&rev=536100&r1=536099&r2=536100
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java Mon May 7 23:49:55 2007
@@ -28,6 +28,7 @@
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.util.Vector;
+import java.util.List;
/**
* This is a wrapper for results coming out of the
@@ -44,12 +45,14 @@
boolean isVector();
boolean isMulti();
boolean isException();
+ boolean isMultipleResultSetResult();
boolean hasWarnings() throws SQLException ;
Connection getConnection();
Statement getStatement();
int getUpdateCount() throws SQLException;
ResultSet getResultSet() throws SQLException;
+ List getMultipleResultSets();
ResultSet getNextRowOfResultSet();
Vector getVector();
SQLException getException();
Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResultImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResultImpl.java?view=diff&rev=536100&r1=536099&r2=536100
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResultImpl.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResultImpl.java Mon May 7 23:49:55 2007
@@ -28,6 +28,7 @@
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.util.Vector;
+import java.util.List;
/**
* This is an empty impl for reuse of code.
@@ -42,12 +43,14 @@
public boolean isVector() { return false; }
public boolean isMulti() { return false; }
public boolean isException() { return false; }
+ public boolean isMultipleResultSetResult(){ return false; }
public boolean hasWarnings() throws SQLException { return getSQLWarnings()!=null; }
public Connection getConnection() { return null; }
public Statement getStatement() { return null; }
public int getUpdateCount() throws SQLException { return -1; }
public ResultSet getResultSet() throws SQLException { return null; }
+ public List getMultipleResultSets() { return null; }
public ResultSet getNextRowOfResultSet() { return null; }
public Vector getVector() { return null; }
public SQLException getException() { return null; }
@@ -68,6 +71,9 @@
if (isVector()) return LocalizedResource.getMessage("IJ_Vec0",getVector().toString());
if (isMulti()) return LocalizedResource.getMessage("IJ_Mul0",getVector().toString());
if (isException()) return LocalizedResource.getMessage("IJ_Exc0",getException().toString());
+ if (isMultipleResultSetResult())
+ return LocalizedResource.getMessage("IJ_MRS0",
+ getMultipleResultSets().toString());
try {
if (isResultSet()) return LocalizedResource.getMessage("IJ_Rse0",getStatement().toString());
} catch(SQLException se) {
Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java?view=diff&rev=536100&r1=536099&r2=536100
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java Mon May 7 23:49:55 2007
@@ -33,6 +33,7 @@
import org.apache.derby.iapi.error.PublicAPI;
import org.apache.derby.iapi.error.StandardException;
+import java.util.List;
import java.util.Stack;
import java.util.Hashtable;
import java.util.Properties;
@@ -490,6 +491,17 @@
throw se;
}
result.closeStatement();
+ } else if (result.isMultipleResultSetResult()) {
+ List resultSets = result.getMultipleResultSets();
+ try {
+ JDBCDisplayUtil.DisplayMultipleResults(out,resultSets,
+ connEnv[currCE].getConnection(),
+ result.getColumnDisplayList(),
+ result.getColumnWidthList());
+ } catch (SQLException se) {
+ result.closeStatement();
+ throw se;
+ }
} else if (result.isException()) {
JDBCDisplayUtil.ShowException(out,result.getException());
}
Modified: db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties?view=diff&rev=536100&r1=536099&r2=536100
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties Mon May 7 23:49:55 2007
@@ -157,6 +157,7 @@
IJ_Vec0=VEC::{0}
IJ_Mul0=MUL::{0}
IJ_Exc0=EXC::{0}
+IJ_MRS0=MRS::{0}
IJ_Rse0=RST::{0}
IJ_Unkn0=UNKNOWN::{0}
# From util.java
Modified: db/derby/code/trunk/java/tools/org/apache/derby/tools/JDBCDisplayUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/tools/JDBCDisplayUtil.java?view=diff&rev=536100&r1=536099&r2=536100
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/tools/JDBCDisplayUtil.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/tools/JDBCDisplayUtil.java Mon May 7 23:49:55 2007
@@ -39,6 +39,8 @@
import java.util.Properties;
import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Vector;
import org.apache.derby.iapi.tools.i18n.LocalizedResource;
@@ -287,15 +289,34 @@
}
- /**
- @param out the place to write to
- @param rs the ResultSet to display
- @param conn the Connection against which the ResultSet was retrieved
- @param displayColumns Column numbers to display, or null if all
- @param displayColumnWidths Column widths, in characters, if displayColumns is specified.
+ /**
+ @param out the place to write to
+ @param resultSets List of ResultSet to display
+ @param conn the Connection against which the ResultSet was retrieved
+ @param displayColumns Column numbers to display, or null if all
+ @param displayColumnWidths Column widths, in characters, if displayColumns is specified.
+
+ @exception SQLException on JDBC access failure
+ */
+ static public void DisplayMultipleResults(PrintWriter out, List resultSets,
+ Connection conn,
+ int[] displayColumns,
+ int[] displayColumnWidths)
+ throws SQLException
+ {
+ indent_DisplayResults( out, resultSets, conn, 0, displayColumns,
+ displayColumnWidths);
+ }
- @exception SQLException on JDBC access failure
- */
+ /**
+ @param out the place to write to
+ @param rs the ResultSet to display
+ @param conn the Connection against which the ResultSet was retrieved
+ @param displayColumns Column numbers to display, or null if all
+ @param displayColumnWidths Column widths, in characters, if displayColumns is specified.
+
+ @exception SQLException on JDBC access failure
+ */
static public void DisplayResults(PrintWriter out, ResultSet rs, Connection conn,
int[] displayColumns, int[] displayColumnWidths)
throws SQLException
@@ -304,66 +325,90 @@
displayColumnWidths);
}
- static private void indent_DisplayResults
- (PrintWriter out, ResultSet rs, Connection conn, int indentLevel,
- int[] displayColumns, int[] displayColumnWidths)
- throws SQLException {
- ResultSetMetaData rsmd = rs.getMetaData();
- checkNotNull(rsmd, "ResultSetMetaData");
- Vector nestedResults;
- int numberOfRowsSelected = 0;
-
- // autocommit must be off or the nested cursors
- // are closed when the outer statement completes.
- if (!conn.getAutoCommit())
- nestedResults = new Vector();
- else
- nestedResults = null;
+ static private void indent_DisplayResults
+ (PrintWriter out, ResultSet rs, Connection conn, int indentLevel,
+ int[] displayColumns, int[] displayColumnWidths)
+ throws SQLException {
+ List resultSets = new ArrayList();
+ resultSets.add(rs);
+ indent_DisplayResults( out, resultSets, conn, 0, displayColumns,
+ displayColumnWidths);
+ }
- if(displayColumnWidths == null)
- displayColumnWidths = getColumnDisplayWidths(rsmd, displayColumns,true);
-
- int len = indent_DisplayBanner(out,rsmd, indentLevel, displayColumns,
- displayColumnWidths);
-
- // When displaying rows, keep going past errors
- // unless/until the maximum # of errors is reached.
- boolean doNext = true;
- int retry = 0;
- while (doNext) {
- try {
- doNext = rs.next();
- if (doNext) {
+ static private void indent_DisplayResults
+ (PrintWriter out, List resultSets, Connection conn, int indentLevel,
+ int[] displayColumns, int[] displayColumnWidths)
+ throws SQLException {
+
+ ResultSetMetaData rsmd = null;
+
+ //get metadata from the first ResultSet
+ if (resultSets != null && resultSets.size() > 0)
+ rsmd = ((ResultSet)resultSets.get(0)).getMetaData();
+
+ checkNotNull(rsmd, "ResultSetMetaData");
+ Vector nestedResults;
+ int numberOfRowsSelected = 0;
+
+ // autocommit must be off or the nested cursors
+ // are closed when the outer statement completes.
+ if (!conn.getAutoCommit())
+ nestedResults = new Vector();
+ else
+ nestedResults = null;
+
+ if(displayColumnWidths == null)
+ displayColumnWidths = getColumnDisplayWidths(rsmd,
+ displayColumns,true);
+
+ int len = indent_DisplayBanner(out,rsmd, indentLevel, displayColumns,
+ displayColumnWidths);
+
+ // When displaying rows, keep going past errors
+ // unless/until the maximum # of errors is reached.
+ int retry = 0;
+
+ ResultSet rs = null;
+ boolean doNext = true;
+ for (int i = 0; i< resultSets.size(); i++) {
+ rs = (ResultSet)resultSets.get(i);
+ doNext = true;
+ while (doNext){
+ try {
+ doNext = rs.next();
+ if (doNext) {
+
+ DisplayRow(out, rs, rsmd, len, nestedResults, conn,
+ indentLevel, displayColumns,
+ displayColumnWidths);
+ ShowWarnings(out, rs);
+ numberOfRowsSelected++;
+ }
+ } catch (SQLException e) {
+ // REVISIT: might want to check the exception
+ // and for some, not bother with the retry.
+ if (++retry > MAX_RETRIES)
+ throw e;
+ else
+ ShowSQLException(out, e);
+ }
+ }
+ }
+ if (showSelectCount == true) {
+ if (numberOfRowsSelected == 1) {
+ out.println();
+ indentedPrintLine( out, indentLevel, LocalizedResource.getMessage("UT_1RowSelec"));
+ } else if (numberOfRowsSelected >= 0) {
+ out.println();
+ indentedPrintLine( out, indentLevel,
+ LocalizedResource.getMessage("UT_0RowsSelec", LocalizedResource.getNumber(numberOfRowsSelected)));
+ }
+ }
- DisplayRow(out, rs, rsmd, len, nestedResults, conn,
- indentLevel, displayColumns,
- displayColumnWidths);
- ShowWarnings(out, rs);
- numberOfRowsSelected++;
- }
- } catch (SQLException e) {
- // REVISIT: might want to check the exception
- // and for some, not bother with the retry.
- if (++retry > MAX_RETRIES)
- throw e;
- else
- ShowSQLException(out, e);
- }
- }
- if (showSelectCount == true) {
- if (numberOfRowsSelected == 1) {
- out.println();
- indentedPrintLine( out, indentLevel, LocalizedResource.getMessage("UT_1RowSelec"));
- } else if (numberOfRowsSelected >= 0) {
- out.println();
- indentedPrintLine( out, indentLevel,
- LocalizedResource.getMessage("UT_0RowsSelec", LocalizedResource.getNumber(numberOfRowsSelected)));
- }
- }
+ DisplayNestedResults(out, nestedResults, conn, indentLevel );
+ nestedResults = null;
+ }
- DisplayNestedResults(out, nestedResults, conn, indentLevel );
- nestedResults = null;
- }
/**
@param out the place to write to