Compare commits

...

7 Commits

Author SHA1 Message Date
wang wei
90d5f4fb72 fix(TDI-38094): fix some bugs 2017-02-09 10:22:07 +08:00
wang wei
c820dd6eec fix(TDI-38094): use a template javajet for elt only, resume the one for
db output components
2017-02-08 17:47:12 +08:00
wang wei
71a2c9c7db fix(TDI-38094): fix some bugs 2017-02-08 16:54:28 +08:00
wang wei
f039783306 fix(TDI-38094): fix the schema and table name issue, ignore the text
quote which wrap them.
2017-02-08 16:02:43 +08:00
wang wei
e82fbb578a fix(TDI-38094): add the table action support 2017-02-07 18:06:22 +08:00
wang wei
4ec10b66c4 fix(TDI-38094): only remove the unuseful code and format the javajet 2017-02-07 14:07:35 +08:00
wang wei
bb234e0dbd fix(TDI-38094): add the mapping for the model 2017-02-07 14:07:33 +08:00
10 changed files with 910 additions and 339 deletions

View File

@@ -57,6 +57,14 @@
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="MAPPING"
FIELD="MAPPING_TYPE"
NUM_ROW="10"
>
<DEFAULT>mysql_id</DEFAULT>
</PARAMETER>
</PARAMETERS>

View File

@@ -159,9 +159,17 @@
<DEFAULT>"ISO-8859-15"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="PREVIEW" FIELD="IMAGE" SHOW="true" NUM_ROW="80">
<DEFAULT/>
</PARAMETER>
<PARAMETER NAME="PREVIEW" FIELD="IMAGE" SHOW="true" NUM_ROW="80">
<DEFAULT/>
</PARAMETER>
<PARAMETER
NAME="MAPPING"
FIELD="MAPPING_TYPE"
NUM_ROW="99"
>
<DEFAULT>mysql_id</DEFAULT>
</PARAMETER>
</PARAMETERS>

View File

