[resolved] Question about TOracleInput

One Star

[resolved] Question about TOracleInput

Ok my question is about the Java Code in _begin.javajet.

I want to know how the component gets back the SQL query?

coz the code is :

public void createStatement(INode node) {
super.createStatement(node);
String useCursor= ElementParameterParser.getValue(node, "__USE_CURSOR__");
String cursorSize= ElementParameterParser.getValue(node, "__CURSOR_SIZE__");
if(("true").equals(useCursor)) {
%>
stmt_<%=cid %>.setFetchSize(<%=cursorSize %>);
<%
}
}
//-----------according schema type to generate ResultSet
public void generateStringResultSet(String firstConnName, IMetadataColumn column, int currentColNo, String trimMethod) {
String columnType = column.getType();
if(columnType != null && ("CLOB").equals(columnType)) {
%>
java.io.Reader reader_<%=cid%> = rs_<%=cid %>.getCharacterStream(<%=currentColNo%>);
java.io.BufferedReader br_<%=cid%> = null;
if(reader_<%=cid%> != null) {
br_<%=cid%> = new java.io.BufferedReader(reader_<%=cid%>);
StringBuffer content_<%=cid%> = new StringBuffer();
int c_<%=cid%> =0;
while( (c_<%=cid%> = br_<%=cid%>.read()) != -1) {
content_<%=cid%>.append((char)c_<%=cid%>);
}
br_<%=cid%>.close();
<%=firstConnName%>.<%=column.getLabel()%> = content_<%=cid%>.toString();
} else {
<%=firstConnName%>.<%=column.getLabel()%> = null;
}
<%
} else {
%>
tmpContent_<%=cid%> = rs_<%=cid %>.getString(<%=currentColNo%>);
if(tmpContent_<%=cid%> != null) {
<%=firstConnName%>.<%=column.getLabel()%> = tmpContent_<%=cid%><%=trimMethod%>;
} else {
<%=firstConnName%>.<%=column.getLabel()%> = null;
}
<%
}
}

public void generateBytesResultSet(String firstConnName, IMetadataColumn column, int currentColNo) {
%>
byte [] tmpBytes_<%=cid%> = rs_<%=cid %>.getBytes(<%=currentColNo%>);
if(tmpBytes_<%=cid%> != null) {
<%=firstConnName%>.<%=column.getLabel()%> = tmpBytes_<%=cid%>;
} else {
<%=firstConnName%>.<%=column.getLabel()%> = null;
}
<%
}

the .xml parameter is :

		<PARAMETER NAME="QUERY" FIELD="MEMO_SQL" NUM_ROW="100"
REQUIRED="true">
<DEFAULT>"select id, name from employee"</DEFAULT>
</PARAMETER>

But in the javajet, there is no use of variable __QUERY__...
Community Manager

Re: [resolved] Question about TOracleInput

Hi
The class DBInputBeginUtil in oracle beginject extends DefaultDBInputUtil, the DefaultDBInputUtil is defined in file
TIS/TOS studio installation directory\plugins\org.talend.designer.components.localprovider_4.1.2.r53616\components\templates\DB\Input\HelpClass.javajet.

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Question about TOracleInput

Thanks!

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download