Class MysqlDefinitionLoader
-
- All Implemented Interfaces:
-
pro.fessional.wings.faceless.flywave.SchemaDefinitionLoader
public final class MysqlDefinitionLoader implements SchemaDefinitionLoader
- Since:
2019-06-13
trydofor
-
-
Constructor Summary
Constructors Constructor Description MysqlDefinitionLoader()
-
Method Summary
Modifier and Type Method Description final BooleanisH2Database(DataSource dataSource)List<String>showTables(DataSource dataSource)list all tables of current datasource List<String>showFullDdl(DataSource dataSource, String table)List all DDLs that can create the current table with fields, constraints, indexes and triggers. StringdiffBoneSame(DataSource dataSource, String table, String other, Integer types)Whether two tables have the same skeleton, including field (NAME, TYPE, COMMENT, POSITION), index and trigger. StringdiffFullSame(DataSource dataSource, String table, String other, Integer types)Whether two tables have the same struct, including field (NAME, TYPE, COMMENT, POSITION, NULLABLE, DEFAULT), index and trigger. List<String>showBoneCol(DataSource dataSource, String table)A DDL section that lists at least the Name,Type, andCommentof field in the table.List<String>showPkeyCol(DataSource dataSource, String table)Get the field name of primary key in the table. List<SchemaDefinitionLoader.Trg>showBoneTrg(DataSource dataSource, String table)Get the name and EVENTcontent of trigger in the table.StringmakeDdlTrg(SchemaDefinitionLoader.Trg trg, Boolean drop)Create trigger DDL via trigger definition -
-
Method Detail
-
isH2Database
final Boolean isH2Database(DataSource dataSource)
-
showTables
List<String> showTables(DataSource dataSource)
list all tables of current datasource
- Parameters:
dataSource- current datasource
-
showFullDdl
List<String> showFullDdl(DataSource dataSource, String table)
List all DDLs that can create the current table with fields, constraints, indexes and triggers. Foreign Key should not be considered, some normalization is no longer good in modern software development.
- Parameters:
dataSource- current datasourcetable- the plain table name, do NOT include any quote.
-
diffBoneSame
String diffBoneSame(DataSource dataSource, String table, String other, Integer types)
Whether two tables have the same skeleton, including field (NAME, TYPE, COMMENT, POSITION), index and trigger.
- Parameters:
dataSource- current datasourcetable- the plain table name, do NOT include any quote.other- other plain table name, do NOT include any quote.- Returns:
diff info, empty mean the same
-
diffFullSame
String diffFullSame(DataSource dataSource, String table, String other, Integer types)
Whether two tables have the same struct, including field (NAME, TYPE, COMMENT, POSITION, NULLABLE, DEFAULT), index and trigger.
- Parameters:
dataSource- current datasourcetable- the plain table name, do NOT include any quote.other- other plain table name, do NOT include any quote.- Returns:
diff info, empty mean the same
-
showBoneCol
List<String> showBoneCol(DataSource dataSource, String table)
A DDL section that lists at least the
Name,Type, andCommentof field in the table. Used to populate theTABLE_BONEenvironment variable. Fields are comma-separated in SQL syntax (no comma at the end of the line)`LOGIN_INFO` text COMMENT 'login info', `OTHER_INFO` text COMMENT 'other info'- Parameters:
dataSource- current datasourcetable- the plain table name, do NOT include any quote.
-
showPkeyCol
List<String> showPkeyCol(DataSource dataSource, String table)
Get the field name of primary key in the table.
- Parameters:
table- the plain table name, do NOT include any quote.
-
showBoneTrg
List<SchemaDefinitionLoader.Trg> showBoneTrg(DataSource dataSource, String table)
Get the name and
EVENTcontent of trigger in the table.- Parameters:
table- the plain table name, do NOT include any quote.
-
makeDdlTrg
String makeDdlTrg(SchemaDefinitionLoader.Trg trg, Boolean drop)
Create trigger DDL via trigger definition
- Parameters:
trg- trigger definitiondrop- drop or create
-
-
-
-