org.apache.ojb.broker.accesslayer.sql
Class SqlGeneratorDefaultImpl

java.lang.Object
  extended byorg.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl
All Implemented Interfaces:
SqlGenerator

public class SqlGeneratorDefaultImpl
extends java.lang.Object
implements SqlGenerator

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

Version:
$Id: SqlGeneratorDefaultImpl.java,v 1.21 2004/02/14 19:36:53 brj Exp $
Author:
Thomas Mahler, Ron Gallagher, Randall Burt

Constructor Summary
SqlGeneratorDefaultImpl(Platform pf)
          Constructor is protected, use getInstance() to retrieve the singleton instance of this class.
 
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 getDeleteMNStatement(java.lang.String table, java.lang.String[] pkColumns1, java.lang.String[] pkColumns2)
          generate a DELETE-Statement for M:N indirection table
 java.lang.String getInsertMNStatement(java.lang.String table, java.lang.String[] pkColumns1, java.lang.String[] pkColumns2)
          generate an INSERT-Statement for M:N indirection table
 Platform getPlatform()
          Answer the Platform used by the SqlGenerator
 java.lang.String getPreparedDeleteStatement(ClassDescriptor cld)
          generate a prepared DELETE-Statement for the Class described by cld.
 java.lang.String getPreparedDeleteStatement(Query query, ClassDescriptor cld)
          generate a prepared DELETE-Statement according to query
 java.lang.String getPreparedInsertStatement(ClassDescriptor cld)
          generate a prepared INSERT-Statement for the Class described by cld.
 java.lang.String getPreparedSelectByPkStatement(ClassDescriptor cld)
          generate a prepared SELECT-Statement for the Class described by cld
 java.lang.String getPreparedSelectStatement(Query query, ClassDescriptor cld)
          generate a select-Statement according to query
 java.lang.String getPreparedUpdateStatement(ClassDescriptor cld)
          generate a prepared UPDATE-Statement for the Class described by cld
 java.lang.String getSelectMNStatement(java.lang.String table, java.lang.String[] selectColumns, java.lang.String[] columns)
          generate a SELECT-Statement for M:N indirection table
 java.lang.String getSelectStatementDep(Query query, ClassDescriptor cld)
          generate a select-Statement according to query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlGeneratorDefaultImpl

public SqlGeneratorDefaultImpl(Platform pf)
Constructor is protected, use getInstance() to retrieve the singleton instance of this class.

Method Detail

getPreparedDeleteStatement

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

Specified by:
getPreparedDeleteStatement in interface SqlGenerator
Parameters:
cld - the ClassDescriptor

getPreparedInsertStatement

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

Specified by:
getPreparedInsertStatement in interface SqlGenerator
Parameters:
cld - the ClassDescriptor

getPreparedSelectByPkStatement

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

Specified by:
getPreparedSelectByPkStatement in interface SqlGenerator
Parameters:
cld - the ClassDescriptor

getPreparedSelectStatement

public java.lang.String getPreparedSelectStatement(Query query,
                                                   ClassDescriptor cld)
generate a select-Statement according to query

Specified by:
getPreparedSelectStatement in interface SqlGenerator
Parameters:
query - the Query
cld - the ClassDescriptor

getPreparedUpdateStatement

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

Specified by:
getPreparedUpdateStatement in interface SqlGenerator
Parameters:
cld - the ClassDescriptor

getInsertMNStatement

public java.lang.String getInsertMNStatement(java.lang.String table,
                                             java.lang.String[] pkColumns1,
                                             java.lang.String[] pkColumns2)
generate an INSERT-Statement for M:N indirection table

Specified by:
getInsertMNStatement in interface SqlGenerator
Parameters:
table -
pkColumns1 -
pkColumns2 -
Returns:
String

getSelectMNStatement

public java.lang.String getSelectMNStatement(java.lang.String table,
                                             java.lang.String[] selectColumns,
                                             java.lang.String[] columns)
generate a SELECT-Statement for M:N indirection table

Specified by:
getSelectMNStatement in interface SqlGenerator
Parameters:
table - the indirection table
selectColumns - selected columns
columns - for where

getDeleteMNStatement

public java.lang.String getDeleteMNStatement(java.lang.String table,
                                             java.lang.String[] pkColumns1,
                                             java.lang.String[] pkColumns2)
generate a DELETE-Statement for M:N indirection table

Specified by:
getDeleteMNStatement in interface SqlGenerator
Parameters:
table -
pkColumns1 -
pkColumns2 -
Returns:
String

getSelectStatementDep

public java.lang.String getSelectStatementDep(Query query,
                                              ClassDescriptor cld)
generate a select-Statement according to query

Specified by:
getSelectStatementDep in interface SqlGenerator
Parameters:
query - the Query
cld - the ClassDescriptor

asSQLStatement

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

asSQLClause

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

Parameters:
c - SelectionCriteria
cld - ClassDescriptor

getPreparedDeleteStatement

public java.lang.String getPreparedDeleteStatement(Query query,
                                                   ClassDescriptor cld)
generate a prepared DELETE-Statement according to query

Specified by:
getPreparedDeleteStatement in interface SqlGenerator
Parameters:
query - the Query
cld - the ClassDescriptor

getPlatform

public Platform getPlatform()
Description copied from interface: SqlGenerator
Answer the Platform used by the SqlGenerator

Specified by:
getPlatform in interface SqlGenerator
Returns:
Platform


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14