@@ -1,6 +1,5 @@
<%@ jet
imports="
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
org.talend.core.model.process.IConnection
@@ -8,12 +7,10 @@
org.talend.designer.dbmap.external.data.ExternalDbMapTable
org.talend.designer.dbmap.language.IDbLanguage
org.talend.designer.dbmap.DbMapComponent
java.util.HashMap
java.util.Map
java.util.Set
java.util.HashSet
java.util.Set
java.util.HashSet
"
%>
<%
@@ -46,32 +43,30 @@
for (int i = 0; i < lstOutputTablesSize; i++) {
ExternalDbMapTable outputTable = outputTables.get(i);
String outputTableName = outputTable.getName();
IConnection connection = nameToOutputConnection.get(outputTableName);
IConnection connection = nameToOutputConnection.get(outputTableName);
if (connection == null) {
continue;
}
String sqlQuery = gm.buildSqlSelect((DbMapComponent) node, outputTable.getName());
String sqlQuery = gm.buildSqlSelect((DbMapComponent) node, outputTable.getName());
%>
globalMap.put(
"<%=uniqueNameComponent %>"+"QUERY" + "<%= connection.getUniqueName() %>",
<%= sqlQuery.replaceAll("[\r\n]", " ") %>
);
globalMap.put(
"<%=uniqueNameComponent %>"+"QUERY_COLUMNS_NAME" + "<%= connection.getUniqueName() %>",
<%= gm.getQueryColumnsName() %>
);
<%
if(!tablesProcessed.contains(outputTable.getTableName())) {
%>
Object <%= outputTable.getTableName() %> = new Object();
<%
}
tablesProcessed.add(outputTable.getTableName());
globalMap.put(
"<%=uniqueNameComponent %>"+"QUERY" + "<%= connection.getUniqueName() %>",
<%= sqlQuery.replaceAll("[\r\n]", " ") %>
);
globalMap.put(
"<%=uniqueNameComponent %>"+"QUERY_COLUMNS_NAME" + "<%= connection.getUniqueName() %>",
<%= gm.getQueryColumnsName() %>
);
<%
if(!tablesProcessed.contains(outputTable.getTableName())) {
%>
Object <%= outputTable.getTableName() %> = new Object();
<%
}
tablesProcessed.add(outputTable.getTableName());
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -35,6 +35,22 @@
</CONNECTORS>
<PARAMETERS>
<PARAMETER
NAME="TABLE_ACTION"
FIELD="CLOSED_LIST"
NUM_ROW="1"
>
<ITEMS DEFAULT="NONE">
<ITEM NAME="NONE" VALUE="NONE" />
<ITEM NAME="DROP_CREATE" VALUE="DROP_CREATE"/>
<ITEM NAME="CREATE" VALUE="CREATE"/>
<ITEM NAME="CREATE_IF_NOT_EXISTS" VALUE="CREATE_IF_NOT_EXISTS"/>
<ITEM NAME="DROP_IF_EXISTS_AND_CREATE" VALUE="DROP_IF_EXISTS_AND_CREATE" />
<ITEM NAME="CLEAR" VALUE="CLEAR"/>
<ITEM NAME="TRUNCATE" VALUE="TRUNCATE"/>
</ITEMS>
</PARAMETER>
<PARAMETER
NAME="DATA_ACTION"
FIELD="CLOSED_LIST"
@@ -91,7 +107,24 @@
SHOW_IF="USE_DIFFERENT_TABLE=='true'"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
</PARAMETER>
<PARAMETER
NAME="MAPPING"
FIELD="MAPPING_TYPE"
NUM_ROW="40"
>
<DEFAULT>mysql_id</DEFAULT>
</PARAMETER>
<!-- the parameter only work for dropping table action of Vertica database -->
<PARAMETER
NAME="USE_CASCADE"
FIELD="CHECK"
NUM_ROW="50"
SHOW="false">
<DEFAULT>true</DEFAULT>
</PARAMETER>
</PARAMETERS>

View File

@@ -6,16 +6,20 @@ imports="
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IConnection
org.talend.core.model.metadata.MappingTypeRetriever
org.talend.core.model.metadata.MetadataTalendType
org.talend.commons.utils.generation.CodeGenerationUtils
java.util.List
java.util.ArrayList
java.util.LinkedList
java.util.Map
java.util.HashMap
"
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/Log4jDBConnUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -29,7 +33,6 @@ imports="
String differenttable = ElementParameterParser.getValue(node, "__DIFFERENT_TABLE_NAME__");
boolean useDifferentTable = "true".equals(ElementParameterParser.getValue(node, "__USE_DIFFERENT_TABLE__"));
%>
String select_query = null;
String tableName_<%=cid%> = null;
@@ -48,7 +51,6 @@ imports="
selectQueryColumnsName = (String) globalMap.get("<%=previousComponentName%>"+"QUERY_COLUMNS_NAME"+"<%=uniqueNameConnection%>");
<%
}
%>
String dbschema_<%=cid%> = <%=dbschema%>;
if(dbschema_<%=cid%> != null && dbschema_<%=cid%>.trim().length() > 0) {
@@ -57,311 +59,199 @@ imports="
tableName_<%=cid%> = <%=useDifferentTable? differenttable:"\""+dbtable +"\""%>;
}
<%
String dataAction = ElementParameterParser.getValue(node,"__DATA_ACTION__");
String driverClass = null;
String jdbcUrl = null;
String dbuser = null;
boolean useExistingConn = false;
if(previousNode != null) {
driverClass = ElementParameterParser.getValue(previousNode, "__DRIVER_CLASS__");
jdbcUrl = ElementParameterParser.getValue(previousNode, "__URL__");
dbuser = ElementParameterParser.getValue(previousNode, "__USER__");
useExistingConn = ("true").equals(ElementParameterParser.getValue(previousNode, "__USE_EXISTING_CONNECTION__"));
}
String whereClause = ElementParameterParser.getValue(node, "__WHERE_CLAUSE__");
%>
String dbUser_<%=cid %> = null;
<%
if(useExistingConn) {
String connection = ElementParameterParser.getValue(previousNode, "__CONNECTION__");
String conn = "conn_" + connection;
String username = "username_" + connection;
%>
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
dbUser_<%=cid %> = (String)globalMap.get("<%=username%>");
<%
log4jCodeGenerateUtil.useExistConnection(node);
} else {
%>
String driverClass_<%=cid%> = <%=driverClass %>;
java.lang.Class.forName(driverClass_<%=cid%>);
String url_<%=cid %> = <%=jdbcUrl %>;
dbUser_<%=cid %> = <%=dbuser%>;
<%
String passwordFieldName = "__PASS__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/eltpassword.javajet"%>
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
java.sql.Connection conn_<%=cid%> = null;
<%
log4jCodeGenerateUtil.debugConnectionParams(node);
log4jCodeGenerateUtil.connect(node);
}
List<IMetadataColumn> columnList = null;
List<IMetadataTable> metadatas = node.getMetadataList();
if(metadatas !=null && metadatas.size()>0){
IMetadataTable metadata = metadatas.get(0);
if(metadata != null){
columnList = metadata.getListColumns();
}
}
%>
String driverClass = null;
String jdbcUrl = null;
String dbuser = null;
boolean useExistingConn = false;
if(previousNode != null) {
driverClass = ElementParameterParser.getValue(previousNode, "__DRIVER_CLASS__");
jdbcUrl = ElementParameterParser.getValue(previousNode, "__URL__");
dbuser = ElementParameterParser.getValue(previousNode, "__USER__");
useExistingConn = ("true").equals(ElementParameterParser.getValue(previousNode, "__USE_EXISTING_CONNECTION__"));
java.sql.PreparedStatement pstmt_<%=cid %> =null;
<%
if(columnList != null && columnList.size()>0){
StringBuilder insertColName = new StringBuilder();
StringBuilder updateSetStmt = new StringBuilder();
int counterOuter = 0;
for(IMetadataColumn column : columnList){
String suffix = ",";
if(counterOuter==(columnList.size()-1)){
suffix = "";
}
String columnName = column.getOriginalDbColumnName();
if(columnName==null || columnName.trim().isEmpty()){
columnName = column.getLabel();
}
insertColName.append(columnName).append(suffix);
updateSetStmt.append(columnName+"=(\"+select_query.replaceFirst(java.util.regex.Pattern.quote(selectQueryColumnsName),routines.system.StringUtils.splitSQLColumns(selectQueryColumnsName)[ "+ counterOuter + "])+\")" + suffix);
counterOuter++;
}
String whereClause = ElementParameterParser.getValue(node, "__WHERE_CLAUSE__");
if(("INSERT").equals(dataAction)){
%>
String insertQuery = "INSERT INTO "+tableName_<%=cid%>+"(<%=insertColName.toString()%>) ("+select_query+")";
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(insertQuery);
<%
} else if (("UPDATE").equals(dataAction)){
%>
String updateQuery = "UPDATE "+tableName_<%=cid%>+" SET <%=updateSetStmt.toString()%> "
<%
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
%>
+" WHERE " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
<%
}
%>
;
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(updateQuery);
<%
} else if (("DELETE").equals(dataAction)){
%>
String deleteQuery = "DELETE FROM "+ tableName_<%=cid%>+" WHERE EXISTS ("+select_query+") "
<%
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
%>
+" AND " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
<%
}
%>
;
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(deleteQuery);
<%
}
%>
int nb_line_<%=cid%> = 0;
int nb_line_updated_<%=cid%> = 0;
int nb_line_inserted_<%=cid%> = 0;
int nb_line_deleted_<%=cid%> = 0;
<%
}
%>
<%
if(useExistingConn) {
String connection = ElementParameterParser.getValue(previousNode, "__CONNECTION__");
String conn = "conn_" + connection;
%>
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
<%
log4jCodeGenerateUtil.useExistConnection(node);
} else {
%>
String driverClass_<%=cid%> = <%=driverClass %>;
java.lang.Class.forName(driverClass_<%=cid%>);
String url_<%=cid %> = <%=jdbcUrl %>;
String dbUser_<%=cid %> = <%=dbuser%>;
<%
String passwordFieldName = "__PASS__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/eltpassword.javajet"%>
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
java.sql.Connection conn_<%=cid%> = null;
<%
log4jCodeGenerateUtil.debugConnectionParams(node);
log4jCodeGenerateUtil.connect(node);
}
%>
<%
List<IMetadataColumn> columnList = null;
List<IMetadataTable> metadatas = node.getMetadataList();
if(metadatas !=null && metadatas.size()>0){
IMetadataTable metadata = metadatas.get(0);
if(metadata != null){
columnList = metadata.getListColumns();
}
}
%>
java.sql.PreparedStatement pstmt_<%=cid %> =null;
<%
if(columnList != null && columnList.size()>0){
class Column{
IMetadataColumn column;
String name;
String sqlStmt;
String value;
boolean addCol;
List<Column> replacement = new ArrayList<Column>();
public Column(IMetadataColumn column){
this.column = column;
String columname = column.getOriginalDbColumnName();
if(columname!=null && columname.trim().length()>0){
this.name = columname;
}else{
this.name = column.getLabel();
if(dbtable != null && columnList != null){
{//use the block to limit the code scope for table action
Manager manager = null;
String dbmsId = ElementParameterParser.getValue(node,"__MAPPING__");
String tableAction = ElementParameterParser.getValue(node,"__TABLE_ACTION__");
boolean isDynamic = false;
List<Column> stmtStructure = getELTManager(dbmsId, cid).createColumnList(columnList, false, null, null);
String table = useDifferentTable ? differenttable : ("\""+dbtable +"\"");
dbLog = new DBLogUtil(node);
%>
<%@ include file="../templates/_tableActionForELT.javajet"%>
<%
}
this.sqlStmt = "=?";
this.value = "?";
this.addCol =false;
}
public boolean isReplaced(){
return replacement.size()>0;
}
public List<Column> getReplacement(){
return this.replacement;
}
public IMetadataColumn getColumn(){
return this.column;
}
public String getName(){
return this.name;
}
public boolean isAddCol(){
return this.addCol;
}
public String getSqlStmt(){
return this.sqlStmt;
}
public String getValue(){
return this.value;
}
}
StringBuilder insertColName = new StringBuilder();
StringBuilder insertValueStmt = new StringBuilder();
StringBuilder updateSetStmt = new StringBuilder();
StringBuilder updateWhereStmt = new StringBuilder();
StringBuilder mergeCondition = new StringBuilder ();
List<Column> stmtStructure = new LinkedList<Column>();
for(IMetadataColumn column:columnList){
stmtStructure.add(new Column(column));
}
int counterOuter =0;
boolean firstKey = true;
boolean firstNoneKey = true;
boolean isfirstKey = true;
for(Column colStmt:stmtStructure){
String suffix = ",";
if (colStmt.getColumn().isKey()){
if (isfirstKey) {
isfirstKey = false;
}else {
mergeCondition.append(" AND ");
}
mergeCondition.append("target." + colStmt.getColumn().getLabel() + "=source." + colStmt.getColumn().getLabel());
}
if(colStmt.isReplaced()){
List<Column> replacedColumns = colStmt.getReplacement();
int counterReplace = 0;
if(counterOuter==(stmtStructure.size()-1) && counterReplace==(replacedColumns.size()-1) ){
suffix = "";
}
for(Column replacement:replacedColumns){
insertColName.append(replacement.getName()+suffix);
insertValueStmt.append(replacement.getSqlStmt()+suffix);
if(!colStmt.getColumn().isKey()){
if(!firstNoneKey){
updateSetStmt.append(",");
}else{
firstNoneKey = false;
}
updateSetStmt.append(replacement.getName());
updateSetStmt.append(replacement.getSqlStmt());
}else{
if(!firstKey){
updateWhereStmt.append(" AND ");
}else{
firstKey = false;
}
updateWhereStmt.append(replacement.getName());
updateWhereStmt.append(replacement.getSqlStmt());
}
counterReplace++;
}
}else{
if(counterOuter==(stmtStructure.size()-1)){
suffix = "";
}
if(colStmt.isAddCol()){
insertColName.append(colStmt.getName()+suffix);
insertValueStmt.append(colStmt.getSqlStmt()+suffix);
updateSetStmt.append(colStmt.getName());
updateSetStmt.append(colStmt.getSqlStmt()+suffix);
}else{
insertColName.append(colStmt.getName()+suffix);
insertValueStmt.append(colStmt.getValue()+suffix);
updateSetStmt.append(colStmt.getName()+"=(\"+select_query.replaceFirst(java.util.regex.Pattern.quote(selectQueryColumnsName),routines.system.StringUtils.splitSQLColumns(selectQueryColumnsName)[ "+ counterOuter + "])+\")" +suffix);
}
}
counterOuter ++;
}
if(("INSERT").equals(dataAction)){
%>
String insertQuery = "INSERT INTO "+tableName_<%=cid%>+"(<%=insertColName.toString()%>) ("+select_query+")";
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(insertQuery);
<%
}else if (("UPDATE").equals(dataAction)){
%>
String updateQuery = "UPDATE "+tableName_<%=cid%>+" SET <%=updateSetStmt.toString()%> "
<%
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
%>
+" WHERE " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
<%
}
%>
;
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(updateQuery);
<%
}else if (("DELETE").equals(dataAction)){
%>
String deleteQuery = "DELETE FROM "+ tableName_<%=cid%>+" WHERE EXISTS ("+select_query+") "
<%
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
%>
+" AND " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
<%
}
%>
;
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(deleteQuery);
<%
}
%>
int nb_line_<%=cid%> = 0;
int nb_line_updated_<%=cid%> = 0;
int nb_line_inserted_<%=cid%> = 0;
int nb_line_deleted_<%=cid%> = 0;
<%
}
if(dbtable != null && columnList != null){
if(("INSERT").equals(dataAction)){
%>
System.out.println("Inserting with : \n" + insertQuery + "\n");
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executing SQL:\"+insertQuery+\"");%>
nb_line_inserted_<%=cid%> = pstmt_<%=cid %>.executeUpdate();
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executed successfully.");%>
System.out.println("--> " + nb_line_inserted_<%=cid%> + " rows inserted. \n");
<%
}else if(("UPDATE").equals(dataAction)){
%>
System.out.println("Updating with : \n" + updateQuery +"\n");
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executing SQL:\"+updateQuery+\"");%>
nb_line_updated_<%=cid%> = pstmt_<%=cid %>.executeUpdate();
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executed successfully.");%>
System.out.println("--> " + nb_line_updated_<%=cid%> + " rows updated. \n");
<%
}else if (("DELETE").equals(dataAction)){
if(("INSERT").equals(dataAction)){
%>
System.out.println("Deleting with : \n" + deleteQuery +"\n");
System.out.println("Inserting with : \n" + insertQuery + "\n");
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executing SQL:\"+insertQuery+\"");%>
nb_line_inserted_<%=cid%> = pstmt_<%=cid %>.executeUpdate();
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executed successfully.");%>
System.out.println("--> " + nb_line_inserted_<%=cid%> + " rows inserted. \n");
<%
} else if(("UPDATE").equals(dataAction)){
%>
System.out.println("Updating with : \n" + updateQuery +"\n");
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executing SQL:\"+updateQuery+\"");%>
nb_line_updated_<%=cid%> = pstmt_<%=cid %>.executeUpdate();
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executed successfully.");%>
System.out.println("--> " + nb_line_updated_<%=cid%> + " rows updated. \n");
<%
} else if (("DELETE").equals(dataAction)){
%>
System.out.println("Deleting with : \n" + deleteQuery +"\n");
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executing SQL:\"+deleteQuery+\"");%>
nb_line_deleted_<%=cid%> = pstmt_<%=cid %>.executeUpdate();
<%log4jCodeGenerateUtil.logInfo(node,"info",cid+" - Executed successfully.");%>
System.out.println("--> " + nb_line_deleted_<%=cid%> + " rows deleted. \n");
System.out.println("--> " + nb_line_deleted_<%=cid%> + " rows deleted. \n");
<%
}
}
}
// END
%>
pstmt_<%=cid %>.close();
<%
if(!useExistingConn) {
%>
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed()) {
<%log4jCodeGenerateUtil.close(node);%>
}
<%
}
%>
nb_line_<%=cid%> = nb_line_updated_<%=cid%> + nb_line_inserted_<%=cid%> + nb_line_deleted_<%=cid%>;
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid%>);
globalMap.put("<%=cid %>_NB_LINE_UPDATED",nb_line_updated_<%=cid%>);
globalMap.put("<%=cid %>_NB_LINE_INSERTED",nb_line_inserted_<%=cid%>);
globalMap.put("<%=cid %>_NB_LINE_DELETED",nb_line_deleted_<%=cid%>);
<%
if(isLog4jEnabled){
Map<String,String> actionMap=new java.util.HashMap<String,String>();
actionMap.put("INSERT","inserted");
actionMap.put("UPDATE","updated");
actionMap.put("DELETE","deleted");
// END
%>
log.info("<%=cid%> - Has <%=actionMap.get(dataAction)%> records count: " + nb_line_<%=actionMap.get(dataAction)%>_<%=cid%> + ".");
<%
}
%>
pstmt_<%=cid %>.close();
<%
if(!useExistingConn) {
%>
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed()) {
<%log4jCodeGenerateUtil.close(node);%>
}
<%
}
%>
nb_line_<%=cid%> = nb_line_updated_<%=cid%> + nb_line_inserted_<%=cid%> + nb_line_deleted_<%=cid%>;
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid%>);
globalMap.put("<%=cid %>_NB_LINE_UPDATED",nb_line_updated_<%=cid%>);
globalMap.put("<%=cid %>_NB_LINE_INSERTED",nb_line_inserted_<%=cid%>);
globalMap.put("<%=cid %>_NB_LINE_DELETED",nb_line_deleted_<%=cid%>);
<%
if(isLog4jEnabled){
Map<String,String> actionMap=new java.util.HashMap<String,String>();
actionMap.put("INSERT","inserted");
actionMap.put("UPDATE","updated");
actionMap.put("DELETE","deleted");
%>
log.info("<%=cid%> - Has <%=actionMap.get(dataAction)%> records count: " + nb_line_<%=actionMap.get(dataAction)%>_<%=cid%> + ".");
<%
}
%>

