类 BaseTableScriptCreator
java.lang.Object
net.sohelp.boot.engine.db.table.script.BaseTableScriptCreator
- 所有已实现的接口:
TableScriptInterface
表Script产生器基类
- 从以下版本开始:
- 2016/03/16
- 作者:
- AaronFung
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明abstract StringalterField(PropertyVO propertyVO) 生成修改字段的SQL语句abstract StringcreateIndexKey(PropertyVO propertyVO) 生成创建索引的SQL语句abstract StringcreatePrimaryKey(PropertyVO propertyVO) 生成创建主键的SQL语句createUnique(EntityVO entityVO) 生成创建唯一约束的SQL语句abstract StringdropIndexKey(PropertyVO propertyVO) 生成删除索引的SQL语句abstract StringdropPrimaryKey(String tableName) 生成删除主键的SQL语句dropUnique(EntityVO entityVO) 生成删除唯一约束的SQL语句abstract boolean判断指定表是否存在abstract boolean判断指定表中的字段是否存在获取所有实体对象列表abstract EntityVO根据表名获取实体对象信息abstract StringgetMappingType(PropertyVO propertyVO) 获取属性对应的数据库字段类型映射getProperty(String tableName, String fieldName) 根据表名和字段名获取属性对象abstract intgetTableFieldLength(String tableName, String fieldName) 获取指定表字段的长度abstract StringgetTableFieldType(String tableName, String fieldName) 获取指定表字段的数据库类型booleanisEqualsProperty(PropertyVO propertyVO) 判断给定属性与数据库中对应字段是否相等(类型和长度)booleanisEqualsProperty(PropertyVO xmlProperty, PropertyVO fieldPropertyVO) 判断两个属性对象是否相等(类型和长度)abstract booleanisExistIndexKey(PropertyVO propertyVO) 判断指定属性的索引是否存在abstract booleanisExistPrimaryKey(String tableName) 判断指定表是否存在主键保存表结构,根据实体对象生成创建或修改表的SQL语句从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 net.sohelp.boot.engine.db.table.script.interfaces.TableScriptInterface
createField, createTable, dropField, droptable, getEntityNames, getProperties
-
构造器详细资料
-
BaseTableScriptCreator
public BaseTableScriptCreator()
-
-
方法详细资料
-
exist
判断指定表中的字段是否存在- 指定者:
exist在接口中TableScriptInterface- 参数:
tableName- 表名fieldName- 字段名- 返回:
- 如果字段存在返回true,否则返回false
- 抛出:
SQLException- SQL执行异常
-
exist
判断指定表是否存在- 指定者:
exist在接口中TableScriptInterface- 参数:
tableName- 表名- 返回:
- 如果表存在返回true,否则返回false
- 抛出:
SQLException- SQL执行异常
-
getMappingType
获取属性对应的数据库字段类型映射- 指定者:
getMappingType在接口中TableScriptInterface- 参数:
propertyVO- 属性对象- 返回:
- 数据库字段类型
- 抛出:
SQLException- SQL执行异常
-
isExistPrimaryKey
判断指定表是否存在主键- 指定者:
isExistPrimaryKey在接口中TableScriptInterface- 参数:
tableName- 表名- 返回:
- 如果存在主键返回true,否则返回false
- 抛出:
SQLException- SQL执行异常
-
dropPrimaryKey
生成删除主键的SQL语句- 指定者:
dropPrimaryKey在接口中TableScriptInterface- 参数:
tableName- 表名- 返回:
- 删除主键的SQL语句
-
createPrimaryKey
生成创建主键的SQL语句- 指定者:
createPrimaryKey在接口中TableScriptInterface- 参数:
propertyVO- 属性对象,包含主键信息- 返回:
- 创建主键的SQL语句
-
dropIndexKey
生成删除索引的SQL语句- 参数:
propertyVO- 属性对象,包含索引信息- 返回:
- 删除索引的SQL语句
- 抛出:
SQLException- SQL执行异常
-
createIndexKey
生成创建索引的SQL语句- 参数:
propertyVO- 属性对象,包含索引信息- 返回:
- 创建索引的SQL语句
- 抛出:
SQLException- SQL执行异常
-
isExistIndexKey
判断指定属性的索引是否存在- 参数:
propertyVO- 属性对象- 返回:
- 如果索引存在返回true,否则返回false
- 抛出:
SQLException- SQL执行异常
-
getTableFieldType
获取指定表字段的数据库类型- 指定者:
getTableFieldType在接口中TableScriptInterface- 参数:
tableName- 表名fieldName- 字段名- 返回:
- 字段的数据库类型
- 抛出:
SQLException- SQL执行异常
-
getEntity
根据表名获取实体对象信息- 指定者:
getEntity在接口中TableScriptInterface- 参数:
tableName- 表名- 返回:
- 实体对象
- 抛出:
SQLException- SQL执行异常
-
getTableFieldLength
获取指定表字段的长度- 指定者:
getTableFieldLength在接口中TableScriptInterface- 参数:
tableName- 表名fieldName- 字段名- 返回:
- 字段长度
- 抛出:
SQLException- SQL执行异常
-
getProperty
根据表名和字段名获取属性对象- 指定者:
getProperty在接口中TableScriptInterface- 参数:
tableName- 表名fieldName- 字段名- 返回:
- 属性对象,如果字段不存在返回null
- 抛出:
SQLException- SQL执行异常
-
isEqualsProperty
判断给定属性与数据库中对应字段是否相等(类型和长度)- 指定者:
isEqualsProperty在接口中TableScriptInterface- 参数:
propertyVO- 属性对象- 返回:
- 如果相等返回true,否则返回false
- 抛出:
SQLException- SQL执行异常
-
isEqualsProperty
public boolean isEqualsProperty(PropertyVO xmlProperty, PropertyVO fieldPropertyVO) throws SQLException 判断两个属性对象是否相等(类型和长度)- 指定者:
isEqualsProperty在接口中TableScriptInterface- 参数:
xmlProperty- XML配置中的属性对象fieldPropertyVO- 数据库中的属性对象- 返回:
- 如果相等返回true,否则返回false
- 抛出:
SQLException- SQL执行异常
-
createUnique
生成创建唯一约束的SQL语句- 指定者:
createUnique在接口中TableScriptInterface- 参数:
entityVO- 实体对象- 返回:
- 创建唯一约束的SQL语句,当前实现返回null
-
dropUnique
生成删除唯一约束的SQL语句- 指定者:
dropUnique在接口中TableScriptInterface- 参数:
entityVO- 实体对象- 返回:
- 删除唯一约束的SQL语句,当前实现返回null
-
alterField
生成修改字段的SQL语句- 指定者:
alterField在接口中TableScriptInterface- 参数:
propertyVO- 属性对象- 返回:
- 修改字段的SQL语句
- 抛出:
SQLException- SQL执行异常
-
saveTable
保存表结构,根据实体对象生成创建或修改表的SQL语句- 指定者:
saveTable在接口中TableScriptInterface- 参数:
entityVO- 实体对象,包含表结构信息- 返回:
- 创建或修改表的SQL语句
- 抛出:
SQLException- SQL执行异常
-
getEntities
获取所有实体对象列表- 指定者:
getEntities在接口中TableScriptInterface- 返回:
- 实体对象列表
- 抛出:
SQLException- SQL执行异常
-