Class Hierarchy Previous Next Index
Class COM.cloudscape.util.JDBCDisplayUtil
java.lang.Object
|
+----COM.cloudscape.util.JDBCDisplayUtil
- public class JDBCDisplayUtil
- extends java.lang.Object
Copyright © 1998-2000, Informix Software, 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)
-
DisplayBanner(PrintWriter, ResultSetMetaData)
- Print a banner containing the column labels separated with '|'s
and a line of '-'s.
DisplayCurrentRow(PrintStream, ResultSet, Connection)
-
DisplayCurrentRow(PrintWriter, ResultSet, Connection)
- Display the current row of the result set along with
a banner.
DisplayNextRow(PrintStream, ResultSet, Connection)
-
DisplayNextRow(PrintWriter, 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)
-
DisplayResults(PrintWriter, ResultSet, Connection)
-
DisplayResults(PrintWriter, Statement, Connection)
- Pretty-print the results of a statement that has been executed.
doTrace(PrintStream, Exception)
-
doTrace(PrintWriter, Exception)
- If the property ij.exceptionTrace is true, display the stack
trace to the print stream.
init()
- init method - will init the class to support a locale and
codeset based on the cloudscape.ui.locale and cloudscape.ui.codeset
properties if exists or using the default values from the JVM.
init(String)
- init method - will init the class to support a locale and
codeset based on the cloudscape.ui.locale properties and on the
given codeset if exists or using the default values from the JVM.
init(String, String)
- init method - will init the class to support a locale and
codeset based on the given codeset and locale.
mapNull(String, String)
- Map the string to the value if it is null.
setMaxDisplayWidth(int)
-
ShowException(PrintStream, Throwable)
-
ShowException(PrintWriter, Throwable)
- Print information about the exception to the given PrintWriter.
ShowSQLException(PrintStream, SQLException)
-
ShowSQLException(PrintWriter, SQLException)
- Print information about the SQL exception to the given PrintWriter.
ShowWarnings(PrintStream, Connection)
-
ShowWarnings(PrintStream, ResultSet)
-
ShowWarnings(PrintStream, SQLWarning)
-
ShowWarnings(PrintStream, Statement)
-
ShowWarnings(PrintWriter, Connection)
- Print information about the SQL warnings for the connection
to the given PrintWriter.
ShowWarnings(PrintWriter, ResultSet)
- Print information about the SQL warnings for the ResultSet
to the given PrintWriter.
ShowWarnings(PrintWriter, SQLWarning)
-
ShowWarnings(PrintWriter, Statement)
- Print information about the SQL warnings for the Statement
to the given PrintWriter.
showSelectCount
public static boolean showSelectCount
init
public static boolean init()
init method - will init the class to support a locale and
codeset based on the cloudscape.ui.locale and cloudscape.ui.codeset
properties if exists or using the default values from the JVM.
init
public static boolean init(java.lang.String codeset)
init method - will init the class to support a locale and
codeset based on the cloudscape.ui.locale properties and on the
given codeset if exists or using the default values from the JVM.
init
public static boolean init(java.lang.String pCodeset,
java.lang.String pLocale)
init method - will init the class to support a locale and
codeset based on the given codeset and locale.
If the parameters are null it will try to init use cloudscape.ui.locale
and cloudscape.ui.codeset properties if exists or using the default
values from the JVM.
ShowException
public static void ShowException(java.io.PrintWriter out,
java.lang.Throwable e)
Print information about the exception to the given PrintWriter.
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(java.io.PrintWriter out,
java.sql.SQLException e)
Print information about the SQL exception to the given PrintWriter.
Walk the list of exceptions, if any.
- Parameters:
out
- the place to write to
e
- the exception to display
ShowWarnings
public static void ShowWarnings(java.io.PrintWriter out,
java.sql.Connection theConnection)
Print information about the SQL warnings for the connection
to the given PrintWriter.
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(java.io.PrintWriter out,
java.sql.SQLWarning warning)
- Parameters:
out
- the place to write to
warning
- the SQLWarning
ShowWarnings
public static void ShowWarnings(java.io.PrintWriter out,
java.sql.ResultSet rs)
Print information about the SQL warnings for the ResultSet
to the given PrintWriter.
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(java.io.PrintWriter out,
java.sql.Statement s)
Print information about the SQL warnings for the Statement
to the given PrintWriter.
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(java.io.PrintWriter out,
java.sql.Statement stmt,
java.sql.Connection conn) throws java.sql.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:
- java.sql.SQLException - on JDBC access failure
DisplayResults
public static void DisplayResults(java.io.PrintWriter out,
java.sql.ResultSet rs,
java.sql.Connection conn) throws java.sql.SQLException
- Parameters:
out
- the place to write to
rs
- the ResultSet to display
conn
- the Connection against which the ResultSet was retrieved
- Throws:
- java.sql.SQLException - on JDBC access failure
DisplayNextRow
public static void DisplayNextRow(java.io.PrintWriter out,
java.sql.ResultSet rs,
java.sql.Connection conn) throws java.sql.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:
- java.sql.SQLException - on JDBC access failure
DisplayCurrentRow
public static void DisplayCurrentRow(java.io.PrintWriter out,
java.sql.ResultSet rs,
java.sql.Connection conn) throws java.sql.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:
- java.sql.SQLException - on JDBC access failure
DisplayBanner
public static int DisplayBanner(java.io.PrintWriter out,
java.sql.ResultSetMetaData rsmd) throws java.sql.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:
- java.sql.SQLException - on JDBC access failure
checkNotNull
public static void checkNotNull(java.lang.Object o,
java.lang.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 java.lang.String mapNull(java.lang.String s,
java.lang.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(java.io.PrintWriter out,
java.lang.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)
ShowException
public static void ShowException(java.io.PrintStream out,
java.lang.Throwable e)
ShowSQLException
public static void ShowSQLException(java.io.PrintStream out,
java.sql.SQLException e)
ShowWarnings
public static void ShowWarnings(java.io.PrintStream out,
java.sql.Connection theConnection)
ShowWarnings
public static void ShowWarnings(java.io.PrintStream out,
java.sql.SQLWarning warning)
ShowWarnings
public static void ShowWarnings(java.io.PrintStream out,
java.sql.ResultSet rs)
ShowWarnings
public static void ShowWarnings(java.io.PrintStream out,
java.sql.Statement s)
DisplayResults
public static void DisplayResults(java.io.PrintStream out,
java.sql.Statement stmt,
java.sql.Connection conn) throws java.sql.SQLException
DisplayResults
public static void DisplayResults(java.io.PrintStream out,
java.sql.ResultSet rs,
java.sql.Connection conn) throws java.sql.SQLException
DisplayNextRow
public static void DisplayNextRow(java.io.PrintStream out,
java.sql.ResultSet rs,
java.sql.Connection conn) throws java.sql.SQLException
DisplayCurrentRow
public static void DisplayCurrentRow(java.io.PrintStream out,
java.sql.ResultSet rs,
java.sql.Connection conn) throws java.sql.SQLException
DisplayBanner
public static int DisplayBanner(java.io.PrintStream out,
java.sql.ResultSetMetaData rsmd) throws java.sql.SQLException
doTrace
public static void doTrace(java.io.PrintStream out,
java.lang.Exception e)
Class Hierarchy Previous Next Index