View File

@@ -31,3 +31,12 @@ NB_LINE_DELETED.NAME=Number Of Deleted Lines
USE_DIFFERENT_TABLE.NAME=Use different table name
DIFFERENT_TABLE_NAME.NAME=Table name
TABLE_ACTION.ITEM.CLEAR=Clear table
TABLE_ACTION.ITEM.TRUNCATE=Truncate table
TABLE_ACTION.ITEM.CREATE=Create table
TABLE_ACTION.ITEM.CREATE_IF_NOT_EXISTS=Create table if not exists
TABLE_ACTION.ITEM.DROP_IF_EXISTS_AND_CREATE=Drop table if exists and create
TABLE_ACTION.ITEM.DROP_CREATE=Drop and create table
TABLE_ACTION.ITEM.NONE=None
TABLE_ACTION.NAME=Action on table

View File

@@ -76,5 +76,4 @@ imports="
globalMap.put("conn_<%=cid %>", conn_<%=cid %>);
globalMap.put("url_<%=cid %>", url_<%=cid%>);
//globalMap.put("user_<%=cid %>", dbUser_<%=cid%>);
//globalMap.put("pass_<%=cid %>", dbPwd_<%=cid%>);
globalMap.put("username_<%=cid %>", dbUser_<%=cid%>);

