public abstract class PlatformDialect extends Object implements Dialect
| 限定符和类型 | 字段和说明 |
|---|---|
protected DataSourceWrapper |
dataSourceWrapper |
protected MappingGlobalWrapper |
mappingGlobalWrapper |
| 构造器和说明 |
|---|
PlatformDialect() |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract SQLBuilderCombine |
alter(StampAlter alter) |
protected StampAlter |
commonAddColumn(MappingTable mappingTable,
MappingField mappingField) |
protected StampCreate |
commonAddIndex(MappingTable mappingTable,
MappingIndex mappingIndex) |
protected StampCreate |
commonCreateTable(MappingTable mappingTable) |
protected StampCreate |
commonCreateTable(MappingTable mappingTable,
String tableName,
boolean isSkipAuto) |
protected StampAlter |
commonDropColumn(MappingTable mappingTable,
TableColumnStructure structure) |
protected StampDrop |
commonDropIndex(MappingTable mappingTable,
String indexName) |
protected StampDrop |
commonDropTable(TableStructure structure) |
List<ColumnEditType> |
compareColumnChange(TableStructure structure,
MappingField currField,
TableColumnStructure columnStructure)
重要!
|
protected boolean |
compareColumnChangeDefault(String defA,
String defB)
默认情况下默认值是相同的字符串然后做判断,但是某些数据库
默认值不走寻常路,会在默认值外添加包装字符串
比如 默认值 A 在sqlserver中为 ('A')
这个时候需要重写判断
|
protected boolean |
compareColumnChangeType(TableColumnStructure columnStructure,
ColumnType columnType)
判断当前两个类型是否相等,一般情况下不需要重写判断
但是如果数据库的数据类型名称和配置的类型名称无法一致时需要重写
|
abstract SQLBuilderCombine |
create(StampCreate create) |
protected void |
createIndex(MappingTable mappingTable,
MappingField mappingField,
boolean unique)
修改删除表字段时可能需要重新创建单列索引
|
DialectNextStep |
define(DataDefinition definition)
处理单个单元相关的属性
|
protected DialectNextStep |
defineAddColumn(DataDefinition definition) |
protected void |
defineAddColumnDefaultNull(String tableName,
String columnName) |
protected void |
defineAddColumnNotNullDefault(MappingField mappingField) |
protected DialectNextStep |
defineAddIndex(DataDefinition definition) |
protected DialectNextStep |
defineCreateTable(DataDefinition definition) |
protected void |
defineCreateTableExtra(StampCreate create,
MappingTable mappingTable) |
protected DialectNextStep |
defineDropColumn(DataDefinition definition) |
protected DialectNextStep |
defineDropIndex(DataDefinition definition) |
protected DialectNextStep |
defineDropTable(DataDefinition definition) |
protected DialectNextStep |
defineModifyColumn(DataDefinition definition) |
protected DialectNextStep |
defineModifyIndex(DataDefinition definition) |
abstract SQLBuilderCombine |
delete(StampDelete delete) |
abstract SQLBuilderCombine |
drop(StampDrop drop) |
protected void |
dropIndex(MappingTable mappingTable,
MappingField mappingField)
修改删除表字段时可能需要重新删除单列索引
|
protected KeyColumnType |
getAutoIncrementPrimaryKeyType() |
protected String |
getCatalogAndSchema()
供应商 Catalog支持 Schema支持
Oracle 不支持 Oracle User ID
MySQL 不支持 数据库名
MS SQL Server 数据库名 对象属主名,2005版开始有变
DB2 指定数据库对象时,Catalog部分省略 Catalog属主名
Sybase 数据库名 数据库属主名
Informix 不支持 不需要
PointBase 不支持 数据库名
|
ColumnType |
getColumnType(KeyColumnType type) |
List<TableStructure> |
getTableStructures(List<String> classTableNames) |
abstract SQLBuilderCombine |
insert(StampInsert insert) |
boolean |
isSelectHavingMustGroupBy()
查询使用having时是否必须带入group by
having require group by
|
boolean |
isSelectLimitMustOrderBy()
是否查询分页时必须要排序字段
大部分数据库都不是必须的 sqlserver 必须要
limit require order by
|
abstract boolean |
isSupportGeneratedKeys()
数据库驱动是否支持返回添加后的ID
|
boolean |
isSupportSameColumnIndex()
是否支持相同列的索引
比如:
index1 (A,B)
index2 (A,B)
mysql can create index1 and index2
oracle just only create one index
|
protected List<TableStructure> |
loadingTableStructures(List<String> classTableNames) |
protected void |
rebuildEndTable(MappingTable mappingTable,
TableStructure tableStructure) |
protected void |
rebuildStartTable(MappingTable mappingTable,
String tableName) |
void |
rebuildTable(List<TableStructure> structures,
MappingTable mappingTable,
TableStructure tableStructure)
是否需要重建表,如果define方法返回要求重建表
则根据配置的需要是否调用并重建表
|
protected void |
registerColumnType(KeyColumnType type,
String typeName) |
protected void |
registerColumnType(KeyColumnType type,
String typeName,
ColumnCompareType columnCompareType) |
protected void |
registerColumnType(KeyColumnType type,
String typeName,
int length) |
protected void |
registerColumnType(KeyColumnType type,
String typeName,
int length,
int scale) |
protected void |
registerColumnType(KeyColumnType type,
String typeName,
long length,
ColumnCompareType columnCompareType) |
protected Object |
runner(JDBCTraversing traversing) |
protected Object |
runner(StampAction action) |
abstract SQLBuilderCombine |
select(StampSelect select) |
void |
setDataSourceWrapper(DataSourceWrapper dswrapper) |
void |
setMappingGlobalWrapper(MappingGlobalWrapper mappingGlobalWrapper) |
protected void |
setSQLType(ColumnTypeBuilder typeBuilder,
Class type,
int length,
int scale) |
protected void |
triggerIndex(MappingTable mappingTable,
TableStructure tableStructure,
MappingField mappingField,
TableColumnStructure columnStructure)
检查表的索引
|
abstract SQLBuilderCombine |
update(StampUpdate update) |
protected DataSourceWrapper dataSourceWrapper
protected MappingGlobalWrapper mappingGlobalWrapper
protected void registerColumnType(KeyColumnType type, String typeName)
protected void registerColumnType(KeyColumnType type, String typeName, int length)
protected void registerColumnType(KeyColumnType type, String typeName, int length, int scale)
protected void registerColumnType(KeyColumnType type, String typeName, ColumnCompareType columnCompareType)
protected void registerColumnType(KeyColumnType type, String typeName, long length, ColumnCompareType columnCompareType)
public void setDataSourceWrapper(DataSourceWrapper dswrapper)
setDataSourceWrapper 在接口中 Dialectpublic void setMappingGlobalWrapper(MappingGlobalWrapper mappingGlobalWrapper)
setMappingGlobalWrapper 在接口中 Dialectpublic List<TableStructure> getTableStructures(List<String> classTableNames) throws SQLException
getTableStructures 在接口中 DialectSQLExceptionprotected List<TableStructure> loadingTableStructures(List<String> classTableNames) throws SQLException
SQLExceptionprotected Object runner(StampAction action) throws SQLException
SQLExceptionprotected Object runner(JDBCTraversing traversing) throws SQLException
SQLExceptionprotected String getCatalogAndSchema() throws SQLException
SQLExceptionpublic ColumnType getColumnType(KeyColumnType type)
getColumnType 在接口中 Dialectprotected StampCreate commonCreateTable(MappingTable mappingTable)
protected StampCreate commonCreateTable(MappingTable mappingTable, String tableName, boolean isSkipAuto)
protected void setSQLType(ColumnTypeBuilder typeBuilder, Class type, int length, int scale)
protected StampDrop commonDropTable(TableStructure structure)
protected StampAlter commonAddColumn(MappingTable mappingTable, MappingField mappingField)
protected StampAlter commonDropColumn(MappingTable mappingTable, TableColumnStructure structure)
protected StampCreate commonAddIndex(MappingTable mappingTable, MappingIndex mappingIndex)
protected StampDrop commonDropIndex(MappingTable mappingTable, String indexName)
protected void triggerIndex(MappingTable mappingTable, TableStructure tableStructure, MappingField mappingField, TableColumnStructure columnStructure) throws SQLException
mappingTable - tableStructure - mappingField - columnStructure - SQLExceptionprotected void createIndex(MappingTable mappingTable, MappingField mappingField, boolean unique) throws SQLException
mappingTable - mappingField - unique - SQLExceptionprotected void dropIndex(MappingTable mappingTable, MappingField mappingField) throws SQLException
mappingTable - mappingField - SQLExceptionprotected boolean compareColumnChangeType(TableColumnStructure columnStructure, ColumnType columnType)
columnStructure - columnType - protected boolean compareColumnChangeDefault(String defA, String defB)
defA - defB - protected KeyColumnType getAutoIncrementPrimaryKeyType()
public List<ColumnEditType> compareColumnChange(TableStructure structure, MappingField currField, TableColumnStructure columnStructure)
compareColumnChange 在接口中 Dialectstructure - currField - columnStructure - public abstract SQLBuilderCombine alter(StampAlter alter)
public abstract SQLBuilderCombine create(StampCreate create)
public abstract SQLBuilderCombine drop(StampDrop drop)
public abstract SQLBuilderCombine insert(StampInsert insert) throws SQLException
insert 在接口中 DialectSQLExceptionpublic abstract SQLBuilderCombine delete(StampDelete delete)
public abstract SQLBuilderCombine select(StampSelect select)
public abstract SQLBuilderCombine update(StampUpdate update)
public DialectNextStep define(DataDefinition definition) throws SQLException
define 在接口中 Dialectdefinition - SQLExceptionprotected void defineCreateTableExtra(StampCreate create, MappingTable mappingTable)
protected DialectNextStep defineCreateTable(DataDefinition definition) throws SQLException
SQLExceptionprotected DialectNextStep defineDropTable(DataDefinition definition) throws SQLException
SQLExceptionprotected DialectNextStep defineAddColumn(DataDefinition definition) throws SQLException
SQLExceptionprotected void defineAddColumnNotNullDefault(MappingField mappingField) throws SQLException
SQLExceptionprotected void defineAddColumnDefaultNull(String tableName, String columnName) throws SQLException
SQLExceptionprotected DialectNextStep defineModifyColumn(DataDefinition definition) throws SQLException
SQLExceptionprotected DialectNextStep defineDropColumn(DataDefinition definition) throws SQLException
SQLExceptionprotected DialectNextStep defineAddIndex(DataDefinition definition) throws SQLException
SQLExceptionprotected DialectNextStep defineModifyIndex(DataDefinition definition) throws SQLException
SQLExceptionprotected DialectNextStep defineDropIndex(DataDefinition definition) throws SQLException
SQLExceptionpublic void rebuildTable(List<TableStructure> structures, MappingTable mappingTable, TableStructure tableStructure) throws SQLException
rebuildTable 在接口中 DialectSQLExceptionprotected void rebuildStartTable(MappingTable mappingTable, String tableName) throws SQLException
SQLExceptionprotected void rebuildEndTable(MappingTable mappingTable, TableStructure tableStructure) throws SQLException
SQLExceptionpublic abstract boolean isSupportGeneratedKeys()
isSupportGeneratedKeys 在接口中 Dialectpublic boolean isSelectLimitMustOrderBy()
limit require order by
isSelectLimitMustOrderBy 在接口中 Dialectpublic boolean isSelectHavingMustGroupBy()
having require group by
isSelectHavingMustGroupBy 在接口中 Dialectpublic boolean isSupportSameColumnIndex()
isSupportSameColumnIndex 在接口中 DialectCopyright © 2020. All rights reserved.