Compare commits
1 Commits
patch/TPS-
...
bug/6.3/TD
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a6355c1d6 |
@@ -162,20 +162,6 @@ if(("true").equals(useExistingConn)) {
|
||||
%>
|
||||
dbschema_<%=cid%> = (String)globalMap.get("<%=tableschema%>");
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
String autoCommit = "true".equals(ElementParameterParser.getValue(connectionNode, "__AUTO_COMMIT__"))?"true":"false";
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
dbUser_<%=cid %> = (String)globalMap.get("<%=username%>");
|
||||
<%dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");%>
|
||||
<%
|
||||
@@ -186,7 +172,11 @@ if(("true").equals(useExistingConn)) {
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
conn_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -32,22 +32,8 @@ if(("true").equals(useExistingConn)) {
|
||||
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
String conn = "conn_" + connection;
|
||||
%>
|
||||
connection_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
String autoCommit = "true".equals(ElementParameterParser.getValue(connectionNode, "__AUTO_COMMIT__"))?"true":"false";
|
||||
%>
|
||||
if (null == connection_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
connection_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%dbLog.conn().useExistConn("connection_"+cid+".getMetaData().getURL()", "connection_"+cid+".getMetaData().getUserName()");%>
|
||||
connection_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%dbLog.conn().useExistConn("connection_"+cid+".getMetaData().getURL()", "connection_"+cid+".getMetaData().getUserName()");%>
|
||||
<%
|
||||
} else {
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
@@ -56,7 +42,11 @@ if(specify_alias){
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
connection_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
connection_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -162,21 +162,6 @@ if(("true").equals(useExistingConn)) {
|
||||
String conn = "conn_" + connection;
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
String autoCommit = "true".equals(ElementParameterParser.getValue(connectionNode, "__AUTO_COMMIT__"))?"true":"false";
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
<%dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");%>
|
||||
<%
|
||||
} else {
|
||||
@@ -186,8 +171,12 @@ if(("true").equals(useExistingConn)) {
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
conn_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
} else {
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -18,30 +18,6 @@ imports="
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed())
|
||||
{
|
||||
<%log4jCodeGenerateUtil.close(node);%>
|
||||
|
||||
@@ -29,23 +29,6 @@ imports="
|
||||
try{
|
||||
<%
|
||||
log4jCodeGenerateUtil.useExistConnection(node);
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
String tableName_<%=cid%> = <%=tableName%>;
|
||||
|
||||
@@ -19,29 +19,6 @@ imports="
|
||||
String conn = "conn_" + connection;
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid %> = (java.sql.Connection)globalMap.get("<%=conn %>");
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed()) {
|
||||
<%if(close){%>
|
||||
|
||||
@@ -69,8 +69,12 @@ imports="
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
} else {
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -124,27 +124,6 @@ if(("true").equals(useExistingConn)){
|
||||
%>
|
||||
java.sql.Connection connection_<%=cid %> = (java.sql.Connection)globalMap.get("<%=conn %>");
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
String autoCommit = "true".equals(ElementParameterParser.getValue(connectionNode, "__AUTO_COMMIT__"))?"true":"false";
|
||||
%>
|
||||
if (null == connection_<%=cid %>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
connection_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
if (connection_<%=cid%> != null) {
|
||||
connection_<%=cid%>.setAutoCommit(<%=autoCommit%>);
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
dbLog.conn().useExistConn("connection_"+cid+".getMetaData().getURL()", "connection_"+cid+".getMetaData().getUserName()");
|
||||
} else {
|
||||
%>
|
||||
@@ -157,7 +136,11 @@ if(("true").equals(useExistingConn)){
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
connection_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
connection_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -19,29 +19,7 @@ imports="
|
||||
String conn = "conn_" + connection;
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn %>");
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed()) {
|
||||
<%
|
||||
if(close){
|
||||
|
||||
@@ -32,23 +32,6 @@ if(("true").equals(useExistingConn)){
|
||||
java.sql.Connection connection_<%=cid %> = (java.sql.Connection)globalMap.get("<%=conn %>");
|
||||
<%dbLog.conn().useExistConn("connection_"+cid+".getMetaData().getURL()", "connection_"+cid+".getMetaData().getUserName()");%>
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == connection_<%=cid %>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
connection_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
}else{
|
||||
%>
|
||||
java.sql.Connection connection_<%=cid %> = null;
|
||||
@@ -59,7 +42,11 @@ if(("true").equals(useExistingConn)){
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
connection_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
connection_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -29,23 +29,6 @@ imports="
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
log4jCodeGenerateUtil.useExistConnection(node);
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
int nb_table_<%=cid%> = 0;
|
||||
|
||||
|
||||
@@ -22,31 +22,6 @@ imports="
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
String nodeUniqueName = processNode.getUniqueName();
|
||||
if(connection.equals(nodeUniqueName) || (connection+"_in").equals(nodeUniqueName)) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed())
|
||||
{
|
||||
<%log4jCodeGenerateUtil.close(node);%>
|
||||
|
||||
@@ -23,31 +23,6 @@ imports="
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
String nodeUniqueName = processNode.getUniqueName();
|
||||
if(connection.equals(nodeUniqueName) || (connection+"_in").equals(nodeUniqueName)) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed()) {
|
||||
<%if(close){%>
|
||||
try{
|
||||
|
||||
@@ -179,30 +179,6 @@ if(useExistingConnection) {
|
||||
}
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
String nodeUniqueName = processNode.getUniqueName();
|
||||
if(connection.equals(nodeUniqueName) || (connection+"_in").equals(nodeUniqueName)) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
String autoCommit = "true".equals(ElementParameterParser.getValue(connectionNode, "__AUTO_COMMIT__"))?"true":"false";
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
if (conn_<%=cid%> != null) {
|
||||
conn_<%=cid%>.setAutoCommit(<%=autoCommit%>);
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");%>
|
||||
<%
|
||||
} else {
|
||||
@@ -214,7 +190,11 @@ if(useExistingConnection) {
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
conn_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -23,31 +23,6 @@ imports="
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
String nodeUniqueName = processNode.getUniqueName();
|
||||
if(connection.equals(nodeUniqueName) || (connection+"_in").equals(nodeUniqueName)) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed()) {
|
||||
<%
|
||||
if(close){
|
||||
|
||||
@@ -33,23 +33,6 @@ if(useExistingConn) {
|
||||
connection_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%dbLog.conn().useExistConn("connection_"+cid+".getMetaData().getURL()", "connection_"+cid+".getMetaData().getUserName()");%>
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == connection_<%=cid %>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
connection_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
String dbVersion = ElementParameterParser.getValue(node, "__DB_VERSION__");
|
||||
@@ -64,7 +47,11 @@ if(useExistingConn) {
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
connection_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
connection_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -18,30 +18,6 @@ imports="
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed())
|
||||
{
|
||||
<%log4jCodeGenerateUtil.close(node);%>
|
||||
|
||||
@@ -20,30 +20,6 @@ imports="
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed()) {
|
||||
<%if(close){%>
|
||||
try{
|
||||
|
||||
@@ -83,8 +83,12 @@ imports="
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
} else {
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -206,23 +206,6 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
dbschema_<%=cid%> = (String)globalMap.get("<%=schema%>");
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
String autoCommit = "true".equals(ElementParameterParser.getValue(connectionNode, "__AUTO_COMMIT__"))?"true":"false";
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
if (conn_<%=cid%> != null) {
|
||||
conn_<%=cid%>.setAutoCommit(<%=autoCommit%>);
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
<%dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");%>
|
||||
<%
|
||||
} else {
|
||||
@@ -232,8 +215,12 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
conn_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
} else {
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -20,30 +20,6 @@ imports="
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed()) {
|
||||
<%
|
||||
if(close){
|
||||
|
||||
@@ -36,23 +36,6 @@ if (useExistingConnection) {
|
||||
%>
|
||||
connection_<%=cid%> = (java.sql.Connection) globalMap.get("<%=connectionName%>");
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == connection_<%=cid %>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
connection_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
@@ -60,7 +43,11 @@ if (useExistingConnection) {
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
connection_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
connection_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -174,21 +174,6 @@ if(("true").equals(useExistingConn)) {
|
||||
String conn = "conn_" + connection;
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
String autoCommit = "true".equals(ElementParameterParser.getValue(connectionNode, "__AUTO_COMMIT__"))?"true":"false";
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
<%dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");%>
|
||||
<%if(savePoint && !useBatchSize && !("true").equals(dieOnError)){%>
|
||||
java.sql.Savepoint sp_<%=cid %> = null;
|
||||
@@ -200,7 +185,11 @@ if(("true").equals(useExistingConn)) {
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
conn_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -48,10 +48,9 @@ imports="
|
||||
} else {
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(node, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
|
||||
if ((null == globalMap.get(KEY_DB_DATASOURCES)) || "".equals(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (dataSources_<%=cid%> == null) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
@@ -66,7 +65,15 @@ imports="
|
||||
globalMap.put("conn_<%=cid%>", conn_<%=cid%>);
|
||||
<%
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(node, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
} else {
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new Exception("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
globalMap.put("conn_<%=cid%>", conn_<%=cid%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -18,26 +18,9 @@ imports="
|
||||
String conn = "conn_" + connection;
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed())
|
||||
{
|
||||
<%dbLog.conn().closeTry(dbLog.str(conn));%>
|
||||
<%dbLog.conn().closeTry(dbLog.str(conn));%>
|
||||
conn_<%=cid%>.close();
|
||||
<%dbLog.conn().closeDone(dbLog.str(conn));%>
|
||||
<%dbLog.conn().closeDone(dbLog.str(conn));%>
|
||||
}
|
||||
|
||||
@@ -20,23 +20,6 @@ imports="
|
||||
String conn = "conn_" + connection;
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed())
|
||||
{
|
||||
<% if(close){%>
|
||||
|
||||
@@ -58,31 +58,9 @@ imports="
|
||||
}
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
String nodeUniqueName = processNode.getUniqueName();
|
||||
if(connection.equals(nodeUniqueName) || (connection+"_in").equals(nodeUniqueName)) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
//globalMap.put("<%=conn%>", conn_<%=cid%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%log4jCodeGenerateUtil.useExistConnection(node);%>
|
||||
<%
|
||||
dbInputBeginUtil.afterUseExistConnection(node);
|
||||
|
||||
} else {
|
||||
dbInputBeginUtil.createConnection(node);
|
||||
if ("teradata_id".equalsIgnoreCase(dbms)) {
|
||||
|
||||
@@ -66,7 +66,11 @@ imports="
|
||||
<%
|
||||
String alias = ElementParameterParser.getValue(node, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -20,23 +20,6 @@ imports="
|
||||
String conn = "conn_" + connection;
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if(dataSources_<%=cid%>!=null) {
|
||||
if(dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>)!=null) {
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
if(conn_<%=cid%> != null && !conn_<%=cid%>.isClosed()) {
|
||||
<%
|
||||
if(close){
|
||||
|
||||
@@ -60,27 +60,6 @@
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = null;
|
||||
for (INode processNode : node.getProcess().getGeneratingNodes()) {
|
||||
if(connection.equals(processNode.getUniqueName())) {
|
||||
connectionNode = processNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
String autoCommit = "true".equals(ElementParameterParser.getValue(connectionNode, "__AUTO_COMMIT__"))?"true":"false";
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
if (conn_<%=cid%> != null) {
|
||||
conn_<%=cid%>.setAutoCommit(<%=autoCommit%>);
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
this.afterUseExistConnection(node);
|
||||
} else {
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
@@ -91,7 +70,11 @@
|
||||
<%
|
||||
String alias = ElementParameterParser.getValue(node, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -17,19 +17,6 @@ if(useExistingConnection) {
|
||||
%>
|
||||
dbschema_<%=cid%> = (String)globalMap.get("<%=schema%>");
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(connectionNode, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(isEnableDatasource && specify_alias){
|
||||
String alias = ElementParameterParser.getValue(connectionNode, "__DATASOURCE_ALIAS__");
|
||||
%>
|
||||
if (null == conn_<%=cid%>) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");%>
|
||||
<%
|
||||
} else {
|
||||
@@ -39,7 +26,11 @@ if(useExistingConnection) {
|
||||
%>
|
||||
java.util.Map<String, routines.system.TalendDataSource> dataSources_<%=cid%> = (java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != dataSources_<%=cid%>) {
|
||||
conn_<%=cid %> = dataSources_<%=cid%>.get(<%=(null != alias && !("".equals(alias)))?alias:"\"\""%>).getConnection();
|
||||
String dsAlias_<%=cid%> = <%=(null != alias && !("".equals(alias)))?alias:"\"\""%>;
|
||||
if (dataSources_<%=cid%>.get(dsAlias_<%=cid%>) == null) {
|
||||
throw new RuntimeException("No DataSource with alias: " + dsAlias_<%=cid%> + " available!");
|
||||
}
|
||||
conn_<%=cid%> = dataSources_<%=cid%>.get(dsAlias_<%=cid%>).getConnection();
|
||||
} else {
|
||||
<%
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user