use of com.varsql.core.db.valueobject.ddl.DDLInfo in project varsql by varsqlinfo.
the class SybaseDDLScript method getFunctions.
@Override
public List<DDLInfo> getFunctions(DatabaseParamInfo dataParamInfo, DDLCreateOption ddlOption, String... objNmArr) throws Exception {
logger.debug(" Function DDL Generation...");
SqlSession sqlSesseion = SQLManager.getInstance().sqlSessionTemplate(dataParamInfo.getVconnid());
List<DDLInfo> reval = new ArrayList<DDLInfo>();
DDLInfo ddlInfo;
StringBuilder ddlStr;
for (String name : objNmArr) {
ddlInfo = new DDLInfo();
ddlInfo.setName(name);
ddlStr = new StringBuilder();
dataParamInfo.setObjectName(name);
Map param = getDefaultTemplateParam(ddlOption, dataParamInfo, sqlSesseion.selectList("objectScriptSource", dataParamInfo));
ddlStr.append(SQLTemplateFactory.getInstance().sqlRender(dbType, SQLTemplateCode.FUNCTION.create, param));
ddlInfo.setCreateScript(VarsqlFormatterUtil.ddlFormat(VarsqlFormatterUtil.addLastSemicolon(ddlStr, ddlOption), dbType));
reval.add(ddlInfo);
}
return reval;
}
use of com.varsql.core.db.valueobject.ddl.DDLInfo in project varsql by varsqlinfo.
the class SybaseDDLScript method getTables.
@Override
public List<DDLInfo> getTables(DatabaseParamInfo dataParamInfo, DDLCreateOption ddlOption, String... objNmArr) throws Exception {
SqlSession client = SQLManager.getInstance().sqlSessionTemplate(dataParamInfo.getVconnid());
List<DDLInfo> reval = new ArrayList<DDLInfo>();
DDLInfo ddlInfo;
StringBuilder ddlStr;
for (String name : objNmArr) {
ddlStr = new StringBuilder();
ddlInfo = new DDLInfo();
ddlInfo.setName(name);
dataParamInfo.setObjectName(name);
Map param = getDefaultTableTemplateParam(ddlOption, dataParamInfo, client.selectList("tableScript", dataParamInfo), client.selectList("tableScriptPk", dataParamInfo), client.selectList("tableScriptComments", dataParamInfo));
ddlStr.append(SQLTemplateFactory.getInstance().sqlRender(dbType, SQLTemplateCode.TABLE.create, param));
ddlInfo.setCreateScript(ddlStr.toString());
reval.add(ddlInfo);
}
return reval;
}
use of com.varsql.core.db.valueobject.ddl.DDLInfo in project varsql by varsqlinfo.
the class MariadbDDLScript method getFunctions.
@Override
public List<DDLInfo> getFunctions(DatabaseParamInfo dataParamInfo, DDLCreateOption ddlOption, String... objNmArr) throws Exception {
logger.debug(" Function DDL Generation...");
SqlSession sqlSesseion = SQLManager.getInstance().sqlSessionTemplate(dataParamInfo.getVconnid());
List<DDLInfo> reval = new ArrayList<DDLInfo>();
DDLInfo ddlInfo;
StringBuilder ddlStr;
for (String name : objNmArr) {
ddlInfo = new DDLInfo();
ddlInfo.setName(name);
ddlStr = new StringBuilder();
dataParamInfo.setObjectName(name);
if (ddlOption.isAddDropClause()) {
ddlStr.append("/* DROP FUNCTION " + dataParamInfo.getObjectName() + "; */").append(BlankConstants.NEW_LINE_TWO);
}
ParamMap source = sqlSesseion.selectOne("functionScript", dataParamInfo);
ddlStr.append(source.getString("Create Function"));
ddlInfo.setCreateScript(VarsqlFormatterUtil.ddlFormat(VarsqlFormatterUtil.addLastSemicolon(ddlStr, ddlOption), dbType));
reval.add(ddlInfo);
}
return reval;
}
use of com.varsql.core.db.valueobject.ddl.DDLInfo in project varsql by varsqlinfo.
the class MariadbDDLScript method getIndexs.
@Override
public List<DDLInfo> getIndexs(DatabaseParamInfo dataParamInfo, DDLCreateOption ddlOption, String... objNmArr) throws Exception {
SqlSession sqlSesseion = SQLManager.getInstance().sqlSessionTemplate(dataParamInfo.getVconnid());
List<DDLInfo> reval = new ArrayList<DDLInfo>();
DDLInfo ddlInfo;
for (String name : objNmArr) {
ddlInfo = new DDLInfo();
ddlInfo.setName(name);
dataParamInfo.setObjectName(name);
ddlInfo.setCreateScript(VarsqlFormatterUtil.ddlFormat("", dbType));
reval.add(ddlInfo);
}
return reval;
}
use of com.varsql.core.db.valueobject.ddl.DDLInfo in project varsql by varsqlinfo.
the class MariadbDDLScript method getViews.
@Override
public List<DDLInfo> getViews(DatabaseParamInfo dataParamInfo, DDLCreateOption ddlOption, String... objNmArr) throws Exception {
StringBuilder ddlStr;
SqlSession sqlSesseion = SQLManager.getInstance().sqlSessionTemplate(dataParamInfo.getVconnid());
List<DDLInfo> reval = new ArrayList<DDLInfo>();
DDLInfo ddlInfo;
for (String name : objNmArr) {
ddlStr = new StringBuilder();
ddlInfo = new DDLInfo();
ddlInfo.setName(name);
dataParamInfo.setObjectName(name);
if (ddlOption.isAddDropClause()) {
ddlStr.append("/* DROP ViEW " + dataParamInfo.getObjectName() + "; */").append(BlankConstants.NEW_LINE_TWO);
}
ParamMap source = sqlSesseion.selectOne("viewScript", dataParamInfo);
ddlStr.append(source.getString("Create View"));
ddlInfo.setCreateScript(VarsqlFormatterUtil.ddlFormat(VarsqlFormatterUtil.addLastSemicolon(ddlStr, ddlOption), dbType));
reval.add(ddlInfo);
}
return reval;
}
Aggregations