ojb.broker.accesslayer
Class SqlGenerator

java.lang.Object
  |
  +--ojb.broker.accesslayer.SqlGenerator

public class SqlGenerator
extends java.lang.Object

This Class is responsible for building sql statements Objects fields and their repective values are accessed by Java reflection

Author:
Thomas Mahler

Method Summary
protected  java.lang.String asSQLClause(SelectionCriteria c, ClassDescriptor cld)
          Answer the SQL-Clause for a SelectionCriteria
 java.lang.String asSQLStatement(Criteria crit, ClassDescriptor cld)
           
 java.lang.String getDeleteStatement(java.lang.String table, java.lang.Object[] columns, java.lang.Object[] values)
          generate a prepared DELETE-Statement for the Class described by mif
 java.lang.String getInsertStatement(java.lang.String table, java.lang.Object[] columns, java.lang.Object[] values)
          generate a prepared INSERT-Statement for the Class described by mif
static SqlGenerator getInstance()
          returns the singleton instance
 java.lang.String getPreparedCountStatement(Query query, ClassDescriptor mif)
          generate a Count(*) statement BRJ
 java.lang.String getPreparedDeleteStatement(ClassDescriptor mif)
          generate a prepared DELETE-Statement for the Class described by mif.
 java.lang.String getPreparedInsertStatement(ClassDescriptor mif)
          generate a prepared INSERT-Statement for the Class described by mif.
 java.lang.String getPreparedSelectByPkStatement(ClassDescriptor mif)
          generate a prepared SELECT-Statement for the Class described by mif
 java.lang.String getPreparedSelectStatement(Query query, ClassDescriptor mif)
          generate a select-Statement according to the constraints given by the values in vecValues that correspond to the fields in vecFields
 java.lang.String getPreparedUpdateStatement(ClassDescriptor mif)
          generate a prepared UPDATE-Statement for the Class described by mif
 java.lang.String getSelectStatementDep(Query query, ClassDescriptor mif)
          generate a select-Statement according to the constraints given by the values in vecValues that correspond to the fields in vecFields
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SqlGenerator getInstance()
returns the singleton instance


asSQLClause

protected java.lang.String asSQLClause(SelectionCriteria c,
                                       ClassDescriptor cld)
Answer the SQL-Clause for a SelectionCriteria

Parameters:
c - SelectionCriteria
cld - ClassDescriptor

asSQLStatement

public java.lang.String asSQLStatement(Criteria crit,
                                       ClassDescriptor cld)

getPreparedCountStatement

public java.lang.String getPreparedCountStatement(Query query,
                                                  ClassDescriptor mif)
generate a Count(*) statement BRJ


getPreparedDeleteStatement

public java.lang.String getPreparedDeleteStatement(ClassDescriptor mif)
generate a prepared DELETE-Statement for the Class described by mif.

Parameters:
mif - the ClassDescriptor

getPreparedInsertStatement

public java.lang.String getPreparedInsertStatement(ClassDescriptor mif)
generate a prepared INSERT-Statement for the Class described by mif.

Parameters:
mif - the ClassDescriptor

getPreparedSelectByPkStatement

public java.lang.String getPreparedSelectByPkStatement(ClassDescriptor mif)
generate a prepared SELECT-Statement for the Class described by mif

Parameters:
mif - the ClassDescriptor

getPreparedSelectStatement

public java.lang.String getPreparedSelectStatement(Query query,
                                                   ClassDescriptor mif)
generate a select-Statement according to the constraints given by the values in vecValues that correspond to the fields in vecFields


getPreparedUpdateStatement

public java.lang.String getPreparedUpdateStatement(ClassDescriptor mif)
generate a prepared UPDATE-Statement for the Class described by mif

Parameters:
mif - the ClassDescriptor

getInsertStatement

public java.lang.String getInsertStatement(java.lang.String table,
                                           java.lang.Object[] columns,
                                           java.lang.Object[] values)
generate a prepared INSERT-Statement for the Class described by mif


getDeleteStatement

public java.lang.String getDeleteStatement(java.lang.String table,
                                           java.lang.Object[] columns,
                                           java.lang.Object[] values)
generate a prepared DELETE-Statement for the Class described by mif


getSelectStatementDep

public java.lang.String getSelectStatementDep(Query query,
                                              ClassDescriptor mif)
generate a select-Statement according to the constraints given by the values in vecValues that correspond to the fields in vecFields



Authors: Thomas Mahler and others. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.8.375, 2002-04-04