View File

@@ -0,0 +1,243 @@
<%@ jet
%>
<%
Boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
if (!isParallelize) {
manager = getELTManager(dbmsId, cid);
String ending="";
boolean useCascade = false;
if(VERTICA.equalsIgnoreCase(dbmsId)){
useCascade = "true".equals(ElementParameterParser.getValue(node,"__USE_CASCADE__"));
}
if(!("NONE").equals(tableAction)) {
if(("DROP_CREATE").equals(tableAction)) {
%>
java.sql.Statement stmtDrop_<%=cid%> = conn_<%=cid%>.createStatement();
<%dbLog.table().dropTry(dbLog.var("tableName"));%>
stmtDrop_<%=cid%>.execute("<%=manager.getDropTableSQL()%>" <%=(useCascade ? " + \" cascade\"" : "")%>);
<%dbLog.table().dropDone(dbLog.var("tableName"));%>
stmtDrop_<%=cid%>.close();
java.sql.Statement stmtCreate_<%=cid%> = conn_<%=cid%>.createStatement();
<%dbLog.table().createTry(dbLog.var("tableName"));%>
stmtCreate_<%=cid%>.execute("<%=manager.getCreateTableSQL(stmtStructure)%>)");
<%dbLog.table().createDone(dbLog.var("tableName"));%>
stmtCreate_<%=cid%>.close();
<%
} else if(("CREATE").equals(tableAction)) {
%>
java.sql.Statement stmtCreate_<%=cid%> = conn_<%=cid%>.createStatement();
<%dbLog.table().createTry(dbLog.var("tableName"));%>
stmtCreate_<%=cid%>.execute("<%=manager.getCreateTableSQL(stmtStructure)%>)");
<%dbLog.table().createDone(dbLog.var("tableName"));%>
stmtCreate_<%=cid%>.close();
<%
} else if(("CREATE_IF_NOT_EXISTS").equals(tableAction) || ("DROP_IF_EXISTS_AND_CREATE").equals(tableAction)) {
boolean tableNameCaseSensitive=false;
if(DB2.equalsIgnoreCase(dbmsId)||POSTGRESQL.equalsIgnoreCase(dbmsId)||GREENPLUM.equalsIgnoreCase(dbmsId)||POSTGREPLUS.equalsIgnoreCase(dbmsId)){
tableNameCaseSensitive=true;
}
if(MSSQL.equalsIgnoreCase(dbmsId)) {
%>
java.sql.Statement isExistStmt_<%=cid%> = conn_<%=cid%>.createStatement();
boolean whetherExist_<%=cid%> = false;
try {
isExistStmt_<%=cid%>.execute("SELECT TOP 1 1 FROM " + tableName_<%=cid%>);
whetherExist_<%=cid%> = true;
} catch (java.lang.Exception e){
whetherExist_<%=cid%> = false;
}
isExistStmt_<%=cid%>.close();
<%
} else if (ORACLE.equalsIgnoreCase(dbmsId) || SAPHANA.equalsIgnoreCase(dbmsId)) {
%>
String tableNameForSearch_<%=cid%> = <%=table%>;
String dbschemaForSearch_<%=cid%> = null;
if(dbschema_<%=cid%> == null || dbschema_<%=cid%>.trim().isEmpty()) {
dbschemaForSearch_<%=cid%> = dbUser_<%=cid %>.toUpperCase();
} else {
dbschemaForSearch_<%=cid%> = dbschema_<%=cid%>.toUpperCase();
}
java.sql.DatabaseMetaData dbMetaData_<%=cid%> = conn_<%=cid%>.getMetaData();
if(tableNameForSearch_<%=cid%>.indexOf("\"")==-1){
tableNameForSearch_<%=cid%> = tableNameForSearch_<%=cid%>.toUpperCase();
}else{
tableNameForSearch_<%=cid%> = tableNameForSearch_<%=cid%>.replaceAll("\"","");
}
java.sql.ResultSet rsTable_<%=cid%> = dbMetaData_<%=cid%>.getTables(null, dbschemaForSearch_<%=cid%>, tableNameForSearch_<%=cid%>, new String[]{"TABLE"});
boolean whetherExist_<%=cid%> = false;
if(rsTable_<%=cid%>.next()) {
whetherExist_<%=cid%> = true;
}
rsTable_<%=cid%>.close();
<%
} else if ( SYBASE.equalsIgnoreCase(dbmsId)
|| INFORMIX.equalsIgnoreCase(dbmsId) ) {
%>
java.sql.DatabaseMetaData dbMetaData_<%=cid%> = conn_<%=cid%>.getMetaData();
java.sql.ResultSet rsTable_<%=cid%> = dbMetaData_<%=cid%>.getTables(null, null, null, new String[]{"TABLE"});
boolean whetherExist_<%=cid%> = false;
while(rsTable_<%=cid%>.next()) {
String table_<%=cid%> = rsTable_<%=cid%>.getString("TABLE_NAME");
String schema_<%=cid%> = rsTable_<%=cid%>.getString("TABLE_SCHEM");
if(table_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(<%=table%>)
&& (schema_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(dbschema_<%=cid%>) || dbschema_<%=cid%>.trim().length() ==0)) {
whetherExist_<%=cid%> = true;
break;
}
}
rsTable_<%=cid%>.close();
<%
} else if( DB2.equalsIgnoreCase(dbmsId) || TERADATA.equalsIgnoreCase(dbmsId)){
%>
java.sql.DatabaseMetaData dbMetaData_<%=cid%> = conn_<%=cid%>.getMetaData();
java.sql.ResultSet rsTable_<%=cid%> = dbMetaData_<%=cid%>.getTables(null, null, null, new String[]{"TABLE"});
boolean whetherExist_<%=cid%> = false;
while(rsTable_<%=cid%>.next()) {
String table_<%=cid%> = rsTable_<%=cid%>.getString("TABLE_NAME");
String schema_<%=cid%> = rsTable_<%=cid%>.getString("TABLE_SCHEM");
if(table_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(<%=table%>)
&& (schema_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(dbschema_<%=cid%>) || (dbschema_<%=cid%>.trim().length() ==0 && dbUser_<%=cid%>.equalsIgnoreCase(schema_<%=cid%>)))) {
whetherExist_<%=cid%> = true;
break;
}
}
rsTable_<%=cid%>.close();
<%
} else if (GREENPLUM.equalsIgnoreCase(dbmsId) || POSTGRESQL.equalsIgnoreCase(dbmsId) || POSTGREPLUS.equalsIgnoreCase(dbmsId) || VERTICA.equalsIgnoreCase(dbmsId)) {
%>
java.sql.DatabaseMetaData dbMetaData_<%=cid%> = conn_<%=cid%>.getMetaData();
java.sql.ResultSet rsTable_<%=cid%> = dbMetaData_<%=cid%>.getTables(null, null, null, new String[]{"TABLE"});
boolean whetherExist_<%=cid%> = false;
String defaultSchema_<%=cid%> = "public";
if(dbschema_<%=cid%> == null || dbschema_<%=cid%>.trim().length() == 0) {
java.sql.Statement stmtSchema_<%=cid%> = conn_<%=cid%>.createStatement();
java.sql.ResultSet rsSchema_<%=cid%> = stmtSchema_<%=cid%>.executeQuery("select current_schema() ");
while(rsSchema_<%=cid%>.next()){
defaultSchema_<%=cid%> = rsSchema_<%=cid%>.getString("current_schema");
}
rsSchema_<%=cid%>.close();
stmtSchema_<%=cid%>.close();
}
while(rsTable_<%=cid%>.next()) {
String table_<%=cid%> = rsTable_<%=cid%>.getString("TABLE_NAME");
String schema_<%=cid%> = rsTable_<%=cid%>.getString("TABLE_SCHEM");
if(table_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(<%=table%>)
&& (schema_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(dbschema_<%=cid%>) || ((dbschema_<%=cid%> ==null || dbschema_<%=cid%>.trim().length() ==0) && defaultSchema_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(schema_<%=cid%>)))) {
whetherExist_<%=cid%> = true;
break;
}
}
rsTable_<%=cid%>.close();
<%
} else if(EXASOL.equalsIgnoreCase(dbmsId)) {
%>
String tableForSearch_<%=cid%> = <%=table%>;
if(tableForSearch_<%=cid%> != null){
if(tableForSearch_<%=cid%>.startsWith("\"") && tableForSearch_<%=cid%>.endsWith("\"")){
tableForSearch_<%=cid%> = tableForSearch_<%=cid%>.substring(1,tableForSearch_<%=cid%>.length()-1);
}else{
tableForSearch_<%=cid%> = tableForSearch_<%=cid%>.toUpperCase();
}
}
java.sql.DatabaseMetaData dbMetaData_<%=cid%> = conn_<%=cid%>.getMetaData();
java.sql.ResultSet rsTable_<%=cid%> = dbMetaData_<%=cid%>.getTables(null, conn_<%=cid%>.getSchema(), tableForSearch_<%=cid%>, new String[]{"TABLE"});
boolean whetherExist_<%=cid%> = false;
if(rsTable_<%=cid%>.next()) {
whetherExist_<%=cid%> = true;
}
rsTable_<%=cid%>.close();
<%
} else if(REDSHIFT.equalsIgnoreCase(dbmsId)) {
%>
String schemaForSearch_<%=cid%> = null;
String tableForSearch_<%=cid%> = <%=table%>;
java.sql.DatabaseMetaData dbMetaData_<%=cid%> = conn_<%=cid%>.getMetaData();
java.sql.ResultSet rsTable_<%=cid%> = dbMetaData_<%=cid%>.getTables(null, schemaForSearch_<%=cid%>, null, new String[]{"TABLE"});
boolean whetherExist_<%=cid%> = false;
while(rsTable_<%=cid%>.next()) {
if(rsTable_<%=cid%>.getString("TABLE_NAME").equalsIgnoreCase(tableForSearch_<%=cid%>)) {
whetherExist_<%=cid%> = true;
break;
}
}
rsTable_<%=cid%>.close();
<%
} else {
%>
java.sql.DatabaseMetaData dbMetaData_<%=cid%> = conn_<%=cid%>.getMetaData();
java.sql.ResultSet rsTable_<%=cid%> = dbMetaData_<%=cid%>.getTables(null, null, null, new String[]{"TABLE"});
boolean whetherExist_<%=cid%> = false;
while(rsTable_<%=cid%>.next()) {
String table_<%=cid%> = rsTable_<%=cid%>.getString("TABLE_NAME");
if(table_<%=cid%>.equalsIgnoreCase(<%=table%>)) {
whetherExist_<%=cid%> = true;
break;
}
}
rsTable_<%=cid%>.close();
<%
}
%>
<%
if(("CREATE_IF_NOT_EXISTS").equals(tableAction)) {
%>
if(!whetherExist_<%=cid%>) {
java.sql.Statement stmtCreate_<%=cid%> = conn_<%=cid%>.createStatement();
<%dbLog.table().createTry(dbLog.var("tableName"));%>
stmtCreate_<%=cid%>.execute("<%=manager.getCreateTableSQL(stmtStructure)%>)");
<%dbLog.table().createDone(dbLog.var("tableName"));%>
stmtCreate_<%=cid%>.close();
}
<%
} else {
%>
if(whetherExist_<%=cid%>) {
java.sql.Statement stmtDrop_<%=cid%> = conn_<%=cid%>.createStatement();
<%dbLog.table().dropTry(dbLog.var("tableName"));%>
stmtDrop_<%=cid%>.execute("<%=manager.getDropTableSQL()%>" <%=(useCascade ? " + \" cascade\"" : "")%>);
<%dbLog.table().dropDone(dbLog.var("tableName"));%>
stmtDrop_<%=cid%>.close();
}
java.sql.Statement stmtCreate_<%=cid%> = conn_<%=cid%>.createStatement();
<%dbLog.table().createTry(dbLog.var("tableName"));%>
stmtCreate_<%=cid%>.execute("<%=manager.getCreateTableSQL(stmtStructure)%>)");
<%dbLog.table().createDone(dbLog.var("tableName"));%>
stmtCreate_<%=cid%>.close();
<%
}
} else if(("CLEAR").equals(tableAction)) {
%>
java.sql.Statement stmtClear_<%=cid%> = conn_<%=cid%>.createStatement();
<%dbLog.table().clearTry(dbLog.var("tableName"));%>
stmtClear_<%=cid%>.executeUpdate("<%=manager.getDeleteTableSQL()%>");
<%dbLog.table().clearDone(dbLog.var("tableName"));%>
stmtClear_<%=cid%>.close();
<%
} else if(("TRUNCATE").equals(tableAction)) {
%>
java.sql.Statement stmtTrunc_<%=cid%> = conn_<%=cid%>.createStatement();
<%dbLog.table().truncateTry(dbLog.var("tableName"));%>
<%if(DB2.equalsIgnoreCase(dbmsId)){%>
conn_<%=cid%>.commit();
<%}%>
stmtTrunc_<%=cid%>.executeUpdate("<%=manager.getTruncateTableSQL()%>");
<%if(INFORMIX.equalsIgnoreCase(dbmsId)){%>
if(!conn_<%= cid %>.getAutoCommit()){
conn_<%=cid%>.commit();
}
<%}%>
<%dbLog.table().truncateDone(dbLog.var("tableName"));%>
stmtTrunc_<%=cid%>.close();
<%
}
}
}
%>

