net.sf.voruta
Class DbUtils

java.lang.Object
  |
  +--net.sf.voruta.DbUtils

public final class DbUtils
extends java.lang.Object

helper methods


Field Summary
static java.lang.String DEBUG
           
static java.lang.String JDBC_CONNECTION
           
 
Constructor Summary
DbUtils()
           
 
Method Summary
static DbResultSet adapter(java.sql.ResultSet rs)
           
static java.lang.Object executeQuery(java.lang.String name, java.lang.String query, java.lang.Object[] vals, ResultSetHandler rsh, java.lang.Class type, java.lang.Object[] userObject)
          executes SQL query
static int executeUpdate(java.lang.String name, java.lang.String query, java.lang.Object[] vals)
          executes SQL update statement
static Log getLog()
           
static void printStackTrace(java.sql.SQLException sqle)
           
static void printStackTrace(java.sql.SQLException sqle, java.io.PrintWriter ps)
           
static void printWarnings(java.sql.Connection connection)
           
static void printWarnings(java.sql.Connection connection, java.io.PrintWriter ps)
           
static java.lang.Object resultSetToArray(DbResultSet rs, java.lang.Class type)
          Create an Object array from a ResultSet.
static java.lang.Object resultSetToBean(DbResultSet rs, java.lang.Object obj)
          Create an Bean from a ResultSet.
static void resultSetToBeanCollection(DbResultSet rs, java.lang.Class cls, java.util.Collection results)
          optimized for collections of beans
static void resultSetToBeanMap(DbResultSet rs, java.lang.Class cls, java.util.Map results, java.lang.String propertyName)
           
static void resultSetToMap(DbResultSet rs, java.util.Map result)
          Create an Map from a ResultSet.
static void setLog(Log log)
          Used to set custom logger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JDBC_CONNECTION

public static final java.lang.String JDBC_CONNECTION

DEBUG

public static final java.lang.String DEBUG
Constructor Detail

DbUtils

public DbUtils()
Method Detail

setLog

public static void setLog(Log log)
Used to set custom logger
Parameters:
log - Log interface implementation

getLog

public static Log getLog()

adapter

public static DbResultSet adapter(java.sql.ResultSet rs)

executeQuery

public static java.lang.Object executeQuery(java.lang.String name,
                                            java.lang.String query,
                                            java.lang.Object[] vals,
                                            ResultSetHandler rsh,
                                            java.lang.Class type,
                                            java.lang.Object[] userObject)
                                     throws java.lang.Exception
executes SQL query
Parameters:
connection -  
query -  
vals -  
rsh -  
userObject -  
Returns:
 

executeUpdate

public static int executeUpdate(java.lang.String name,
                                java.lang.String query,
                                java.lang.Object[] vals)
                         throws java.lang.Exception
executes SQL update statement
Parameters:
connection -  
query -  
vals -  
Returns:
 

resultSetToMap

public static void resultSetToMap(DbResultSet rs,
                                  java.util.Map result)
                           throws java.lang.Exception
Create an Map from a ResultSet. It is assumed that next() has already been called on the ResultSet.

resultSetToBean

public static java.lang.Object resultSetToBean(DbResultSet rs,
                                               java.lang.Object obj)
                                        throws java.lang.Exception
Create an Bean from a ResultSet. It is assumed that next() has already been called on the ResultSet.

resultSetToBeanMap

public static void resultSetToBeanMap(DbResultSet rs,
                                      java.lang.Class cls,
                                      java.util.Map results,
                                      java.lang.String propertyName)
                               throws java.lang.Exception

resultSetToBeanCollection

public static void resultSetToBeanCollection(DbResultSet rs,
                                             java.lang.Class cls,
                                             java.util.Collection results)
                                      throws java.lang.Exception
optimized for collections of beans

resultSetToArray

public static java.lang.Object resultSetToArray(DbResultSet rs,
                                                java.lang.Class type)
                                         throws java.lang.Exception
Create an Object array from a ResultSet. It is assumed that next() has already been called on the ResultSet.

printStackTrace

public static void printStackTrace(java.sql.SQLException sqle,
                                   java.io.PrintWriter ps)
Parameters:
sqle -  
ps -  

printStackTrace

public static void printStackTrace(java.sql.SQLException sqle)
Parameters:
sqle -  

printWarnings

public static void printWarnings(java.sql.Connection connection,
                                 java.io.PrintWriter ps)
Parameters:
connection -  
ps -  

printWarnings

public static void printWarnings(java.sql.Connection connection)
Parameters:
connection -  


Copyright © 2003-2004 voruta. All Rights Reserved.