/** * Builds a list of all the SQL statements that this transformation needs in order to work properly. * * @return An ArrayList of SQLStatement objects. * @throws KettleStepException * if any errors occur during SQL statement generation */ public List<SQLStatement> getSQLStatements() throws KettleStepException { return getSQLStatements( null ); }
@Override public List<SQLStatement> getSQLStatements( Repository repository, IMetaStore metaStore, VariableSpace space ) throws KettleException { this.copyVariablesFrom( space ); TransMeta transMeta = getTransMeta( repository, metaStore, this ); return transMeta.getSQLStatements(); }
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException { // This is running in a new process: copy some KettleVariables info // LocalVariables.getInstance().createKettleVariables(Thread.currentThread(), parentThread, true); // --> don't set variables if not running in different thread --> pmd.run(true,true, op); try { stats = transMeta.getSQLStatements( new ProgressMonitorAdapter( monitor ) ); } catch ( KettleException e ) { throw new InvocationTargetException( e, BaseMessages.getString( PKG, "GetSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception", e.getMessage() ) ); } } };
/** * Get the SQL statements (needed to run this transformation) as a single String. * * @return the SQL statements needed to run this transformation * @throws KettleStepException * if any errors occur during SQL statement generation */ public String getSQLStatementsString() throws KettleStepException { String sql = ""; List<SQLStatement> stats = getSQLStatements(); for ( int i = 0; i < stats.size(); i++ ) { SQLStatement stat = stats.get( i ); if ( !stat.hasError() && stat.hasSQL() ) { sql += stat.getSQL(); } } return sql; }