com.darwinsys.sql
Class SQLUtils

java.lang.Object
  extended by com.darwinsys.sql.SQLUtils

public class SQLUtils
extends java.lang.Object

Miscellaneous utilities for dealing with SQL. XXX Consider replacing with ResultSetDecoratorHTML

Author:
ian

Constructor Summary
SQLUtils()
           
 
Method Summary
static void cleanup(java.sql.ResultSet rs, java.sql.Statement st, java.sql.Connection conn)
          Close a resultset, statement and connection in the correct order.
static void resultSetToHTML(java.sql.ResultSet rs, java.io.PrintWriter out)
           
static void resultSetToHTML(java.sql.ResultSet rs, java.io.PrintWriter out, java.lang.String titleStyle, java.lang.String style1, java.lang.String style2, java.lang.String keyColName, java.lang.String link)
          Process resultset, formatting it as HTML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLUtils

public SQLUtils()
Method Detail

resultSetToHTML

public static void resultSetToHTML(java.sql.ResultSet rs,
                                   java.io.PrintWriter out,
                                   java.lang.String titleStyle,
                                   java.lang.String style1,
                                   java.lang.String style2,
                                   java.lang.String keyColName,
                                   java.lang.String link)
                            throws java.sql.SQLException
Process resultset, formatting it as HTML

Parameters:
rs - The valid ResultSet, which will be closed.
out - A PrintWriter to generate HTML to.
style1 - CSS style name for title and data rows 2, 4, 6, ...
style2 - CSS style name for data rows 1, 3, 5, ...
titleStyle - CSS style name for title row (may be same as style1)
Throws:
java.sql.SQLException

resultSetToHTML

public static void resultSetToHTML(java.sql.ResultSet rs,
                                   java.io.PrintWriter out)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

cleanup

public static void cleanup(java.sql.ResultSet rs,
                           java.sql.Statement st,
                           java.sql.Connection conn)
Close a resultset, statement and connection in the correct order.

Parameters:
rs -
st -
conn -
Throws:
DatabaseException - if any of the closes catches a SQLException.


Copyright © 1996-2004 Ian F. Darwin. See license.html for usage license.