Default implementation of an SQL generator.
createForeignKeyAsPartOfCreateTable
protected String createForeignKeyAsPartOfCreateTable(ForeignKey pKey)
createIndexAsPartOfCreateTable
protected String createIndexAsPartOfCreateTable(Index pIndex)
createPrimaryKeyAsPartOfCreateTable
protected String createPrimaryKeyAsPartOfCreateTable(Table pTable)
getBooleanConstraintPart
protected String getBooleanConstraintPart(StatementMetaData pData,
Object o)
getCreate
protected String getCreate(Column pColumn)
getCreate
public Collection getCreate(Schema pSchema)
Generates a CREATE SCHEMA
statement. Doesn't create
CREATE TABLE
or similar statements.
- getCreate in interface SQLGenerator
getCreate
public Collection getCreate(Schema pSchema,
boolean pAll)
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.
getCreate
public Collection getCreate(Table pTable)
Generates a CREATE TABLE statement. Doesn't create
CREATE INDEX
or similar statements.
- getCreate in interface SQLGenerator
getCreate
public Collection getCreate(Table pTable,
boolean pAll)
Generates CREATE
statements for the table.
- getCreate in interface SQLGenerator
getCreateTableHeader
protected String getCreateTableHeader(Table pTable)
getDrop
public Collection getDrop(Schema pSchema)
Generates a DROP SCHEMA statement. Doesn't create
DROP TABLE
or similar statements.
- getDrop in interface SQLGenerator
getDrop
public Collection getDrop(Schema pSchema,
boolean pAll)
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.
getDrop
public Collection getDrop(Table pTable)
Generates a DROP TABLE statement. Doesn't create
DROP INDEX
or similar statements.
- getDrop in interface SQLGenerator
getDrop
public Collection getDrop(Table pTable,
boolean pAll)
Generates DROP
statements for the table.
- getDrop in interface SQLGenerator
getEscapedString
protected String getEscapedString(String s)
getIndent
protected String getIndent()
getLineTerminator
public String getLineTerminator()
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
getStatementTerminator
public String getStatementTerminator()
Returns the statement terminator. A non-null value will be
appended to all generated statements. Defaults to null.
- getStatementTerminator in interface SQLGenerator
getTypeName
protected String getTypeName(Column.Type pType)
getValue
protected String getValue(Value pValue)
isForeignKeyPartOfCreateTable
protected boolean isForeignKeyPartOfCreateTable()
Returns whether a CREATE TABLE
statement may contain
a FOREIGN KEY
clause.
isNonUniqueIndexPartOfCreateTable
protected boolean isNonUniqueIndexPartOfCreateTable()
Returns whether a CREATE TABLE
statement may contain
an INDEX
clause.
isPrimaryKeyPartOfCreateTable
protected boolean isPrimaryKeyPartOfCreateTable()
Returns whether a CREATE TABLE
statement may contain
a PRIMARY KEY
clause.
isPrimaryKeyUniqueIndex
protected boolean isPrimaryKeyUniqueIndex()
isTableAliasUsingAs
protected boolean isTableAliasUsingAs()
isUniqueIndexPartOfCreateTable
protected boolean isUniqueIndexPartOfCreateTable()
Returns whether a CREATE TABLE
statement may contain
a UNIQUE
clause.
newStatement
protected String newStatement(String pStatement)
setLineTerminator
public void setLineTerminator(String pLineTerminator)
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
setStatementTerminator
public void setStatementTerminator(String pStatementTerminator)
Sets the statement terminator. A non-null value will be
appended to all generated statements. Defaults to null.
- setStatementTerminator in interface SQLGenerator