View File

@@ -7,20 +7,24 @@ String dbms=ElementParameterParser.getValue(node, "__MAPPING__");
boolean convertToUppercase_tableAction = "true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONVERT_COLUMN_TABLE_TO_UPPERCASE__"));
if (!isParallelize) {
//end issue 0010346 Parallelization crash with "Drop table if exists and create"
manager = getManager(dbmsId, cid);
manager = getManager(dbmsId, cid);
String ending="";
//TODO need to remove it as it seems not useful now
if("VECTORWISE".equalsIgnoreCase(dbmsId)) {
ending="WITH STRUCTURE = VECTORWISE";
}
boolean useCascade = "true".equals(ElementParameterParser.getValue(node,"__USE_CASCADE__"));
//bugfix: TDI-31650
boolean setQueryTimeOut = false;
String queryTimeOutInSeconds = null;
if(SYBASE.equalsIgnoreCase(dbmsId)){
setQueryTimeOut = "true".equals(ElementParameterParser.getValue(node,"__SET_QUERY_TIMEOUT__"));
queryTimeOutInSeconds = ElementParameterParser.getValue(node,"__QUERY_TIMEOUT_IN_SECONDS__");
setQueryTimeOut = "true".equals(ElementParameterParser.getValue(node,"__SET_QUERY_TIMEOUT__"));
queryTimeOutInSeconds = ElementParameterParser.getValue(node,"__QUERY_TIMEOUT_IN_SECONDS__");
}
if(!("NONE").equals(tableAction)) {
@@ -137,7 +141,7 @@ if (!isParallelize) {
java.sql.Statement isExistStmt_<%=cid%> = conn_<%=cid%>.createStatement();
boolean whetherExist_<%=cid%> = false;
try {
isExistStmt_<%=cid%>.execute("SELECT TOP 1 1 FROM [" + tableName_<%=cid%> + "]" );
isExistStmt_<%=cid%>.execute("SELECT TOP 1 1 FROM [" + tableName_<%=cid%> + "]" );
whetherExist_<%=cid%> = true;
} catch (java.lang.Exception e){
whetherExist_<%=cid%> = false;

View File

@@ -1185,7 +1185,7 @@ public class CLASS {
/*
* maybe some db need add getLProtectedChar() and getRProtectedChar() to schema name.
* this because of some db default add getLProtectedChar() and getRProtectedChar() to schaem when create table. e.g:db2
* this because of some db default add getLProtectedChar() and getRProtectedChar() to schema when create table. e.g:db2
*
* in fact the db add getLProtectedChar() and getRProtectedChar() to scheam when create table that is wrong
*/
@@ -4155,6 +4155,388 @@ public class CLASS {
return "";
}
}
//////////////////////////////////////////////////////////////////////////////////
//the managers which only work for tELTJDBCOutput component, we add it to ignore the text quote which wrap the schema, table or column name.
public class AS400ELTManager extends AS400Manager {
public AS400ELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class AccessELTManager extends AccessManager {
public AccessELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class DB2ELTManager extends DB2Manager {
public DB2ELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class FirebirdELTManager extends FirebirdManager {
public FirebirdELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class HSQLDBELTManager extends HSQLDBManager {
public HSQLDBELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class HiveELTManager extends HiveManager {
public HiveELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class InformixELTManager extends InformixManager {
public InformixELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class IngresELTManager extends IngresManager {
public IngresELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class VectorWiseELTManager extends VectorWiseManager {
public VectorWiseELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class InterbaseELTManager extends InterbaseManager {
public InterbaseELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class JavaDBELTManager extends JavaDBManager {
public JavaDBELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class MaxDBELTManager extends MaxDBManager {
public MaxDBELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class MSSQLELTManager extends MSSQLManager {
public MSSQLELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class MysqlELTManager extends MysqlManager {
public MysqlELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class NetezzaELTManager extends NetezzaManager {
public NetezzaELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class OracleELTManager extends OracleManager {
public OracleELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class PostgrePlusELTManager extends PostgrePlusManager {
public PostgrePlusELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class GreenplumELTManager extends GreenplumManager {
public GreenplumELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class PostgreELTManager extends PostgreManager {
public PostgreELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class RedshiftELTManager extends RedshiftManager {
public RedshiftELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class SQLiteELTManager extends SQLiteManager {
public SQLiteELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class SybaseELTManager extends SybaseManager {
public SybaseELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class TeradataELTManager extends TeradataManager {
public TeradataELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class VerticaELTManager extends VerticaManager {
public VerticaELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class ExasolELTManager extends ExasolManager {
public ExasolELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public class SAPHanaELTManager extends SAPHanaManager {
public SAPHanaELTManager(String cid) {
super(cid);
}
protected String getLProtectedChar() {
return "";
}
protected String getRProtectedChar() {
return "";
}
}
public Manager getELTManager(String dbmsId, String cid) {
Manager manager = managerMap.get(dbmsId + cid);
if(manager == null) {
if(dbmsId.equalsIgnoreCase(AS400)) {
manager = new AS400ELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(ACCESS)) {
manager = new AccessELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(DB2)) {
manager = new DB2ELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(FIREBIRD)) {
manager = new FirebirdELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(HSQLDB)) {
manager = new HSQLDBELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(HIVE)) {
manager = new HiveELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(INFORMIX)) {
manager = new InformixELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(INGRES)) {
manager = new IngresELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(VECTORWISE)) {
manager = new VectorWiseELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(INTERBASE)) {
manager = new InterbaseELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(JAVADB)) {
manager = new JavaDBELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(MAXDB)) {
manager = new MaxDBELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(MSSQL)) {
manager = new MSSQLELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(MYSQL)) {
manager = new MysqlELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(NETEZZA)) {
manager = new NetezzaELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(ORACLE)) {
manager = new OracleELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(POSTGREPLUS)) {
manager = new PostgrePlusELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(GREENPLUM)) {
manager = new GreenplumELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(POSTGRESQL)) {
manager = new PostgreELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(REDSHIFT)) {
manager = new RedshiftELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(SQLITE)) {
manager = new SQLiteELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(SYBASE)) {
manager = new SybaseELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(TERADATA)) {
manager = new TeradataELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(VERTICA)) {
manager = new VerticaELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(EXASOL)) {
manager = new ExasolELTManager(cid);
} else if(dbmsId.equalsIgnoreCase(SAPHANA)) {
manager = new SAPHanaELTManager(cid);
} else {
manager = new UnDefinedManager(cid);
((UnDefinedManager)manager).setDBMSId(dbmsId);
}
}
managerMap.put(dbmsId + cid, manager);
return manager;
}
/////////////////////////////////////////////////////////////////////////////////////
//ELT part end
public Manager getManager(String dbmsId, String cid) {
Manager manager = managerMap.get(dbmsId + cid);
if(manager == null) {