net.sf.colle.sql.persistence
Class StatementManager

java.lang.Object
  extended bynet.sf.colle.sql.persistence.StatementManager

public class StatementManager
extends Object

Provides convenience methods for working with prepared statements. Created: 07 Mar 2001

Version:
$Revision: 1.9 $, $Date: 2004/07/10 04:23:53 $
Author:
Dwayne Schultz

Constructor Summary
StatementManager()
           
 
Method Summary
static PreparedStatement getPreparedStatement(String psSQL, Connection pxConnection)
          Pools prepared statements for each database connection (or at least it will in the near future).
static String makeInClause(String psStatement, int pnCount)
          Replaces the first '~' with '(?, ?, ?  ...)' for use in a SQL 'where x in' clause.
static String makeOrderByClause(String[] pxOrderByColumns, boolean[] pxOrderByDirections)
          Makes an order by clause based on the orders and directions specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatementManager

public StatementManager()
Method Detail

getPreparedStatement

public static PreparedStatement getPreparedStatement(String psSQL,
                                                     Connection pxConnection)
                                              throws SQLException
Pools prepared statements for each database connection (or at least it will in the near future).

Throws:
SQLException

makeInClause

public static String makeInClause(String psStatement,
                                  int pnCount)
Replaces the first '~' with '(?, ?, ?  ...)' for use in a SQL 'where x in' clause.

Parameters:
psStatement - SQL statement containing at least one '~'
pnCount - number of '?' that will be added
Returns:
SQL statement with the newly added 'in' clause

makeOrderByClause

public static String makeOrderByClause(String[] pxOrderByColumns,
                                       boolean[] pxOrderByDirections)
Makes an order by clause based on the orders and directions specified.

Parameters:
pxOrderByColumns - columns in order of precedence to order by
pxOrderByDirections - direction for column to be order by. This array must be at least as large as pxOrderByColumns.
Returns:
the clause