Package com.exedio.dsmf
Class Dialect
- java.lang.Object
-
- com.exedio.dsmf.Dialect
-
public abstract class Dialect extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
Dialect.ResultSetHandler
protected static class
Dialect.SequenceTypeMapper
protected static class
Dialect.UniqueConstraintCollector
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected String
adjustExistingCheckConstraintCondition(String s)
protected void
appendForeignKeyCreateStatement(StringBuilder bf)
protected void
appendTableCreateStatement(StringBuilder bf)
abstract String
createColumn(String tableName, String columnName, String columnType)
protected abstract void
createSequence(StringBuilder bf, String sequenceName, Sequence.Type type, long start)
void
deleteSchema(Schema schema)
Deprecated.UseModel.deleteSchema()
instead.protected void
dropForeignKeyConstraint(StringBuilder bf, String tableName, String constraintName)
protected void
dropPrimaryKeyConstraint(StringBuilder bf, String tableName, String constraintName)
protected void
dropSequence(StringBuilder bf, String sequenceName)
protected void
dropUniqueConstraint(StringBuilder bf, String tableName, String constraintName)
protected static boolean
getBooleanStrict(ResultSet resultSet, int columnIndex, String trueValue, String falseValue)
protected static String
getCatalog(Schema schema)
protected abstract String
getColumnType(int dataType, ResultSet resultSet)
protected String
getSchema()
protected static Table
getTableStrict(Schema schema, ResultSet resultSet, int columnIndex)
abstract String
modifyColumn(String tableName, String columnName, String newColumnType)
protected boolean
needsTargetColumnName()
protected static void
notifyExistentCheck(Table table, String constraintName, String condition)
protected static Column
notifyExistentColumn(Table table, String columnName, String existingType)
protected static void
notifyExistentPrimaryKey(Table table, String constraintName)
protected static void
notifyExistentTable(Schema schema, String tableName)
protected static void
notifyExistentUnique(Table table, String constraintName, String condition)
protected static void
notifyExists(Sequence sequence, Sequence.Type existingType)
protected void
querySQL(Schema schema, String statement, Dialect.ResultSetHandler resultSetHandler)
String
quoteName(String name)
Quotes a database name.abstract String
renameColumn(String tableName, String oldColumnName, String newColumnName, String columnType)
String
renameTable(String tableName, String newTableName)
boolean
supportsCheckConstraints()
boolean
supportsSemicolon()
protected abstract void
verify(Schema schema)
protected void
verifyColumnsByMetaData(Schema schema, String tableSchema)
protected static void
verifyForeignKeyConstraints(String sql, Schema schema)
protected static void
verifySequences(String sql, Schema schema)
protected static void
verifyTablesByMetaData(Schema schema)
protected static void
verifyUniqueConstraints(String sql, Schema schema)
-
-
-
Field Detail
-
NOT_NULL
public static final String NOT_NULL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Dialect
protected Dialect(String schema)
-
-
Method Detail
-
getSchema
protected final String getSchema()
-
quoteName
public String quoteName(String name)
Quotes a database name. This prevents the name from being interpreted as a SQL keyword. This is usually done by enclosing the name with some (database specific) quotation characters. The default implementation uses double quotes as specified by ANSI SQL.
-
supportsCheckConstraints
public boolean supportsCheckConstraints()
-
supportsSemicolon
public boolean supportsSemicolon()
-
adjustExistingCheckConstraintCondition
protected String adjustExistingCheckConstraintCondition(String s)
-
getColumnType
protected abstract String getColumnType(int dataType, ResultSet resultSet) throws SQLException
- Throws:
SQLException
-
verify
protected abstract void verify(Schema schema)
-
verifyTablesByMetaData
protected static final void verifyTablesByMetaData(Schema schema)
-
verifyColumnsByMetaData
protected final void verifyColumnsByMetaData(Schema schema, String tableSchema)
- Parameters:
tableSchema
- null means any schema is allowed
-
verifyForeignKeyConstraints
protected static final void verifyForeignKeyConstraints(String sql, Schema schema)
-
verifyUniqueConstraints
protected static final void verifyUniqueConstraints(String sql, Schema schema)
-
notifyExistentTable
protected static final void notifyExistentTable(Schema schema, String tableName)
-
notifyExistentColumn
protected static final Column notifyExistentColumn(Table table, String columnName, String existingType)
-
notifyExistentCheck
protected static final void notifyExistentCheck(Table table, String constraintName, String condition)
-
notifyExistentPrimaryKey
protected static final void notifyExistentPrimaryKey(Table table, String constraintName)
-
notifyExistentUnique
protected static final void notifyExistentUnique(Table table, String constraintName, String condition)
-
notifyExists
protected static final void notifyExists(Sequence sequence, Sequence.Type existingType)
-
getBooleanStrict
protected static final boolean getBooleanStrict(ResultSet resultSet, int columnIndex, String trueValue, String falseValue) throws SQLException
- Throws:
SQLException
-
getTableStrict
protected static final Table getTableStrict(Schema schema, ResultSet resultSet, int columnIndex) throws SQLException
- Throws:
SQLException
-
querySQL
protected final void querySQL(Schema schema, String statement, Dialect.ResultSetHandler resultSetHandler)
-
appendTableCreateStatement
protected void appendTableCreateStatement(StringBuilder bf)
- Parameters:
bf
- used in subclasses
-
needsTargetColumnName
protected boolean needsTargetColumnName()
-
appendForeignKeyCreateStatement
protected void appendForeignKeyCreateStatement(StringBuilder bf)
- Parameters:
bf
- used in subclasses
-
renameColumn
public abstract String renameColumn(String tableName, String oldColumnName, String newColumnName, String columnType)
-
createColumn
public abstract String createColumn(String tableName, String columnName, String columnType)
-
modifyColumn
public abstract String modifyColumn(String tableName, String columnName, String newColumnType)
-
dropPrimaryKeyConstraint
protected void dropPrimaryKeyConstraint(StringBuilder bf, String tableName, String constraintName)
-
dropForeignKeyConstraint
protected void dropForeignKeyConstraint(StringBuilder bf, String tableName, String constraintName)
-
dropUniqueConstraint
protected void dropUniqueConstraint(StringBuilder bf, String tableName, String constraintName)
-
createSequence
protected abstract void createSequence(StringBuilder bf, String sequenceName, Sequence.Type type, long start)
-
dropSequence
protected void dropSequence(StringBuilder bf, String sequenceName)
-
deleteSchema
@Deprecated public final void deleteSchema(Schema schema)
Deprecated.UseModel.deleteSchema()
instead.The default implementation just drops and re-creates the schema. Subclasses are encouraged to provide a more efficient implementation.
-
-