Class Hierarchy Index
Class COM.cloudscape.util.JDBCDisplayUtil
java.lang.Object
|
+----COM.cloudscape.util.JDBCDisplayUtil
- public class JDBCDisplayUtil
- extends Object
Copyright © 1998-1999, Cloudscape, Inc. All rights reserved.
This class contains utility methods for displaying JDBC objects
and results on a console/ASCII terminal.
All of the methods are static. The output stream
to write to is always passed in, along with the
JDBC objects to display.
-
showSelectCount
-
-
checkNotNull(Object, String)
- Check if an object is null, and if it is, throw an exception
with an informative parameter about what was null.
-
DisplayBanner(PrintStream, ResultSetMetaData)
- Print a banner containing the column labels separated with '|'s
and a line of '-'s.
-
DisplayCurrentRow(PrintStream, ResultSet, Connection)
- Display the current row of the result set along with
a banner.
-
DisplayNextRow(PrintStream, ResultSet, Connection)
- Fetch the next row of the result set, and if it
exists format and display a banner and the row.
-
DisplayResults(PrintStream, ResultSet, Connection)
-
-
DisplayResults(PrintStream, Statement, Connection)
- Pretty-print the results of a statement that has been executed.
-
doTrace(PrintStream, Exception)
- If the property ij.exceptionTrace is true, display the stack
trace to the print stream.
-
mapNull(String, String)
- Map the string to the value if it is null.
-
setMaxDisplayWidth(int)
-
-
ShowException(PrintStream, Throwable)
- Print information about the exception to the given PrintStream.
-
ShowSQLException(PrintStream, SQLException)
- Print information about the SQL exception to the given PrintStream.
-
ShowWarnings(PrintStream, Connection)
- Print information about the SQL warnings for the connection
to the given PrintStream.
-
ShowWarnings(PrintStream, ResultSet)
- Print information about the SQL warnings for the ResultSet
to the given PrintStream.
-
ShowWarnings(PrintStream, SQLWarning)
-
-
ShowWarnings(PrintStream, Statement)
- Print information about the SQL warnings for the Statement
to the given PrintStream.
showSelectCount
public static boolean showSelectCount
ShowException
public static void ShowException(PrintStream out,
Throwable e)
- Print information about the exception to the given PrintStream.
For non-SQLExceptions, does a stack trace. For SQLExceptions,
print a standard error message and walk the list, if any.
- Parameters:
- out - the place to write to
- e - the exception to display
ShowSQLException
public static void ShowSQLException(PrintStream out,
SQLException e)
- Print information about the SQL exception to the given PrintStream.
Walk the list of exceptions, if any.
- Parameters:
- out - the place to write to
- e - the exception to display
ShowWarnings
public static void ShowWarnings(PrintStream out,
Connection theConnection)
- Print information about the SQL warnings for the connection
to the given PrintStream.
Walks the list of exceptions, if any.
- Parameters:
- out - the place to write to
- theConnection - the connection that may have warnings.
ShowWarnings
public static void ShowWarnings(PrintStream out,
SQLWarning warning)
- Parameters:
- out - the place to write to
- warning - the SQLWarning
ShowWarnings
public static void ShowWarnings(PrintStream out,
ResultSet rs)
- Print information about the SQL warnings for the ResultSet
to the given PrintStream.
Walk the list of exceptions, if any.
- Parameters:
- out - the place to write to
- rs - the ResultSet that may have warnings on it
ShowWarnings
public static void ShowWarnings(PrintStream out,
Statement s)
- Print information about the SQL warnings for the Statement
to the given PrintStream.
Walks the list of exceptions, if any.
- Parameters:
- out - the place to write to
- s - the Statement that may have warnings on it
DisplayResults
public static void DisplayResults(PrintStream out,
Statement stmt,
Connection conn) throws SQLException
- Pretty-print the results of a statement that has been executed.
If it is a select, gathers and prints the results. Display
partial results up to the first error.
If it is not a SELECT, determine if rows were involved or not,
and print the appropriate message.
- Parameters:
- out - the place to write to
- stmt - the Statement to display
- conn - the Connection against which the statement was executed
- Throws: SQLException
- on JDBC access failure
DisplayResults
public static void DisplayResults(PrintStream out,
ResultSet rs,
Connection conn) throws SQLException
- Parameters:
- out - the place to write to
- rs - the ResultSet to display
- conn - the Connection against which the ResultSet was retrieved
- Throws: SQLException
- on JDBC access failure
DisplayNextRow
public static void DisplayNextRow(PrintStream out,
ResultSet rs,
Connection conn) throws SQLException
- Fetch the next row of the result set, and if it
exists format and display a banner and the row.
- Parameters:
- out - the place to write to
- rs - the ResultSet in use
- conn - the Connection against which the ResultSet was retrieved
- Throws: SQLException
- on JDBC access failure
DisplayCurrentRow
public static void DisplayCurrentRow(PrintStream out,
ResultSet rs,
Connection conn) throws SQLException
- Display the current row of the result set along with
a banner. Assume the result set is on a row.
- Parameters:
- out - the place to write to
- rs - the ResultSet in use
- conn - the Connection against which the ResultSet was retrieved
- Throws: SQLException
- on JDBC access failure
DisplayBanner
public static int DisplayBanner(PrintStream out,
ResultSetMetaData rsmd) throws SQLException
- Print a banner containing the column labels separated with '|'s
and a line of '-'s. Each field is as wide as the display
width reported by the metadata.
- Parameters:
- out - the place to write to
- rsmd - the ResultSetMetaData to use
- Throws: SQLException
- on JDBC access failure
checkNotNull
public static void checkNotNull(Object o,
String what)
- Check if an object is null, and if it is, throw an exception
with an informative parameter about what was null.
The exception is a run-time exception that is internal to ij.
- Parameters:
- o - the object to test
- what - the information to include in the error if it is null
mapNull
public static String mapNull(String s,
String nullValue)
- Map the string to the value if it is null.
- Parameters:
- s - the string to test for null
- nullValue - the value to use if s is null
- Returns:
- if s is non-null, s; else nullValue.
doTrace
public static void doTrace(PrintStream out,
Exception e)
- If the property ij.exceptionTrace is true, display the stack
trace to the print stream. Otherwise, do nothing.
- Parameters:
- out - the output stream to write to
- e - the exception to display
setMaxDisplayWidth
public static void setMaxDisplayWidth(int maxDisplayWidth)
Class Hierarchy Index