public interface JDBCAdapter
| 限定符和类型 | 接口和说明 |
|---|---|
static class |
JDBCAdapter.SQL_BUILD_IN_VALUE |
| 限定符和类型 | 方法和说明 |
|---|---|
StringBuilder |
addColumnGuide(StringBuilder builder,
Column column)
添加列引导
|
String |
alterColumnKeyword()
修改表的关键字
|
String |
batchInsertSeparator()
批量插入数据时,多行数据之间分隔符
|
List<Run> |
buildAddCommentRunSQL(Column column)
添加表备注(表创建完成后调用,创建过程能添加备注的不需要实现)
|
List<Run> |
buildAddCommentRunSQL(MasterTable table)
添加表备注(表创建完成后调用,创建过程能添加备注的不需要实现)
|
List<Run> |
buildAddCommentRunSQL(PartitionTable table)
添加表备注(表创建完成后调用,创建过程能添加备注的不需要实现)
|
List<Run> |
buildAddCommentRunSQL(Table table)
添加表备注(表创建完成后调用,创建过程能添加备注的不需要实现)
|
List<Run> |
buildAddCommentRunSQL(View view)
添加视图备注(视图创建完成后调用,创建过程能添加备注的不需要实现)
|
List<Run> |
buildAddRunSQL(Column column) |
List<Run> |
buildAddRunSQL(Column column,
boolean slice)
添加列
|
List<Run> |
buildAddRunSQL(Constraint constraint)
添加约束
|
List<Run> |
buildAddRunSQL(ForeignKey foreign)
添加外键
|
List<Run> |
buildAddRunSQL(Index index)
添加索引
|
List<Run> |
buildAddRunSQL(PrimaryKey primary)
添加主键
|
List<Run> |
buildAddRunSQL(Tag tag)
添加标签
|
List<Run> |
buildAlterRunSQL(Column column) |
List<Run> |
buildAlterRunSQL(Column column,
boolean slice)
修改列
有可能生成多条SQL
|
List<Run> |
buildAlterRunSQL(Constraint constraint)
修改约束
有可能生成多条SQL
|
List<Run> |
buildAlterRunSQL(ForeignKey foreign)
修改外键
|
List<Run> |
buildAlterRunSQL(Function function)
修改函数
有可能生成多条SQL
|
List<Run> |
buildAlterRunSQL(Index index)
修改索引
有可能生成多条SQL
|
List<Run> |
buildAlterRunSQL(MasterTable table)
修改主表
|
List<Run> |
buildAlterRunSQL(PartitionTable table)
修改分区表
|
List<Run> |
buildAlterRunSQL(PrimaryKey primary)
修改主键
有可能生成多条SQL
|
List<Run> |
buildAlterRunSQL(Procedure procedure)
修改存储过程
有可能生成多条SQL
|
List<Run> |
buildAlterRunSQL(Table table)
修改表
|
List<Run> |
buildAlterRunSQL(Table table,
Collection<Column> columns)
修改列
有可能生成多条SQL,根据数据库类型优先合并成一条执行
|
List<Run> |
buildAlterRunSQL(Tag tag)
修改标签
有可能生成多条SQL
|
List<Run> |
buildAlterRunSQL(Trigger trigger)
修改触发器
有可能生成多条SQL
|
List<Run> |
buildAlterRunSQL(View view)
修改视图
|
List<Run> |
buildChangeCommentRunSQL(Column column)
修改备注
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildChangeCommentRunSQL(MasterTable table)
修改主表备注
|
List<Run> |
buildChangeCommentRunSQL(PartitionTable table)
修改分区表备注
|
List<Run> |
buildChangeCommentRunSQL(Table table)
修改备注
|
List<Run> |
buildChangeCommentRunSQL(Tag tag)
修改备注
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildChangeCommentRunSQL(View view)
修改备注
|
List<Run> |
buildChangeDefaultRunSQL(Column column)
修改默认值
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildChangeDefaultRunSQL(Tag tag)
修改默认值
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildChangeNullableRunSQL(Column column)
修改非空限制
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildChangeNullableRunSQL(Tag tag)
修改非空限制
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildChangeTypeRunSQL(Column column)
修改数据类型
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildChangeTypeRunSQL(Tag tag)
修改数据类型
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
Object |
buildConditionFindInSet(StringBuilder builder,
String column,
Compare compare,
Object value)
构造 FIND_IN_SET 查询条件
如果不需要占位符 返回null 否则原样返回value
|
StringBuilder |
buildConditionIn(StringBuilder builder,
Compare compare,
Object value)
构造(NOT) IN 查询条件
|
Object |
buildConditionLike(StringBuilder builder,
Compare compare,
Object value)
构造 LIKE 查询条件
如果不需要占位符 返回null 否则原样返回value
|
List<Run> |
buildCreateRunSQL(Function function)
添加函数
|
List<Run> |
buildCreateRunSQL(MasterTable table)
创建主有
|
List<Run> |
buildCreateRunSQL(PartitionTable table)
创建分区表
|
List<Run> |
buildCreateRunSQL(Procedure procedure)
添加存储过程
|
List<Run> |
buildCreateRunSQL(Table table)
创建表
|
List<Run> |
buildCreateRunSQL(Trigger trigger)
添加触发器
|
List<Run> |
buildCreateRunSQL(View view)
创建视图
|
Run |
buildDeleteRun(String dest,
Object obj,
String... columns)
创建删除SQL
|
Run |
buildDeleteRun(String table,
String key,
Object values)
根据key values删除
|
Run |
buildDeleteRunContent(Run run)
构造删除主体
|
List<Run> |
buildDropAutoIncrement(Column column)
取消自增
|
List<Run> |
buildDropRunSQL(Column column) |
List<Run> |
buildDropRunSQL(Column column,
boolean slice)
删除列
|
List<Run> |
buildDropRunSQL(Constraint constraint)
删除约束
|
List<Run> |
buildDropRunSQL(ForeignKey foreign)
删除外键
|
List<Run> |
buildDropRunSQL(Function function)
删除函数
|
List<Run> |
buildDropRunSQL(Index index)
删除索引
|
List<Run> |
buildDropRunSQL(MasterTable table)
删除主表
|
List<Run> |
buildDropRunSQL(PartitionTable table)
删除分区表
|
List<Run> |
buildDropRunSQL(PrimaryKey primary)
删除主键
|
List<Run> |
buildDropRunSQL(Procedure procedure)
删除存储过程
|
List<Run> |
buildDropRunSQL(Table table)
删除表
|
List<Run> |
buildDropRunSQL(Tag tag)
删除标签
|
List<Run> |
buildDropRunSQL(Trigger trigger)
删除触发器
|
List<Run> |
buildDropRunSQL(View view)
删除视图
|
Run |
buildExecuteRun(RunPrepare prepare,
ConfigStore configs,
String... conditions)
创建执行SQL
|
void |
buildExecuteRunContent(Run run)
构造执行主体
|
Run |
buildInsertRun(org.springframework.jdbc.core.JdbcTemplate template,
String dest,
Object obj,
boolean checkPrimary,
List<String> columns)
创建insert RunPrepare
|
List<Run> |
buildQueryColumnRunSQL(Table table,
boolean metadata)
查询表上的列
|
List<Run> |
buildQueryConstraintRunSQL(Table table,
boolean metadata)
查询表上的约束
|
List<Run> |
buildQueryDatabaseRunSQL()
查询所有数据库
|
List<Run> |
buildQueryForeignsRunSQL(Table table)
查询表上的外键
|
List<Run> |
buildQueryFunctionRunSQL(String catalog,
String schema,
String name) |
List<Run> |
buildQueryIndexRunSQL(Table table,
String name)
查询表上的索引
|
List<Run> |
buildQueryMasterTableRunSQL(String catalog,
String schema,
String pattern,
String types)
查询主表
|
List<Run> |
buildQueryPartitionTableRunSQL(MasterTable master,
Map<String,Object> tags) |
List<Run> |
buildQueryPartitionTableRunSQL(MasterTable master,
Map<String,Object> tags,
String name)
根据主表查询分区表
|
List<Run> |
buildQueryPartitionTableRunSQL(String catalog,
String schema,
String pattern,
String types)
查询分区表
|
List<Run> |
buildQueryPrimaryRunSQL(Table table)
查询表上的主键
|
List<Run> |
buildQueryProcedureRunSQL(String catalog,
String schema,
String name) |
Run |
buildQueryRun(RunPrepare prepare,
ConfigStore configs,
String... conditions)
创建查询SQL
|
void |
buildQueryRunContent(Run run)
构造查询主体 拼接where group等(不含分页 ORDER)
|
List<Run> |
buildQuerySequence(boolean next,
String... names)
创建查询序列SQL
|
List<Run> |
buildQueryTableCommentRunSQL(String catalog,
String schema,
String pattern,
String types)
查询表备注
|
List<Run> |
buildQueryTableRunSQL(String catalog,
String schema,
String pattern,
String types)
查询表,不是查表中的数据
|
List<Run> |
buildQueryTagRunSQL(Table table,
boolean metadata)
查询表上的列
|
List<Run> |
buildQueryTriggerRunSQL(Table table,
List<Trigger.EVENT> events)
查询表上的trigger
|
List<Run> |
buildQueryViewRunSQL(String catalog,
String schema,
String pattern,
String types)
查询视图
|
List<Run> |
buildRenameRunSQL(Column column)
修改列名
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildRenameRunSQL(Constraint constraint)
修改约束名
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildRenameRunSQL(ForeignKey foreign)
修改外键名
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildRenameRunSQL(Function function)
修改函数名
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildRenameRunSQL(Index index)
修改索引名
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildRenameRunSQL(MasterTable table)
主表重命名
|
List<Run> |
buildRenameRunSQL(PartitionTable table)
分区表重命名
|
List<Run> |
buildRenameRunSQL(PrimaryKey primary)
修改主键名
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildRenameRunSQL(Procedure procedure)
修改存储过程名
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildRenameRunSQL(Table table)
重命名
|
List<Run> |
buildRenameRunSQL(Tag tag)
修改标签名
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildRenameRunSQL(Trigger trigger)
修改触发器名
一般不直接调用,如果需要由buildAlterRunSQL内部统一调用
|
List<Run> |
buildRenameRunSQL(View view)
重命名
|
List<Run> |
buildTruncateSQL(String table) |
Run |
buildUpdateRun(String dest,
Object obj,
ConfigStore configs,
boolean checkPrimary,
List<String> columns)
创建更新SQL
|
StringBuilder |
charset(StringBuilder builder,
Column column)
编码
|
StringBuilder |
checkColumnExists(StringBuilder builder,
boolean exists)
创建或删除列之前 检测表是否存在
IF NOT EXISTS
|
Boolean |
checkIgnorePrecision(String datatype) |
Boolean |
checkIgnoreScale(String datatype) |
void |
checkSchema(Connection con,
Table table) |
void |
checkSchema(DataSource dataSource,
Table table) |
StringBuilder |
checkTableExists(StringBuilder builder,
boolean exists)
创建或删除表之前 检测表是否存在
IF NOT EXISTS
|
StringBuilder |
checkTagExists(StringBuilder builder,
boolean exists)
创建或删除标签之前 检测表是否存在
IF NOT EXISTS
|
StringBuilder |
checkViewExists(StringBuilder builder,
boolean exists)
创建或删除视图之前 检测视图是否存在
IF NOT EXISTS
|
Column |
column(Column column,
ResultSet rs) |
Column |
column(Column column,
ResultSetMetaData rsm,
int index) |
Column |
column(Column column,
org.springframework.jdbc.support.rowset.SqlRowSetMetaData rsm,
int index) |
<T extends Column> |
columns(boolean create,
LinkedHashMap<String,T> columns,
DatabaseMetaData dbmd,
Table table,
String pattern)
解析JDBC getcolumns结果
|
<T extends Column> |
columns(boolean create,
LinkedHashMap<String,T> columns,
Table table,
org.springframework.jdbc.support.rowset.SqlRowSet set)
解析查询结果metadata(0=1)
|
<T extends Column> |
columns(int index,
boolean create,
Table table,
LinkedHashMap<String,T> columns,
DataSet set)
根据查询结果集构造Tag
|
StringBuilder |
comment(StringBuilder builder,
Column column)
备注
|
void |
comment(StringBuilder builder,
Index index)
索引备注
|
StringBuilder |
comment(StringBuilder builder,
Table table)
表备注
|
StringBuilder |
comment(StringBuilder builder,
View view)
视图备注
|
<T extends Table> |
comments(int index,
boolean create,
String catalog,
String schema,
LinkedHashMap<String,T> tables,
DataSet set)
表备注
|
DatabaseType |
compatible()
对应的兼容模式,有些数据库会兼容oracle或pg,需要分别提供两个JDBCAdapter或者直接依赖oracle/pg的adapter
参考SQLAdapterUtil定位adapter的方法
|
String |
concat(String... args)
拼接字符串
|
List<String> |
confirmInsertColumns(String dest,
Object data,
List<String> columns,
boolean batch)
确认需要插入的列
|
<T extends Constraint> |
constraints(boolean create,
Table table,
LinkedHashMap<String,T> constraints,
ResultSet set) |
<T extends Constraint> |
constraints(boolean create,
Table table,
LinkedHashMap<String,T> constraints,
org.springframework.jdbc.support.rowset.SqlRowSet set) |
<T extends Constraint> |
constraints(int index,
boolean create,
Table table,
LinkedHashMap<String,T> constraints,
DataSet set)
根据查询结果集构造Constraint
|
Object |
convert(Column column,
Object value) |
boolean |
convert(Column column,
RunValue run)
数据类型转换,没有提供column的根据value类型
|
boolean |
convert(Map<String,Column> columns,
RunValue run)
数据类型转换
|
boolean |
convert(String catalog,
String schema,
String table,
RunValue run)
数据类型转换
子类先解析(有些同名的类型以子类为准)、失败后再调用默认转换
|
void |
createInserts(org.springframework.jdbc.core.JdbcTemplate template,
Run run,
String dest,
Collection list,
List<String> keys)
根据Collection创建批量插入SQL
|
void |
createInserts(org.springframework.jdbc.core.JdbcTemplate template,
Run run,
String dest,
DataSet set,
List<String> keys)
根据DataSet创建批量插入SQL
|
LinkedHashMap<String,Database> |
databases(int index,
boolean create,
LinkedHashMap<String,Database> databases,
DataSet set)
根据查询结果集构造 Database
|
StringBuilder |
defaultValue(StringBuilder builder,
Column column)
默认值
|
StringBuilder |
define(StringBuilder builder,
Column column)
定义列
|
StringBuilder |
dropColumnGuide(StringBuilder builder,
Column column)
删除列引导
|
void |
each(StringBuilder builder,
Trigger trigger) |
<T extends ForeignKey> |
foreigns(int index,
Table table,
LinkedHashMap<String,T> foreigns,
DataSet set)
根据查询结果集构造PrimaryKey
|
<T extends Function> |
functions(int index,
boolean create,
LinkedHashMap<String,T> functions,
DataSet set) |
String |
generatedKey() |
AnylineDao |
getDao() |
String |
getDelimiterFr()
界定符(分隔符)
|
String |
getDelimiterTo() |
String |
getPrimaryKey(Object obj)
获取单主键列名
|
Object |
getPrimaryValue(Object obj)
获取单主键值
|
boolean |
identity(String random,
Object data,
org.springframework.jdbc.support.KeyHolder keyholder)
insert执行后 通过KeyHolder获取主键值赋值给data
|
StringBuilder |
increment(StringBuilder builder,
Column column)
递增列
|
<T extends Index> |
indexs(boolean create,
LinkedHashMap<String,T> indexs,
DatabaseMetaData dbmd,
Table table,
boolean unique,
boolean approximate)
解析JDBC getIndex结果
|
<T extends Index> |
indexs(boolean create,
Table table,
LinkedHashMap<String,T> indexs,
org.springframework.jdbc.support.rowset.SqlRowSet set) |
<T extends Index> |
indexs(int index,
boolean create,
Table table,
LinkedHashMap<String,T> indexs,
DataSet set)
根据查询结果集构造Index
|
int |
insert(org.springframework.jdbc.core.JdbcTemplate template,
String random,
Object data,
String sql,
List<Object> values,
String[] pks)
执行 insert
|
boolean |
isBooleanColumn(Column column)
是否是boolean列
|
boolean |
isCharColumn(Column column)
是否是字符类型
决定值是否需要加单引号
number boolean 返回false
其他返回true
|
boolean |
isIgnorePrecision(Column column) |
boolean |
isIgnoreScale(Column column) |
boolean |
isNumberColumn(Column column)
是否是数字列
|
<T extends MasterTable> |
mtables(boolean create,
LinkedHashMap<String,T> tables,
DatabaseMetaData dbmd,
String catalog,
String schema,
String pattern,
String... types)
根据JDBC
|
<T extends MasterTable> |
mtables(int index,
boolean create,
String catalog,
String schema,
LinkedHashMap<String,T> tables,
DataSet set)
根据查询结果集构造Table
|
StringBuilder |
name(StringBuilder builder,
Table table)
构造表名
|
StringBuilder |
nullable(StringBuilder builder,
Column column)
非空
|
String |
objectName(String name)
对象名称格式化(大小写转换),在查询系统表时需要
|
StringBuilder |
onupdate(StringBuilder builder,
Column column)
更新行事件
|
void |
parameter(StringBuilder builder,
Parameter parameter)
生在输入输出参数
|
String |
parseExists(Run run)
创建检测是否存在SQL
|
String |
parseFinalQuery(Run run)
创建最终执行查询SQL 包含分页 ORDER
|
String |
parseTotalQuery(Run run)
创建统计总数SQL
|
StringBuilder |
position(StringBuilder builder,
Column column)
位置
|
PrimaryKey |
primary(int index,
Table table,
DataSet set)
根据查询结果集构造PrimaryKey
|
StringBuilder |
primary(StringBuilder builder,
Column column)
主键(注意不要跟表定义中的主键重复)
|
StringBuilder |
primary(StringBuilder builder,
Table table)
创建主键在创建表的DDL结尾部分
|
<T extends Procedure> |
procedures(int index,
boolean create,
LinkedHashMap<String,T> procedures,
DataSet set) |
List<Map<String,Object>> |
process(List<Map<String,Object>> list)
JDBC执行完成后的结果处理
|
<T extends PartitionTable> |
ptables(boolean create,
LinkedHashMap<String,T> tables,
DatabaseMetaData dbmd,
String catalog,
String schema,
MasterTable master)
根据JDBC
|
<T extends PartitionTable> |
ptables(int total,
int index,
boolean create,
MasterTable master,
String catalog,
String schema,
LinkedHashMap<String,T> tables,
DataSet set)
根据查询结果集构造Table
|
Object |
read(Column metadata,
Object value,
Class clazz)
从数据库中读取数据,常用的基本类型可以自动转换,不常用的如json/point/polygon/blob等转换成anyline对应的类型
|
DataReader |
reader(Class clazz) |
DataReader |
reader(ColumnType type) |
void |
setDao(AnylineDao dao) |
boolean |
supportInsertPlaceholder()
插入数据时是否支持占位符
|
<T extends Table> |
tables(boolean create,
LinkedHashMap<String,T> tables,
DatabaseMetaData dbmd,
String catalog,
String schema,
String pattern,
String... types)
根据JDBC补充
|
<T extends Table> |
tables(int index,
boolean create,
String catalog,
String schema,
LinkedHashMap<String,T> tables,
DataSet set)
根据查询结果集构造Table
|
<T extends Tag> |
tags(boolean create,
LinkedHashMap<String,T> tags,
DatabaseMetaData dbmd,
Table table,
String pattern)
解析JDBC getcolumns结果
|
<T extends Tag> |
tags(boolean create,
Table table,
LinkedHashMap<String,T> tags,
org.springframework.jdbc.support.rowset.SqlRowSet set)
解析查询结果metadata(0=1)
|
<T extends Tag> |
tags(int index,
boolean create,
Table table,
LinkedHashMap<String,T> tags,
DataSet set)
根据查询结果集构造Tag
|
<T extends Trigger> |
triggers(int index,
boolean create,
Table table,
LinkedHashMap<String,T> triggers,
DataSet set)
根据查询结果集构造Constraint
|
DatabaseType |
type() |
ColumnType |
type(String type)
转换成相应数据库支持类型
|
StringBuilder |
type(StringBuilder builder,
Column column)
数据类型
|
StringBuilder |
type(StringBuilder builder,
Column column,
String type,
boolean isIgnorePrecision,
boolean isIgnoreScale)
列数据类型定义
|
String |
value(Column column,
JDBCAdapter.SQL_BUILD_IN_VALUE value)
内置函数
如果需要引号,方法应该一块返回
|
void |
value(StringBuilder builder,
Object row,
String key)
在不检测数据库结构时才生效,否则会被convert代替
生成value格式 主要确定是否需要单引号 或 类型转换
有些数据库不提供默认的 隐式转换 需要显示的把String转换成相应的数据类型
如 TO_DATE('')
|
String |
version() |
<T extends View> |
views(boolean create,
LinkedHashMap<String,T> views,
DatabaseMetaData dbmd,
String catalog,
String schema,
String pattern,
String... types)
根据JDBC补充
|
<T extends View> |
views(int index,
boolean create,
String catalog,
String schema,
LinkedHashMap<String,T> views,
DataSet set)
根据查询结果集构造View
|
Object |
write(Column metadata,
Object value,
boolean placeholder)
通过占位符写入数据库前转换成数据库可接受的Java数据类型
|
DataWriter |
writer(Object support)
根据java数据类型定位数据库数据类型
在不开启自动检测数据类型时会调用
|
DatabaseType type()
String version()
AnylineDao getDao()
void setDao(AnylineDao dao)
String getDelimiterFr()
String getDelimiterTo()
DatabaseType compatible()
ColumnType type(String type)
type - typeDataWriter writer(Object support)
support - class或ColumnTypeDataReader reader(Class clazz)
DataReader reader(ColumnType type)
Run buildInsertRun(org.springframework.jdbc.core.JdbcTemplate template, String dest, Object obj, boolean checkPrimary, List<String> columns)
template - JdbcTemplatedest - 表obj - 实体checkPrimary - 是否需要检查重复主键,默认不检查columns - 需要抛入的列 如果不指定 则根据实体属性解析void createInserts(org.springframework.jdbc.core.JdbcTemplate template,
Run run,
String dest,
Collection list,
List<String> keys)
template - JdbcTemplaterun - rundest - 表 如果不指定则根据DataSet解析list - 数据集keys - keys 南非要插入的列void createInserts(org.springframework.jdbc.core.JdbcTemplate template,
Run run,
String dest,
DataSet set,
List<String> keys)
template - JdbcTemplaterun - rundest - 表 如果不指定则根据DataSet解析set - 数据集keys - keys 南非要插入的列List<String> confirmInsertColumns(String dest, Object data, List<String> columns, boolean batch)
data - Entity或DataRowbatch - 是否批量columns - 提供额外的判断依据String batchInsertSeparator()
boolean supportInsertPlaceholder()
int insert(org.springframework.jdbc.core.JdbcTemplate template,
String random,
Object data,
String sql,
List<Object> values,
String[] pks)
throws Exception
template - JdbcTemplaterandom - randomdata - datasql - sqlvalues - valuepks - pksException - 异常boolean identity(String random, Object data, org.springframework.jdbc.support.KeyHolder keyholder)
random - log标记data - datakeyholder - keyholderString generatedKey()
Run buildUpdateRun(String dest, Object obj, ConfigStore configs, boolean checkPrimary, List<String> columns)
dest - 表obj - Entity或DtaRowcheckPrimary - 是否需要检查重复主键,默认不检查columns - 需要更新的列configs - 更新条件Run buildQueryRun(RunPrepare prepare, ConfigStore configs, String... conditions)
prepare - prepareconfigs - 查询条件配置conditions - 查询条件List<Run> buildQuerySequence(boolean next, String... names)
next - 是否生成返回下一个序列 false:cur true:nextnames - namesvoid buildQueryRunContent(Run run)
run - runObject buildConditionLike(StringBuilder builder, Compare compare, Object value)
builder - buildercompare - comparevalue - valueObject buildConditionFindInSet(StringBuilder builder, String column, Compare compare, Object value)
builder - buildercolumn - columncompare - comparevalue - valueStringBuilder buildConditionIn(StringBuilder builder, Compare compare, Object value)
builder - buildercompare - comparevalue - valueList<Map<String,Object>> process(List<Map<String,Object>> list)
list - JDBC执行结果Run buildExecuteRun(RunPrepare prepare, ConfigStore configs, String... conditions)
prepare - prepareconfigs - configsconditions - conditionsvoid buildExecuteRunContent(Run run)
run - runRun buildDeleteRun(String dest, Object obj, String... columns)
dest - 表obj - entitycolumns - 删除条件的列,根据columns取obj值并合成删除条件Run buildDeleteRun(String table, String key, Object values)
table - 表key - keyvalues - valuesvoid checkSchema(DataSource dataSource, Table table)
void checkSchema(Connection con, Table table)
List<Run> buildQueryDatabaseRunSQL() throws Exception
Exception - 异常LinkedHashMap<String,Database> databases(int index, boolean create, LinkedHashMap<String,Database> databases, DataSet set) throws Exception
index - 第几条SQL 对照 buildQueryDatabaseRunSQL 返回顺序create - 上一步没有查到的,这一步是否需要新创建databases - 上一步查询结果set - setException - 异常List<Run> buildQueryTableRunSQL(String catalog, String schema, String pattern, String types) throws Exception
catalog - catalogschema - schemapattern - patterntypes - types "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".ExceptionList<Run> buildQueryTableCommentRunSQL(String catalog, String schema, String pattern, String types) throws Exception
catalog - catalogschema - schemapattern - patterntypes - types "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".Exception<T extends Table> LinkedHashMap<String,T> tables(int index, boolean create, String catalog, String schema, LinkedHashMap<String,T> tables, DataSet set) throws Exception
index - 第几条SQL 对照buildQueryTableRunSQL返回顺序create - 上一步没有查到的,这一步是否需要新创建catalog - catalogschema - schematables - 上一步查询结果set - setException - 异常<T extends Table> LinkedHashMap<String,T> tables(boolean create, LinkedHashMap<String,T> tables, DatabaseMetaData dbmd, String catalog, String schema, String pattern, String... types) throws Exception
create - 上一步没有查到的,这一步是否需要新创建tables - 上一步查询结果dbmd - DatabaseMetaDatacatalog - catalogschema - schemapattern - patterntypes - types "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".Exception - 异常<T extends Table> LinkedHashMap<String,T> comments(int index, boolean create, String catalog, String schema, LinkedHashMap<String,T> tables, DataSet set) throws Exception
index - 第几条SQL 对照buildQueryTableRunSQL返回顺序create - 上一步没有查到的,这一步是否需要新创建catalog - catalogschema - schematables - 上一步查询结果set - setException - 异常List<Run> buildQueryViewRunSQL(String catalog, String schema, String pattern, String types) throws Exception
catalog - catalogschema - schemapattern - patterntypes - types "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".Exception<T extends View> LinkedHashMap<String,T> views(int index, boolean create, String catalog, String schema, LinkedHashMap<String,T> views, DataSet set) throws Exception
index - 第几条SQL 对照buildQueryViewRunSQL返回顺序create - 上一步没有查到的,这一步是否需要新创建catalog - catalogschema - schemaviews - 上一步查询结果set - setException - 异常<T extends View> LinkedHashMap<String,T> views(boolean create, LinkedHashMap<String,T> views, DatabaseMetaData dbmd, String catalog, String schema, String pattern, String... types) throws Exception
create - 上一步没有查到的,这一步是否需要新创建views - 上一步查询结果dbmd - DatabaseMetaDatacatalog - catalogschema - schemapattern - patterntypes - types "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".Exception - 异常List<Run> buildQueryMasterTableRunSQL(String catalog, String schema, String pattern, String types) throws Exception
catalog - catalogschema - schemapattern - patterntypes - typesException<T extends MasterTable> LinkedHashMap<String,T> mtables(int index, boolean create, String catalog, String schema, LinkedHashMap<String,T> tables, DataSet set) throws Exception
index - 第几条SQL 对照 buildQueryMasterTableRunSQL返回顺序create - 上一步没有查到的,这一步是否需要新创建catalog - catalogschema - schematables - 上一步查询结果set - setException - 异常<T extends MasterTable> LinkedHashMap<String,T> mtables(boolean create, LinkedHashMap<String,T> tables, DatabaseMetaData dbmd, String catalog, String schema, String pattern, String... types) throws Exception
create - 上一步没有查到的,这一步是否需要新创建catalog - catalogschema - schematables - 上一步查询结果dbmd - DatabaseMetaDataException - 异常List<Run> buildQueryPartitionTableRunSQL(String catalog, String schema, String pattern, String types) throws Exception
catalog - catalogschema - schemapattern - patterntypes - typesExceptionList<Run> buildQueryPartitionTableRunSQL(MasterTable master, Map<String,Object> tags, String name) throws Exception
master - 主表tags - 标签名+标签值name - 分区表名Exception - 异常List<Run> buildQueryPartitionTableRunSQL(MasterTable master, Map<String,Object> tags) throws Exception
Exception<T extends PartitionTable> LinkedHashMap<String,T> ptables(int total, int index, boolean create, MasterTable master, String catalog, String schema, LinkedHashMap<String,T> tables, DataSet set) throws Exception
total - 合计SQL数量index - 第几条SQL 对照 buildQueryMasterTableRunSQL返回顺序create - 上一步没有查到的,这一步是否需要新创建master - 主表catalog - catalogschema - schematables - 上一步查询结果set - setException - 异常<T extends PartitionTable> LinkedHashMap<String,T> ptables(boolean create, LinkedHashMap<String,T> tables, DatabaseMetaData dbmd, String catalog, String schema, MasterTable master) throws Exception
create - 上一步没有查到的,这一步是否需要新创建master - 主表catalog - catalogschema - schematables - 上一步查询结果dbmd - DatabaseMetaDataException - 异常List<Run> buildQueryColumnRunSQL(Table table, boolean metadata) throws Exception
table - 表metadata - 是否根据metadata(true:SELEC * FROM T WHERE 1=0,false:查询系统表)Exception<T extends Column> LinkedHashMap<String,T> columns(int index, boolean create, Table table, LinkedHashMap<String,T> columns, DataSet set) throws Exception
index - 第几条SQL 对照 buildQueryColumnRunSQL返回顺序create - 上一步没有查到的,这一步是否需要新创建table - 表columns - 上一步查询结果set - setException - 异常<T extends Column> LinkedHashMap<String,T> columns(boolean create, LinkedHashMap<String,T> columns, Table table, org.springframework.jdbc.support.rowset.SqlRowSet set) throws Exception
create - 上一步没有查到的,这一步是否需要新创建table - 表columns - columnsset - setException - 异常<T extends Column> LinkedHashMap<String,T> columns(boolean create, LinkedHashMap<String,T> columns, DatabaseMetaData dbmd, Table table, String pattern) throws Exception
create - 上一步没有查到的,这一步是否需要新创建table - 表dbmd - DatabaseMetaDataException - 异常Column column(Column column, org.springframework.jdbc.support.rowset.SqlRowSetMetaData rsm, int index)
Column column(Column column, ResultSetMetaData rsm, int index)
List<Run> buildQueryTagRunSQL(Table table, boolean metadata) throws Exception
table - 表metadata - 是否需要根据metadataException<T extends Tag> LinkedHashMap<String,T> tags(int index, boolean create, Table table, LinkedHashMap<String,T> tags, DataSet set) throws Exception
index - 第几条查询SQL 对照 buildQueryTagRunSQL返回顺序create - 上一步没有查到的,这一步是否需要新创建table - 表tags - 上一步查询结果set - setException - 异常<T extends Tag> LinkedHashMap<String,T> tags(boolean create, Table table, LinkedHashMap<String,T> tags, org.springframework.jdbc.support.rowset.SqlRowSet set) throws Exception
create - 上一步没有查到的,这一步是否需要新创建table - 表tags - 上一步查询结果set - 查询结果Exception - 异常<T extends Tag> LinkedHashMap<String,T> tags(boolean create, LinkedHashMap<String,T> tags, DatabaseMetaData dbmd, Table table, String pattern) throws Exception
create - 上一步没有查到的,这一步是否需要新创建table - 表tags - 上一步查询结果dbmd - DatabaseMetaDatapattern - patternException - 异常List<Run> buildQueryPrimaryRunSQL(Table table) throws Exception
table - 表ExceptionPrimaryKey primary(int index, Table table, DataSet set) throws Exception
index - 第几条查询SQL 对照 buildQueryIndexRunSQL 返回顺序table - 表set - sql查询结果Exception - 异常List<Run> buildQueryForeignsRunSQL(Table table) throws Exception
table - 表Exception<T extends ForeignKey> LinkedHashMap<String,T> foreigns(int index, Table table, LinkedHashMap<String,T> foreigns, DataSet set) throws Exception
index - 第几条查询SQL 对照 buildQueryForeignsRunSQL 返回顺序table - 表foreigns - 上一步查询结果set - sql查询结果Exception - 异常List<Run> buildQueryIndexRunSQL(Table table, String name)
table - 表name - 名称<T extends Index> LinkedHashMap<String,T> indexs(int index, boolean create, Table table, LinkedHashMap<String,T> indexs, DataSet set) throws Exception
index - 第几条查询SQL 对照 buildQueryIndexRunSQL 返回顺序create - 上一步没有查到的,这一步是否需要新创建table - 表indexs - 上一步查询结果set - setException - 异常<T extends Index> LinkedHashMap<String,T> indexs(boolean create, Table table, LinkedHashMap<String,T> indexs, org.springframework.jdbc.support.rowset.SqlRowSet set) throws Exception
create - 上一步没有查到的,这一步是否需要新创建table - 表indexs - 上一步查询结果set - setException - 异常<T extends Index> LinkedHashMap<String,T> indexs(boolean create, LinkedHashMap<String,T> indexs, DatabaseMetaData dbmd, Table table, boolean unique, boolean approximate) throws Exception
create - 上一步没有查到的,这一步是否需要新创建table - 表dbmd - DatabaseMetaDataException - 异常List<Run> buildQueryConstraintRunSQL(Table table, boolean metadata) throws Exception
table - 表metadata - 是否需要根据metadataException<T extends Constraint> LinkedHashMap<String,T> constraints(int index, boolean create, Table table, LinkedHashMap<String,T> constraints, DataSet set) throws Exception
index - 第几条查询SQL 对照 buildQueryConstraintRunSQL 返回顺序create - 上一步没有查到的,这一步是否需要新创建table - 表constraints - 上一步查询结果set - DataSetException - 异常<T extends Constraint> LinkedHashMap<String,T> constraints(boolean create, Table table, LinkedHashMap<String,T> constraints, org.springframework.jdbc.support.rowset.SqlRowSet set) throws Exception
Exception<T extends Constraint> LinkedHashMap<String,T> constraints(boolean create, Table table, LinkedHashMap<String,T> constraints, ResultSet set) throws Exception
ExceptionList<Run> buildQueryTriggerRunSQL(Table table, List<Trigger.EVENT> events)
table - 表events - INSERT|UPATE|DELETE<T extends Trigger> LinkedHashMap<String,T> triggers(int index, boolean create, Table table, LinkedHashMap<String,T> triggers, DataSet set) throws Exception
index - 第几条查询SQL 对照 buildQueryConstraintRunSQL 返回顺序create - 上一步没有查到的,这一步是否需要新创建table - 表triggers - 上一步查询结果set - DataSetException - 异常List<Run> buildQueryProcedureRunSQL(String catalog, String schema, String name)
<T extends Procedure> LinkedHashMap<String,T> procedures(int index, boolean create, LinkedHashMap<String,T> procedures, DataSet set) throws Exception
ExceptionList<Run> buildQueryFunctionRunSQL(String catalog, String schema, String name)
<T extends Function> LinkedHashMap<String,T> functions(int index, boolean create, LinkedHashMap<String,T> functions, DataSet set) throws Exception
ExceptionList<Run> buildCreateRunSQL(Table table) throws Exception
table - 表Exception - 异常List<Run> buildAddCommentRunSQL(Table table) throws Exception
table - 表Exception - 异常List<Run> buildAlterRunSQL(Table table) throws Exception
table - 表Exception - 异常List<Run> buildAlterRunSQL(Table table, Collection<Column> columns) throws Exception
table - 表columns - 列ExceptionList<Run> buildRenameRunSQL(Table table) throws Exception
table - 表Exception - 异常List<Run> buildChangeCommentRunSQL(Table table) throws Exception
table - 表Exception - 异常List<Run> buildDropRunSQL(Table table) throws Exception
table - 表Exception - 异常StringBuilder checkTableExists(StringBuilder builder, boolean exists)
builder - builderexists - existsStringBuilder primary(StringBuilder builder, Table table)
builder - buildertable - 表StringBuilder comment(StringBuilder builder, Table table)
builder - buildertable - 表StringBuilder name(StringBuilder builder, Table table)
builder - buildertable - 表List<Run> buildCreateRunSQL(View view) throws Exception
view - 视图Exception - 异常List<Run> buildAddCommentRunSQL(View view) throws Exception
view - 视图Exception - 异常List<Run> buildAlterRunSQL(View view) throws Exception
view - 视图Exception - 异常List<Run> buildRenameRunSQL(View view) throws Exception
view - 视图Exception - 异常List<Run> buildChangeCommentRunSQL(View view) throws Exception
view - 视图Exception - 异常List<Run> buildDropRunSQL(View view) throws Exception
view - 视图Exception - 异常StringBuilder checkViewExists(StringBuilder builder, boolean exists)
builder - builderexists - existsStringBuilder comment(StringBuilder builder, View view)
builder - builderview - 视图List<Run> buildCreateRunSQL(MasterTable table) throws Exception
table - 表Exception - 异常List<Run> buildAddCommentRunSQL(MasterTable table) throws Exception
table - 表Exception - 异常List<Run> buildAlterRunSQL(MasterTable table) throws Exception
table - 表Exception - 异常List<Run> buildRenameRunSQL(MasterTable table) throws Exception
table - 表Exception - 异常List<Run> buildChangeCommentRunSQL(MasterTable table) throws Exception
table - 表Exception - 异常List<Run> buildDropRunSQL(MasterTable table) throws Exception
table - 表Exception - 异常List<Run> buildCreateRunSQL(PartitionTable table) throws Exception
table - 表Exception - 异常List<Run> buildAddCommentRunSQL(PartitionTable table) throws Exception
table - 表Exception - 异常List<Run> buildAlterRunSQL(PartitionTable table) throws Exception
table - 表Exception - 异常List<Run> buildRenameRunSQL(PartitionTable table) throws Exception
table - Exception - 异常List<Run> buildChangeCommentRunSQL(PartitionTable table) throws Exception
table - 表Exception - 异常List<Run> buildDropRunSQL(PartitionTable table) throws Exception
table - 表Exception - 异常String alterColumnKeyword()
List<Run> buildAddRunSQL(Column column, boolean slice) throws Exception
column - 列slice - 是否只生成片段(不含alter table部分,用于DDL合并)ExceptionStringBuilder addColumnGuide(StringBuilder builder, Column column)
builder - StringBuildercolumn - columnList<Run> buildAlterRunSQL(Column column, boolean slice) throws Exception
column - 列slice - 是否只生成片段(不含alter table部分,用于DDL合并)ExceptionList<Run> buildDropRunSQL(Column column, boolean slice) throws Exception
column - 列slice - 是否只生成片段(不含alter table部分,用于DDL合并)ExceptionStringBuilder dropColumnGuide(StringBuilder builder, Column column)
builder - StringBuildercolumn - columnList<Run> buildRenameRunSQL(Column column) throws Exception
column - 列ExceptionList<Run> buildChangeTypeRunSQL(Column column) throws Exception
column - 列ExceptionList<Run> buildChangeDefaultRunSQL(Column column) throws Exception
column - 列ExceptionList<Run> buildChangeNullableRunSQL(Column column) throws Exception
column - 列ExceptionList<Run> buildChangeCommentRunSQL(Column column) throws Exception
column - 列ExceptionList<Run> buildAddCommentRunSQL(Column column) throws Exception
column - 列Exception - 异常List<Run> buildDropAutoIncrement(Column column) throws Exception
column - 列Exception - 异常StringBuilder define(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder type(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder type(StringBuilder builder, Column column, String type, boolean isIgnorePrecision, boolean isIgnoreScale)
builder - buildercolumn - 列type - 数据类型(已经过转换)isIgnorePrecision - 是否忽略长度isIgnoreScale - 是否忽略小数boolean isIgnorePrecision(Column column)
boolean isIgnoreScale(Column column)
StringBuilder nullable(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder charset(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder defaultValue(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder primary(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder increment(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder onupdate(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder position(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder comment(StringBuilder builder, Column column)
builder - buildercolumn - 列StringBuilder checkColumnExists(StringBuilder builder, boolean exists)
builder - builderexists - existsList<Run> buildAddRunSQL(Tag tag) throws Exception
tag - 标签ExceptionList<Run> buildAlterRunSQL(Tag tag) throws Exception
tag - 标签ExceptionList<Run> buildDropRunSQL(Tag tag) throws Exception
tag - 标签ExceptionList<Run> buildRenameRunSQL(Tag tag) throws Exception
tag - 标签ExceptionList<Run> buildChangeDefaultRunSQL(Tag tag) throws Exception
tag - 标签ExceptionList<Run> buildChangeNullableRunSQL(Tag tag) throws Exception
tag - 标签ExceptionList<Run> buildChangeCommentRunSQL(Tag tag) throws Exception
tag - 标签ExceptionList<Run> buildChangeTypeRunSQL(Tag tag) throws Exception
tag - 标签ExceptionStringBuilder checkTagExists(StringBuilder builder, boolean exists)
builder - builderexists - existsList<Run> buildAddRunSQL(PrimaryKey primary) throws Exception
primary - 主键ExceptionList<Run> buildAlterRunSQL(PrimaryKey primary) throws Exception
primary - 主键ExceptionList<Run> buildDropRunSQL(PrimaryKey primary) throws Exception
primary - 主键ExceptionList<Run> buildRenameRunSQL(PrimaryKey primary) throws Exception
primary - 主键ExceptionList<Run> buildAddRunSQL(ForeignKey foreign) throws Exception
foreign - 外键ExceptionList<Run> buildAlterRunSQL(ForeignKey foreign) throws Exception
foreign - 外键ExceptionList<Run> buildDropRunSQL(ForeignKey foreign) throws Exception
foreign - 外键ExceptionList<Run> buildRenameRunSQL(ForeignKey foreign) throws Exception
foreign - 外键ExceptionList<Run> buildAddRunSQL(Index index) throws Exception
index - 索引ExceptionList<Run> buildAlterRunSQL(Index index) throws Exception
index - 索引ExceptionList<Run> buildDropRunSQL(Index index) throws Exception
index - 索引ExceptionList<Run> buildRenameRunSQL(Index index) throws Exception
index - 索引Exceptionvoid comment(StringBuilder builder, Index index)
builder - index - List<Run> buildAddRunSQL(Constraint constraint) throws Exception
constraint - 约束ExceptionList<Run> buildAlterRunSQL(Constraint constraint) throws Exception
constraint - 约束ExceptionList<Run> buildDropRunSQL(Constraint constraint) throws Exception
constraint - 约束ExceptionList<Run> buildRenameRunSQL(Constraint constraint) throws Exception
constraint - 约束ExceptionList<Run> buildCreateRunSQL(Trigger trigger) throws Exception
trigger - 触发器Exceptionvoid each(StringBuilder builder, Trigger trigger)
List<Run> buildAlterRunSQL(Trigger trigger) throws Exception
trigger - 触发器ExceptionList<Run> buildDropRunSQL(Trigger trigger) throws Exception
trigger - 触发器ExceptionList<Run> buildRenameRunSQL(Trigger trigger) throws Exception
trigger - 触发器ExceptionList<Run> buildCreateRunSQL(Procedure procedure) throws Exception
procedure - 存储过程Exceptionvoid parameter(StringBuilder builder, Parameter parameter)
builder - builderparameter - parameterList<Run> buildAlterRunSQL(Procedure procedure) throws Exception
procedure - 存储过程ExceptionList<Run> buildDropRunSQL(Procedure procedure) throws Exception
procedure - 存储过程ExceptionList<Run> buildRenameRunSQL(Procedure procedure) throws Exception
procedure - 存储过程ExceptionList<Run> buildCreateRunSQL(Function function) throws Exception
function - 函数ExceptionList<Run> buildAlterRunSQL(Function function) throws Exception
function - 函数ExceptionList<Run> buildDropRunSQL(Function function) throws Exception
function - 函数ExceptionList<Run> buildRenameRunSQL(Function function) throws Exception
function - 函数Exceptionboolean convert(String catalog, String schema, String table, RunValue run)
catalog - catalogschema - schematable - 表run - 值boolean convert(Map<String,Column> columns, RunValue run)
columns - 列run - 值boolean convert(Column column, RunValue run)
column - 列run - 值void value(StringBuilder builder, Object row, String key)
builder - builderrow - DataRow 或 Entitykey - 列名Object read(Column metadata, Object value, Class clazz)
metadata - Column 用来定位数据类型value - valueclazz - 目标数据类型(给entity赋值时可以根据class, DataRow赋值时可以指定class,否则按检测metadata类型转换 转换不不了的原样返回)Object write(Column metadata, Object value, boolean placeholder)
metadata - Column 用来定位数据类型placeholder - 是否占位符value - valueboolean isNumberColumn(Column column)
column - 列boolean isBooleanColumn(Column column)
column - 列boolean isCharColumn(Column column)
column - 列String value(Column column, JDBCAdapter.SQL_BUILD_IN_VALUE value)
column - 列属性,不同的数据类型解析出来的值可能不一样value - SQL_BUILD_IN_VALUECopyright © 2023. All rights reserved.