|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl
public class SqlGeneratorDefaultImpl
This Class is responsible for building sql statements Objects fields and their repective values are accessed by Java reflection
Nested Class Summary | |
---|---|
static class |
SqlGeneratorDefaultImpl.SqlForClass
This class serves as a cache for sql-Statements used for persistence operations. |
Field Summary | |
---|---|
private Logger |
logger
|
private Platform |
m_platform
|
private Map |
sqlForClass
Cache for SqlGeneratorDefaultImpl.SqlForClass instances, keyed per class descriptor. |
Constructor Summary | |
---|---|
SqlGeneratorDefaultImpl(Platform platform)
|
Method Summary | |
---|---|
protected String |
asSQLClause(SelectionCriteria c,
ClassDescriptor cld)
Answer the SQL-Clause for a SelectionCriteria |
String |
asSQLStatement(Criteria crit,
ClassDescriptor cld)
|
String |
getDeleteMNStatement(String table,
String[] pkColumns1,
String[] pkColumns2)
generate a DELETE-Statement for M:N indirection table |
String |
getInsertMNStatement(String table,
String[] pkColumns1,
String[] pkColumns2)
generate an INSERT-Statement for M:N indirection table |
Platform |
getPlatform()
Answer the Platform used by the SqlGenerator |
SqlStatement |
getPreparedDeleteStatement(ClassDescriptor cld)
generate a prepared DELETE-Statement for the Class described by cld. |
SqlStatement |
getPreparedDeleteStatement(Query query,
ClassDescriptor cld)
generate a prepared DELETE-Statement according to query |
SqlStatement |
getPreparedExistsStatement(ClassDescriptor cld)
|
SqlStatement |
getPreparedInsertStatement(ClassDescriptor cld)
generate a prepared INSERT-Statement for the Class described by cld. |
SelectStatement |
getPreparedSelectByPkStatement(ClassDescriptor cld)
generate a prepared SELECT-Statement for the Class described by cld |
SelectStatement |
getPreparedSelectStatement(Query query,
ClassDescriptor cld)
generate a select-Statement according to query |
SqlStatement |
getPreparedUpdateStatement(ClassDescriptor cld)
generate a prepared UPDATE-Statement for the Class described by cld |
String |
getSelectMNStatement(String table,
String[] selectColumns,
String[] columns)
generate a SELECT-Statement for M:N indirection table |
SelectStatement |
getSelectStatementDep(Query query,
ClassDescriptor cld)
generate a select-Statement according to query |
protected SqlGeneratorDefaultImpl.SqlForClass |
getSqlForClass(ClassDescriptor cld)
Returns the SqlGeneratorDefaultImpl.SqlForClass instance for
the given class descriptor. |
protected SqlGeneratorDefaultImpl.SqlForClass |
newInstanceSqlForClass()
User who want to extend this implementation can override this method to use their own (extended) version of SqlGeneratorDefaultImpl.SqlForClass . |
private String |
toSQLClause(BetweenCriteria c,
ClassDescriptor cld)
Answer the SQL-Clause for a BetweenCriteria |
private String |
toSQLClause(ExistsCriteria c,
ClassDescriptor cld)
Answer the SQL-Clause for an ExistsCriteria |
private String |
toSQLClause(FieldCriteria c,
ClassDescriptor cld)
Answer the SQL-Clause for a FieldCriteria |
private String |
toSQLClause(InCriteria c)
Answer the SQL-Clause for an InCriteria |
private String |
toSQLClause(NullCriteria c)
Answer the SQL-Clause for a NullCriteria |
private String |
toSqlClause(Object attributeOrQuery,
ClassDescriptor cld)
|
private String |
toSQLClause(SelectionCriteria c,
ClassDescriptor cld)
Answer the SQL-Clause for a SelectionCriteria |
private String |
toSQLClause(SqlCriteria c)
Answer the SQL-Clause for a SqlCriteria |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Logger logger
private Platform m_platform
private Map sqlForClass
SqlGeneratorDefaultImpl.SqlForClass
instances, keyed per class descriptor.
Constructor Detail |
---|
public SqlGeneratorDefaultImpl(Platform platform)
Method Detail |
---|
public SqlStatement getPreparedDeleteStatement(ClassDescriptor cld)
getPreparedDeleteStatement
in interface SqlGenerator
cld
- the ClassDescriptorpublic SqlStatement getPreparedInsertStatement(ClassDescriptor cld)
getPreparedInsertStatement
in interface SqlGenerator
cld
- the ClassDescriptorpublic SelectStatement getPreparedSelectByPkStatement(ClassDescriptor cld)
getPreparedSelectByPkStatement
in interface SqlGenerator
cld
- the ClassDescriptorpublic SqlStatement getPreparedExistsStatement(ClassDescriptor cld)
public SelectStatement getPreparedSelectStatement(Query query, ClassDescriptor cld)
getPreparedSelectStatement
in interface SqlGenerator
query
- the Querycld
- the ClassDescriptorpublic SqlStatement getPreparedUpdateStatement(ClassDescriptor cld)
getPreparedUpdateStatement
in interface SqlGenerator
cld
- the ClassDescriptorpublic String getInsertMNStatement(String table, String[] pkColumns1, String[] pkColumns2)
getInsertMNStatement
in interface SqlGenerator
table
- pkColumns1
- pkColumns2
-
public String getSelectMNStatement(String table, String[] selectColumns, String[] columns)
getSelectMNStatement
in interface SqlGenerator
table
- the indirection tableselectColumns
- selected columnscolumns
- for wherepublic String getDeleteMNStatement(String table, String[] pkColumns1, String[] pkColumns2)
getDeleteMNStatement
in interface SqlGenerator
table
- pkColumns1
- pkColumns2
-
public SelectStatement getSelectStatementDep(Query query, ClassDescriptor cld)
getSelectStatementDep
in interface SqlGenerator
query
- the Querycld
- the ClassDescriptorpublic String asSQLStatement(Criteria crit, ClassDescriptor cld)
crit
- Selection criteria
26/06/99 Change statement to a StringBuffer for efficiencyprotected String asSQLClause(SelectionCriteria c, ClassDescriptor cld)
c
- SelectionCriteriacld
- ClassDescriptorprivate String toSqlClause(Object attributeOrQuery, ClassDescriptor cld)
private String toSQLClause(NullCriteria c)
c
- NullCriteriaprivate String toSQLClause(FieldCriteria c, ClassDescriptor cld)
c
- FieldCriteriacld
- ClassDescriptorprivate String toSQLClause(BetweenCriteria c, ClassDescriptor cld)
c
- BetweenCriteriacld
- ClassDescriptorprivate String toSQLClause(InCriteria c)
c
- SelectionCriteriaprivate String toSQLClause(SelectionCriteria c, ClassDescriptor cld)
c
- SelectionCriteriacld
- ClassDescriptorprivate String toSQLClause(SqlCriteria c)
c
- SqlCriteriaprivate String toSQLClause(ExistsCriteria c, ClassDescriptor cld)
c
- ExistsCriteriacld
- ClassDescriptorpublic SqlStatement getPreparedDeleteStatement(Query query, ClassDescriptor cld)
getPreparedDeleteStatement
in interface SqlGenerator
query
- the Querycld
- the ClassDescriptorpublic Platform getPlatform()
SqlGenerator
getPlatform
in interface SqlGenerator
protected SqlGeneratorDefaultImpl.SqlForClass getSqlForClass(ClassDescriptor cld)
SqlGeneratorDefaultImpl.SqlForClass
instance for
the given class descriptor.
cld
- The class descriptor.
SqlGeneratorDefaultImpl.SqlForClass
.protected SqlGeneratorDefaultImpl.SqlForClass newInstanceSqlForClass()
SqlGeneratorDefaultImpl.SqlForClass
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |