|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--planetj.database.SQLGenerator
A Helper class for generating SQL statements from objects.
Field Summary | |
static String |
AVERAGE
|
static String |
className
|
static String |
COUNT
|
static String |
MAX
|
static String |
MIN
|
static String |
SUM
|
Constructor Summary | |
SQLGenerator()
|
Method Summary | |
static StringBuffer |
appendFromClause(List tables,
StringBuffer sql)
Appends a FROM clause to the given StringBuffer. |
static StringBuffer |
appendFromClause(String library,
String table,
StringBuffer sql)
Appends a FROM clause to the given StringBuffer. |
static StringBuffer |
appendSelectClause(List columnNames,
StringBuffer sql)
Appends a SELECT clause with the given column names to the given StringBuffer. |
static StringBuffer |
appendTableName(Table table,
StringBuffer sb)
Appends the fully qualified table name to the StringBuffer. |
static StringBuffer |
appendTableNames(List tables,
StringBuffer sb)
Appends the fully qualified table names to a StringBuffer. |
static StringBuffer |
appendWhereAssociationClause(Map targetFDSandSourceFlds,
StringBuffer sb)
Appends the WHERE clause for an SQL association statement, based on a Map of FieldDescriptor objects and Fields, to a StringBuffer. |
static StringBuffer |
appendWhereClause(Collection flds,
StringBuffer sb)
Appends the WHERE clause for an SQL statement, based on a Collection of field objects, to a StringBuffer. |
static StringBuffer |
appendWhereClause(Map flds,
StringBuffer sb)
Appends the WHERE clause for an SQL statement, based on a Map of field objects, to a StringBuffer. |
static String |
generateCreateTableStatementFromFDs(Table pTable)
Generates a CREATE TABLE Statement that constructs a table based on the specified Table |
static String |
generateCreateTableStatementFromRowCollection(Table pTable,
RowCollection rc)
Generates a CREATE TABLE Statement that constructs a table based on the specified Table |
static String |
generateFieldSQLValues(List flds)
|
static String |
generateSelectAssociationStatement(Table pTable,
String pSelectFields,
Map pFldMap)
Generates a SQL select statement for retreiving Row associations Examples: |
static String |
generateSelectAssociationStatementForRowCollection(Table pTable,
String pSelectFields,
Map pTargetFDSandSourceFlds)
Generates a SQL select statement for retreiving RowCollection associations Examples: |
static String |
generateSelectOperationStatement(Table pTable,
String pSelectOperation,
String pColumnName,
String pWhereClause)
Generates a SQL select statement for the givin pSelectOperation with an optional pColumnName Examples: COUNT -> generateSelectOperationStatement(, SQLGenerator.COUNT, null, |
static String |
generateSelectSQL(Table tbl,
Map fdAndValues)
Generate the SQL based on the Table and a Map of FieldDescriptors and Values Creation date: (1/16/2002 3:14:14 PM) |
static String |
getInsertValues(Map flds)
Returns a String that contains column names and values for an insert SQL statment |
static String |
getSetValues(Map flds)
|
static String |
getTableName(Table table)
Gets fully qualified name of a Table object. |
static String |
getTableNames(List tables)
Gets the fully qualified table names from a List of Table objects. |
static String |
getWhereClause(Map flds)
Gets the WHERE clause for an SQL statement, based on a Map of field objects. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String className
public static final String COUNT
public static final String MIN
public static final String MAX
public static final String AVERAGE
public static final String SUM
Constructor Detail |
public SQLGenerator()
Method Detail |
public static StringBuffer appendFromClause(String library, String table, StringBuffer sql)
sql
- StringBuffer to which to append from clauselibrary
- Library nametable
- Table name
public static StringBuffer appendFromClause(List tables, StringBuffer sql)
sql
- StringBuffer to which to append from clause
public static StringBuffer appendSelectClause(List columnNames, StringBuffer sql)
columnNames
- names of the columns to selectsql
- StringBuffer to which to append the select clause
public static StringBuffer appendTableName(Table table, StringBuffer sb)
public static StringBuffer appendTableNames(List tables, StringBuffer sb)
tables
- A List of Table objects.
public static StringBuffer appendWhereAssociationClause(Map targetFDSandSourceFlds, StringBuffer sb) throws CMException
CMException
public static StringBuffer appendWhereClause(Map flds, StringBuffer sb) throws CMException
CMException
public static String generateCreateTableStatementFromFDs(Table pTable) throws CMException
pTable
- Table
CMException
public static String generateCreateTableStatementFromRowCollection(Table pTable, RowCollection rc) throws CMException
pTable
- Table
CMException
public static String generateFieldSQLValues(List flds) throws CMException
CMException
public static String generateSelectAssociationStatement(Table pTable, String pSelectFields, Map pFldMap) throws CMException
pTable
- TablepFldMap
- (contains the Field and the value the field will be compared to in the where clause
CMException
public static String generateSelectAssociationStatementForRowCollection(Table pTable, String pSelectFields, Map pTargetFDSandSourceFlds) throws CMException
pTable
- Table
CMException
public static String generateSelectOperationStatement(Table pTable, String pSelectOperation, String pColumnName, String pWhereClause)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |