|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.ws.jaxme.sqls.impl.SQLGeneratorImpl
Default implementation of an SQL generator.
| Constructor Summary | |
SQLGeneratorImpl()
|
|
| Method Summary | |
protected java.lang.String |
createForeignKeyAsPartOfCreateTable(ForeignKey pKey)
|
protected java.lang.String |
createIndexAsPartOfCreateTable(Index pIndex)
|
protected java.lang.String |
createPrimaryKeyAsPartOfCreateTable(Table pTable)
|
protected java.lang.String |
getBooleanConstraint(StatementMetaData pData,
BooleanConstraint pConstraint)
|
protected java.lang.String |
getBooleanConstraintPart(StatementMetaData pData,
java.lang.Object o)
|
protected java.lang.String |
getBooleanConstraintType(BooleanConstraint.Type pType)
|
protected java.lang.String |
getCase(StatementMetaData pData,
Case pCase)
|
protected java.lang.String |
getColumnAlias(StatementMetaData pData,
ColumnReference pColumn)
|
protected java.lang.String |
getColumnAlias(StatementMetaData pData,
ColumnReference[] pColumn)
|
protected java.lang.String |
getCombinedConstraint(StatementMetaData pData,
CombinedConstraint pConstraint)
|
java.lang.String |
getConstraint(Constraint pConstraint)
Generates the WHERE clause of a SELECT, UPDATE, or DELETE statement. |
java.lang.String |
getConstraint(StatementMetaData pData,
Constraint pConstraint)
|
protected java.lang.String |
getCreate(Column pColumn)
|
java.util.Collection |
getCreate(ForeignKey pKey)
Generates a CREATE FOREIGN KEY statement. |
java.util.Collection |
getCreate(Index pIndex)
Generates a CREATE INDEX statement. |
java.util.Collection |
getCreate(Schema pSchema)
Generates a CREATE SCHEMA statement. |
java.util.Collection |
getCreate(Schema pSchema,
boolean pAll)
Generates CREATE statements for the schema. |
java.util.Collection |
getCreate(Table pTable)
Generates a CREATE TABLE statement. |
java.util.Collection |
getCreate(Table pTable,
boolean pAll)
Generates CREATE statements for the table. |
protected java.lang.String |
getCreateTableHeader(Table pTable)
|
protected java.lang.String |
getDeleteQuery(DeleteStatement pQuery)
|
java.util.Collection |
getDrop(ForeignKey pKey)
Generates a DROP FOEIGN KEY statement. |
java.util.Collection |
getDrop(Index pIndex)
Generates a DROP INDEX statement. |
java.util.Collection |
getDrop(Schema pSchema)
Generates a DROP SCHEMA statement. |
java.util.Collection |
getDrop(Schema pSchema,
boolean pAll)
Generates DROP statements for the schema. |
java.util.Collection |
getDrop(Table pTable)
Generates a DROP TABLE statement. |
java.util.Collection |
getDrop(Table pTable,
boolean pAll)
Generates DROP statements for the table. |
protected java.lang.String |
getEscapedString(java.lang.String s)
|
protected java.lang.String |
getExpression(StatementMetaData pData,
Expression pExpr)
|
protected java.lang.String |
getFunction(StatementMetaData pData,
Function f)
|
protected java.lang.String |
getIndent()
|
java.lang.String |
getInsertQuery(InsertStatement pQuery)
|
protected java.lang.String |
getJoinAlias(StatementMetaData pData,
JoinReference pJoinReference)
|
java.lang.String |
getLineTerminator()
Returns the line terminator. |
protected java.lang.String |
getOrderColumn(StatementMetaData pData,
SelectStatement.OrderColumn pColumn)
|
protected java.lang.String |
getParts(StatementMetaData pData,
java.util.Iterator pParts)
|
java.lang.String |
getQuery(Statement pStatement)
Generates an INSERT, UPDATE, DELETE or SELECT statement. |
protected java.lang.String |
getSelectQuery(SelectStatement pQuery)
|
protected java.lang.String |
getSelectQuery(SelectStatement pQuery,
StatementMetaData pData)
|
protected java.lang.String |
getSelectQueryConstraints(SelectStatement pQuery,
StatementMetaData pData,
StatementMetaData.LocalData pLocalData)
|
protected java.lang.String |
getSelectQueryFromClause(SelectStatement pQuery,
StatementMetaData pData)
|
protected java.lang.String |
getSelectQueryOrderClause(StatementMetaData pData,
SelectStatement pQuery)
|
protected java.lang.String |
getSelectQueryResultColumns(SelectStatement pQuery,
StatementMetaData pData)
|
java.lang.String |
getStatementTerminator()
Returns the statement terminator. |
protected java.lang.String |
getTableAlias(StatementMetaData pData,
TableReference pTable)
|
protected java.lang.String |
getTypeName(Column.Type pType)
|
protected java.lang.String |
getUpdateQuery(UpdateStatement pQuery)
|
protected java.lang.String |
getValue(Value pValue)
|
java.lang.String |
getWhereClause(SelectStatement pQuery)
Returns the WHERE ... |
protected java.lang.String |
getWhereClause(StatementMetaData pData,
CombinedConstraint pWhereClause)
|
protected boolean |
isForeignKeyPartOfCreateTable()
Returns whether a CREATE TABLE statement may contain
a FOREIGN KEY clause. |
protected boolean |
isNonUniqueIndexPartOfCreateTable()
Returns whether a CREATE TABLE statement may contain
an INDEX clause. |
protected boolean |
isPrimaryKeyPartOfCreateTable()
Returns whether a CREATE TABLE statement may contain
a PRIMARY KEY clause. |
protected boolean |
isPrimaryKeyUniqueIndex()
Returns whether the primary key requires special handling (in which case isPrimaryKeyPartOfCreateTable() and
createPrimaryKeyAsPartOfCreateTable(Table) are used)
or nor (in which case isUniqueIndexPartOfCreateTable()
and createIndexAsPartOfCreateTable(Index) apply). |
protected boolean |
isQualifiedColumn(StatementMetaData pData,
ColumnReference pColumn)
|
protected boolean |
isTableAliasUsingAs()
|
protected boolean |
isUniqueIndexPartOfCreateTable()
Returns whether a CREATE TABLE statement may contain
a UNIQUE clause. |
protected java.lang.String |
newStatement(java.lang.String pStatement)
|
protected StatementMetaData |
newStatementMetaData(DeleteStatement pQuery)
|
protected StatementMetaData |
newStatementMetaData(InsertStatement pQuery,
ColumnReference[] pColumns)
|
protected StatementMetaData |
newStatementMetaData(SelectStatement pQuery)
|
protected StatementMetaData |
newStatementMetaData(UpdateStatement pQuery,
ColumnReference[] pColumns)
|
void |
setLineTerminator(java.lang.String pLineTerminator)
Sets the line terminator. |
void |
setStatementTerminator(java.lang.String pStatementTerminator)
Sets the statement terminator. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SQLGeneratorImpl()
| Method Detail |
public java.lang.String getStatementTerminator()
SQLGeneratorReturns the statement terminator. A non-null value will be appended to all generated statements. Defaults to null.
getStatementTerminator in interface SQLGeneratorpublic void setStatementTerminator(java.lang.String pStatementTerminator)
SQLGeneratorSets the statement terminator. A non-null value will be appended to all generated statements. Defaults to null.
setStatementTerminator in interface SQLGeneratorpublic java.lang.String getLineTerminator()
SQLGeneratorReturns the line terminator. A non-null value indicates that the generated statements should be made human readable by splitting them over multiple lines. A null value ensures that a statement consists of a single line only. Defaults to "\n".
getLineTerminator in interface SQLGeneratorpublic void setLineTerminator(java.lang.String pLineTerminator)
SQLGeneratorSets the line terminator. A non-null value indicates that the generated statements should be made human readable by splitting them over multiple lines. A null value ensures that a statement consists of a single line only. Defaults to "\n".
setLineTerminator in interface SQLGeneratorprotected java.lang.String newStatement(java.lang.String pStatement)
public java.util.Collection getCreate(Schema pSchema)
SQLGeneratorGenerates a CREATE SCHEMA statement. Doesn't create
CREATE TABLE or similar statements.
getCreate in interface SQLGeneratorpublic java.util.Collection getDrop(Schema pSchema)
SQLGeneratorGenerates a DROP SCHEMA statement. Doesn't create
DROP TABLE or similar statements.
getDrop in interface SQLGeneratorprotected java.lang.String getIndent()
protected java.lang.String getTypeName(Column.Type pType)
protected java.lang.String getCreate(Column pColumn)
protected boolean isPrimaryKeyUniqueIndex()
Returns whether the primary key requires special handling
(in which case isPrimaryKeyPartOfCreateTable() and
createPrimaryKeyAsPartOfCreateTable(Table) are used)
or nor (in which case isUniqueIndexPartOfCreateTable()
and createIndexAsPartOfCreateTable(Index) apply).
protected boolean isPrimaryKeyPartOfCreateTable()
Returns whether a CREATE TABLE statement may contain
a PRIMARY KEY clause.
protected boolean isUniqueIndexPartOfCreateTable()
Returns whether a CREATE TABLE statement may contain
a UNIQUE clause.
protected boolean isNonUniqueIndexPartOfCreateTable()
Returns whether a CREATE TABLE statement may contain
an INDEX clause.
protected boolean isForeignKeyPartOfCreateTable()
Returns whether a CREATE TABLE statement may contain
a FOREIGN KEY clause.
protected java.lang.String createPrimaryKeyAsPartOfCreateTable(Table pTable)
protected java.lang.String createIndexAsPartOfCreateTable(Index pIndex)
protected java.lang.String createForeignKeyAsPartOfCreateTable(ForeignKey pKey)
protected java.lang.String getCreateTableHeader(Table pTable)
public java.util.Collection getCreate(Table pTable)
SQLGeneratorGenerates a CREATE TABLE statement. Doesn't create
CREATE INDEX or similar statements.
getCreate in interface SQLGeneratorpublic java.util.Collection getDrop(Table pTable)
SQLGeneratorGenerates a DROP TABLE statement. Doesn't create
DROP INDEX or similar statements.
getDrop in interface SQLGeneratorpublic java.lang.String getInsertQuery(InsertStatement pQuery)
protected java.lang.String getValue(Value pValue)
protected java.lang.String getUpdateQuery(UpdateStatement pQuery)
protected java.lang.String getDeleteQuery(DeleteStatement pQuery)
protected boolean isQualifiedColumn(StatementMetaData pData,
ColumnReference pColumn)
protected java.lang.String getFunction(StatementMetaData pData,
Function f)
protected java.lang.String getColumnAlias(StatementMetaData pData,
ColumnReference pColumn)
protected java.lang.String getColumnAlias(StatementMetaData pData,
ColumnReference[] pColumn)
protected boolean isTableAliasUsingAs()
protected java.lang.String getTableAlias(StatementMetaData pData,
TableReference pTable)
protected java.lang.String getJoinAlias(StatementMetaData pData,
JoinReference pJoinReference)
protected java.lang.String getEscapedString(java.lang.String s)
protected java.lang.String getParts(StatementMetaData pData,
java.util.Iterator pParts)
protected java.lang.String getCase(StatementMetaData pData,
Case pCase)
protected java.lang.String getBooleanConstraintPart(StatementMetaData pData,
java.lang.Object o)
protected java.lang.String getExpression(StatementMetaData pData,
Expression pExpr)
protected java.lang.String getBooleanConstraintType(BooleanConstraint.Type pType)
protected java.lang.String getBooleanConstraint(StatementMetaData pData,
BooleanConstraint pConstraint)
protected java.lang.String getCombinedConstraint(StatementMetaData pData,
CombinedConstraint pConstraint)
public java.lang.String getConstraint(StatementMetaData pData,
Constraint pConstraint)
protected java.lang.String getWhereClause(StatementMetaData pData,
CombinedConstraint pWhereClause)
protected java.lang.String getSelectQuery(SelectStatement pQuery)
protected java.lang.String getSelectQueryResultColumns(SelectStatement pQuery,
StatementMetaData pData)
protected java.lang.String getSelectQueryFromClause(SelectStatement pQuery,
StatementMetaData pData)
protected java.lang.String getSelectQueryConstraints(SelectStatement pQuery,
StatementMetaData pData,
StatementMetaData.LocalData pLocalData)
protected java.lang.String getSelectQuery(SelectStatement pQuery,
StatementMetaData pData)
protected java.lang.String getOrderColumn(StatementMetaData pData,
SelectStatement.OrderColumn pColumn)
protected java.lang.String getSelectQueryOrderClause(StatementMetaData pData,
SelectStatement pQuery)
public java.lang.String getQuery(Statement pStatement)
SQLGeneratorGenerates an INSERT, UPDATE, DELETE or SELECT statement.
getQuery in interface SQLGenerator
public java.util.Collection getCreate(Schema pSchema,
boolean pAll)
SQLGeneratorGenerates CREATE statements for the schema.
getCreate in interface SQLGeneratorpAll - If this parameter is set to true, then the method is
equivalent to SQLGenerator.getCreate(Schema). Otherwise the returned
collection will also include CREATE statements for
all the tables and indexes in the schema. These additional statements
are created by invoking SQLGenerator.getCreate(Table,boolean) for all the
tables in the schema.
public java.util.Collection getDrop(Schema pSchema,
boolean pAll)
SQLGeneratorGenerates DROP statements for the schema.
getDrop in interface SQLGeneratorpAll - If this parameter is set to true, then the method is
equivalent to SQLGenerator.getDrop(Schema). Otherwise the returned
collection will also include DROP statements for
all the tables and indexes in the schema. These additional statements
are created by invoking SQLGenerator.getDrop(Table,boolean) for all the
tables in the schema.
public java.util.Collection getCreate(Table pTable,
boolean pAll)
SQLGeneratorGenerates CREATE statements for the table.
getCreate in interface SQLGeneratorpAll - If this parameter is set to true, then the method is
equivalent to SQLGenerator.getCreate(Table). Otherwise the returned
collection will also include CREATE statements for
the indexes, which are defined on the table. These additional
statements are created by invoking SQLGenerator.getCreate(Index)
and SQLGenerator.getCreate(ForeignKey) for all the indexes in the
schema.
public java.util.Collection getDrop(Table pTable,
boolean pAll)
SQLGeneratorGenerates DROP statements for the table.
getDrop in interface SQLGeneratorpAll - If this parameter is set to true, then the method is
equivalent to SQLGenerator.getDrop(Table). Otherwise the returned
collection will also include DROP statements for
the indexes, which are defined on the table. These additional
statements are created by invoking SQLGenerator.getDrop(Index)
and SQLGenerator.getDrop(ForeignKey) for all the indexes in the
schema.public java.util.Collection getCreate(Index pIndex)
SQLGeneratorGenerates a CREATE INDEX statement.
getCreate in interface SQLGeneratorpublic java.util.Collection getDrop(Index pIndex)
SQLGeneratorGenerates a DROP INDEX statement.
getDrop in interface SQLGeneratorpublic java.util.Collection getCreate(ForeignKey pKey)
SQLGeneratorGenerates a CREATE FOREIGN KEY statement.
getCreate in interface SQLGeneratorpublic java.util.Collection getDrop(ForeignKey pKey)
SQLGeneratorGenerates a DROP FOEIGN KEY statement.
getDrop in interface SQLGeneratorprotected StatementMetaData newStatementMetaData(SelectStatement pQuery)
protected StatementMetaData newStatementMetaData(DeleteStatement pQuery)
protected StatementMetaData newStatementMetaData(UpdateStatement pQuery,
ColumnReference[] pColumns)
protected StatementMetaData newStatementMetaData(InsertStatement pQuery,
ColumnReference[] pColumns)
public java.lang.String getWhereClause(SelectStatement pQuery)
SQLGeneratorReturns the WHERE ... ORDER BY ... part
of the SELECT statement.
getWhereClause in interface SQLGeneratorpublic java.lang.String getConstraint(Constraint pConstraint)
SQLGeneratorGenerates the WHERE clause of a SELECT, UPDATE, or DELETE statement.
getConstraint in interface SQLGenerator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||