|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.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(BooleanConstraint pConstraint)
|
protected java.lang.String |
getBooleanConstraintPart(java.lang.Object o)
|
protected java.lang.String |
getBooleanConstraintType(BooleanConstraint.Type pType)
|
protected java.lang.String |
getColumnAlias(ColumnReference pColumn)
|
protected java.lang.String |
getColumnAlias(ColumnReference[] pColumn)
|
protected java.lang.String |
getCombinedConstraint(CombinedConstraint pConstraint)
|
java.lang.String |
getConstraint(Constraint pConstraint)
Generates a part of a WHERE clause. |
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 |
getIndent()
|
java.lang.String |
getInsertQuery(InsertStatement pQuery)
|
protected java.lang.String |
getJoinAlias(JoinReference pJoinReference)
|
java.lang.String |
getLineTerminator()
Returns the line terminator. |
java.lang.String |
getQuery(Statement pStatement)
Generates an INSERT, UPDATE, DELETE or SELECT statement. |
protected java.lang.String |
getSelectQuery(SelectStatement pQuery)
|
java.lang.String |
getStatementTerminator()
Returns the statement terminator. |
protected java.lang.String |
getTableAlias(TableReference pTable)
|
protected java.lang.String |
getTypeName(Column.Type pType)
|
protected java.lang.String |
getUpdateQuery(UpdateStatement pQuery)
|
protected java.lang.String |
getValue(Value pValue)
|
protected java.lang.String |
getWhereClause(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 |
isUniqueIndexPartOfCreateTable()
Returns whether a CREATE TABLE statement may contain
a UNIQUE clause. |
protected java.lang.String |
newStatement(java.lang.String pStatement)
|
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()
SQLGenerator
Returns the statement terminator. A non-null value will be appended to all generated statements. Defaults to null.
getStatementTerminator
in interface SQLGenerator
public void setStatementTerminator(java.lang.String pStatementTerminator)
SQLGenerator
Sets the statement terminator. A non-null value will be appended to all generated statements. Defaults to null.
setStatementTerminator
in interface SQLGenerator
public java.lang.String getLineTerminator()
SQLGenerator
Returns 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 SQLGenerator
public void setLineTerminator(java.lang.String pLineTerminator)
SQLGenerator
Sets 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 SQLGenerator
protected java.lang.String newStatement(java.lang.String pStatement)
public java.util.Collection getCreate(Schema pSchema)
SQLGenerator
Generates a CREATE SCHEMA
statement. Doesn't create
CREATE TABLE
or similar statements.
getCreate
in interface SQLGenerator
public java.util.Collection getDrop(Schema pSchema)
SQLGenerator
Generates a DROP SCHEMA statement. Doesn't create
DROP TABLE
or similar statements.
getDrop
in interface SQLGenerator
protected 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)
SQLGenerator
Generates a CREATE TABLE statement. Doesn't create
CREATE INDEX
or similar statements.
getCreate
in interface SQLGenerator
public java.util.Collection getDrop(Table pTable)
SQLGenerator
Generates a DROP TABLE statement. Doesn't create
DROP INDEX
or similar statements.
getDrop
in interface SQLGenerator
public 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 java.lang.String getColumnAlias(ColumnReference pColumn)
protected java.lang.String getColumnAlias(ColumnReference[] pColumn)
protected java.lang.String getTableAlias(TableReference pTable)
protected java.lang.String getJoinAlias(JoinReference pJoinReference)
protected java.lang.String getEscapedString(java.lang.String s)
protected java.lang.String getBooleanConstraintPart(java.lang.Object o)
protected java.lang.String getBooleanConstraintType(BooleanConstraint.Type pType)
protected java.lang.String getBooleanConstraint(BooleanConstraint pConstraint)
protected java.lang.String getCombinedConstraint(CombinedConstraint pConstraint)
public java.lang.String getConstraint(Constraint pConstraint)
SQLGenerator
Generates a part of a WHERE clause.
getConstraint
in interface SQLGenerator
protected java.lang.String getWhereClause(CombinedConstraint pWhereClause)
protected java.lang.String getSelectQuery(SelectStatement pQuery)
public java.lang.String getQuery(Statement pStatement)
SQLGenerator
Generates an INSERT, UPDATE, DELETE or SELECT statement.
getQuery
in interface SQLGenerator
public java.util.Collection getCreate(Schema pSchema, boolean pAll)
SQLGenerator
Generates CREATE
statements for the schema.
getCreate
in interface SQLGenerator
pAll
- 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)
SQLGenerator
Generates DROP
statements for the schema.
getDrop
in interface SQLGenerator
pAll
- 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)
SQLGenerator
Generates CREATE
statements for the table.
getCreate
in interface SQLGenerator
pAll
- 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)
SQLGenerator
Generates DROP
statements for the table.
getDrop
in interface SQLGenerator
pAll
- 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)
SQLGenerator
Generates a CREATE INDEX statement.
getCreate
in interface SQLGenerator
public java.util.Collection getDrop(Index pIndex)
SQLGenerator
Generates a DROP INDEX statement.
getDrop
in interface SQLGenerator
public java.util.Collection getCreate(ForeignKey pKey)
SQLGenerator
Generates a CREATE FOREIGN KEY statement.
getCreate
in interface SQLGenerator
public java.util.Collection getDrop(ForeignKey pKey)
SQLGenerator
Generates a DROP FOEIGN KEY statement.
getDrop
in interface SQLGenerator
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |