• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SQLStatement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.di.core.SQLStatement的典型用法代码示例。如果您正苦于以下问题:Java SQLStatement类的具体用法?Java SQLStatement怎么用?Java SQLStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SQLStatement类属于org.pentaho.di.core包,在下文中一共展示了SQLStatement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSQLStatementsString

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
/**
 * Get the SQL statements, needed to run this transformation, as one String.
 *
 * @return the SQL statements needed to run this transformation.
 */
public String getSQLStatementsString() throws KettleStepException
{
    String sql = ""; //$NON-NLS-1$
    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;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:21,代码来源:TransMeta.java


示例2: getJobSQL

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
/**
 * Get & show the SQL required to run the loaded job entry...
 * 
 */
public void getJobSQL(JobMeta jobMeta)
{
	GetJobSQLProgressDialog pspd = new GetJobSQLProgressDialog(spoon.getShell(), jobMeta, spoon
			.getRepository());
	List<SQLStatement> stats = pspd.open();
	if (stats != null) // null means error, but we already displayed the
	// error
	{
		if (stats.size() > 0)
		{
			SQLStatementsDialog ssd = new SQLStatementsDialog(spoon.getShell(), (VariableSpace) jobMeta,
					SWT.NONE, stats);
			ssd.open();
		} else
		{
			MessageBox mb = new MessageBox(spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION);
			mb.setMessage(Messages.getString("Spoon.Dialog.JobNoSQLNeedEexecuted.Message")); //$NON-NLS-1$
			mb.setText(Messages.getString("Spoon.Dialog.JobNoSQLNeedEexecuted.Title")); //$NON-NLS-1$
			mb.open();
		}
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:27,代码来源:SpoonDBDelegate.java


示例3: getData

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
/**
 * Copy information from the meta-data input to the dialog fields.
 */ 
public void getData()
{
	for (int i=0;i<stats.size();i++)
	{
		SQLStatement stat = (SQLStatement)stats.get(i);
		TableItem ti = wFields.table.getItem(i); 

		String name         = stat.getStepname();
		DatabaseMeta dbinfo = stat.getDatabase();
		String sql          = stat.getSQL();
		String error        = stat.getError();
		
		if (name!=null)   ti.setText(1, name);
		if (dbinfo!=null) ti.setText(2, dbinfo.getName() );
		if (sql!=null)    ti.setText(3, sql);
		if (error!=null)  ti.setText(4, error);

		Color col = ti.getBackground();
		if (stat.hasError()) col=red;
		ti.setBackground(col);
	}
	wFields.setRowNums();
	wFields.optWidth(true);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:28,代码来源:SQLStatementsDialog.java


示例4: getJobSQL

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
/**
 * Get & show the SQL required to run the loaded job entry...
 * 
 */
public void getJobSQL(JobMeta jobMeta)
{
	GetJobSQLProgressDialog pspd = new GetJobSQLProgressDialog(spoon.getShell(), jobMeta, spoon
			.getRepository());
	List<SQLStatement> stats = pspd.open();
	if (stats != null) // null means error, but we already displayed the
	// error
	{
		if (stats.size() > 0)
		{
			SQLStatementsDialog ssd = new SQLStatementsDialog(spoon.getShell(), (VariableSpace) jobMeta,
					SWT.NONE, stats);
			ssd.open();
		} else
		{
			MessageBox mb = new MessageBox(spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION);
			mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.JobNoSQLNeedEexecuted.Message")); //$NON-NLS-1$
			mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.JobNoSQLNeedEexecuted.Title")); //$NON-NLS-1$
			mb.open();
		}
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:27,代码来源:SpoonDBDelegate.java


示例5: getSQLStatementsString

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
/**
 * 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 = ""; //$NON-NLS-1$
    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;
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:22,代码来源:TransMeta.java


示例6: autoAdjustSchema

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public void autoAdjustSchema( MonetDBBulkLoaderMeta meta )  throws KettleException {
	
		   if (log.isDetailed()) logDetailed("Attempting to auto adjust table structure" );

   drop();

	   if (log.isDetailed()) logDetailed("getTransMeta: "+getTransMeta() );
  		   if (log.isDetailed()) logDetailed("getStepname: "+getStepname() );
  		   SQLStatement statement = meta.getTableDdl(getTransMeta(), getStepname(), true, data, true);
  		   if (log.isDetailed()) logDetailed("Statement: "+statement );
 		   if (log.isDetailed() && statement != null) logDetailed("Statement has SQL: "+statement.hasSQL() );
   		
 		   if(statement != null && statement.hasSQL()) {
   			String cmd = statement.getSQL();
    		  try {
           executeSql(cmd);
         } catch (Exception e) {
           throw new KettleException("Error while creating table " + data.schemaTable, e);
    	    }
    	 }

	if (log.isDetailed()) logDetailed("Successfull");
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:24,代码来源:MonetDBBulkLoader.java


示例7: getTransSQL

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
/**
 * Get & show the SQL required to run the loaded transformation...
 *
 */
public void getTransSQL( TransMeta transMeta ) {
  GetSQLProgressDialog pspd = new GetSQLProgressDialog( spoon.getShell(), transMeta );
  List<SQLStatement> stats = pspd.open();
  if ( stats != null ) {
    // null means error, but we already displayed the error

    if ( stats.size() > 0 ) {
      SQLStatementsDialog ssd =
        new SQLStatementsDialog( spoon.getShell(), Variables.getADefaultVariableSpace(), SWT.NONE, stats );
      String sn = ssd.open();

      if ( sn != null ) {
        StepMeta esi = transMeta.findStep( sn );
        if ( esi != null ) {
          spoon.delegates.steps.editStep( transMeta, esi );
        }
      }
    } else {
      MessageBox mb = new MessageBox( spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION );
      mb.setMessage( BaseMessages.getString( PKG, "Spoon.Dialog.NoSQLNeedEexecuted.Message" ) );
      mb.setText( BaseMessages.getString( PKG, "Spoon.Dialog.NoSQLNeedEexecuted.Title" ) ); // "SQL"
      mb.open();
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:30,代码来源:SpoonDBDelegate.java


示例8: getSQLStatements

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public List<SQLStatement> getSQLStatements(Repository repository, VariableSpace space) throws KettleException
{
	this.copyVariablesFrom(space);
    TransMeta transMeta = getTransMeta(repository);

    return transMeta.getSQLStatements();
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:8,代码来源:JobEntryTrans.java


示例9: getSQLStatements

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
	SQLStatement retval = new SQLStatement(stepMeta.getName(), database, null); // default: nothing to do!

	if (useDatabase) // Otherwise, don't bother!
	{
		if (database!=null)
		{
			Database db = new Database(database);
			db.shareVariablesWith(transMeta);
			try
			{
				db.connect();
				if (!db.checkSequenceExists(schemaName, sequenceName))
				{
					String cr_table = db.getCreateSequenceStatement(sequenceName, startAt, incrementBy, maxValue, true);
					retval.setSQL(cr_table);
				}
				else
				{
					retval.setSQL(null); // Empty string means: nothing to do: set it to null...
				}
			}
			catch(KettleException e)
			{
				retval.setError(Messages.getString("AddSequenceMeta.ErrorMessage.UnableToConnectDB")+Const.CR+e.getMessage()); //$NON-NLS-1$
			}
			finally
			{
				db.disconnect();
			}
		}
		else
		{
			retval.setError(Messages.getString("AddSequenceMeta.ErrorMessage.NoConnectionDefined")); //$NON-NLS-1$
		}
	}

	return retval;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:41,代码来源:AddSequenceMeta.java


示例10: getTransSQL

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
/**
 * Get & show the SQL required to run the loaded transformation...
 * 
 */
public void getTransSQL(TransMeta transMeta)
{
	GetSQLProgressDialog pspd = new GetSQLProgressDialog(spoon.getShell(), transMeta);
	List<SQLStatement> stats = pspd.open();
	if (stats != null) // null means error, but we already displayed the
	// error
	{
		if (stats.size() > 0)
		{
			SQLStatementsDialog ssd = new SQLStatementsDialog(spoon.getShell(), Variables
					.getADefaultVariableSpace(), SWT.NONE, stats);
			String sn = ssd.open();

            if (sn != null)
            {
                StepMeta esi = transMeta.findStep(sn);
                if (esi != null)
                {
                    spoon.delegates.steps.editStep(transMeta,esi);
                }
            }
		} else
		{
			MessageBox mb = new MessageBox(spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION);
			mb.setMessage(Messages.getString("Spoon.Dialog.NoSQLNeedEexecuted.Message"));
			mb.setText(Messages.getString("Spoon.Dialog.NoSQLNeedEexecuted.Title"));// "SQL"
			mb.open();
		}
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:35,代码来源:SpoonDBDelegate.java


示例11: SQLStatementsDialog

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public SQLStatementsDialog(Shell parent, VariableSpace space, int style, List<SQLStatement> stats)
{
        super(parent, style);
        this.stats=stats;
        this.props=PropsUI.getInstance();
        this.variables = space;
        
        this.stepname = null;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:10,代码来源:SQLStatementsDialog.java


示例12: getSQL

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
private String getSQL()
{
	StringBuffer sql = new StringBuffer();
	
	int idx[] = wFields.table.getSelectionIndices();
	
	// None selected: don't waste users time: select them all!
	if (idx.length==0) 
	{
		idx=new int[stats.size()];
		for (int i=0;i<stats.size();i++) idx[i]=i;
	}
	
	for (int i=0;i<idx.length;i++)
	{
		SQLStatement stat = (SQLStatement)stats.get(idx[i]);
		DatabaseMeta di = stat.getDatabase();
		if (i > 0)
		    sql.append("-------------------------------------------------------------------------------------------").append(Const.CR);
		sql.append(Messages.getString("SQLStatementDialog.Log.Step", stat.getStepname()));
		sql.append(Messages.getString("SQLStatementDialog.Log.Connection", (di != null ? di.getName() : Messages.getString("SQLStatementDialog.Log.Undefined"))));
		if (stat.hasSQL())
		{
			sql.append("-- SQL                  : ");
			sql.append(stat.getSQL()).append(Const.CR);
		}
		if (stat.hasError())
		{
			sql.append(Messages.getString("SQLStatementDialog.Log.Error", stat.getError()));
		}
	}

	return sql.toString();
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:35,代码来源:SQLStatementsDialog.java


示例13: getSQLStatements

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public List<SQLStatement> getSQLStatements(Repository repository, VariableSpace space) throws KettleException
{
	this.copyVariablesFrom(space);
    TransMeta transMeta = getTransMeta(repository, this);

    return transMeta.getSQLStatements();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:8,代码来源:JobEntryTrans.java


示例14: getSQLStatements

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
	SQLStatement retval = new SQLStatement(stepMeta.getName(), database, null); // default: nothing to do!

	if (useDatabase) // Otherwise, don't bother!
	{
		if (database!=null)
		{
			Database db = new Database(loggingObject, database);
			db.shareVariablesWith(transMeta);
			try
			{
				db.connect();
				if (!db.checkSequenceExists(schemaName, sequenceName))
				{
					String cr_table = db.getCreateSequenceStatement(sequenceName, startAt, incrementBy, maxValue, true);
					retval.setSQL(cr_table);
				}
				else
				{
					retval.setSQL(null); // Empty string means: nothing to do: set it to null...
				}
			}
			catch(KettleException e)
			{
				retval.setError(BaseMessages.getString(PKG, "AddSequenceMeta.ErrorMessage.UnableToConnectDB")+Const.CR+e.getMessage()); //$NON-NLS-1$
			}
			finally
			{
				db.disconnect();
			}
		}
		else
		{
			retval.setError(BaseMessages.getString(PKG, "AddSequenceMeta.ErrorMessage.NoConnectionDefined")); //$NON-NLS-1$
		}
	}

	return retval;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:41,代码来源:AddSequenceMeta.java


示例15: autoAdjustSchema

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public void autoAdjustSchema( Runtime rt, String mClientCmd )  throws KettleException {
	
   	try {
		   if (log.isDetailed()) logDetailed("Attempting to auto adjust table structure" );
		
	   Process p = rt.exec(mClientCmd);
	   OutputStream stdIn = p.getOutputStream();
		  	
	   if (log.isDetailed()) logDetailed("getTransMeta: "+getTransMeta() );
  		   if (log.isDetailed()) logDetailed("getStepname: "+getStepname() );
  		   SQLStatement statement = meta.getTableDdl(getTransMeta(), getStepname(), true, data);
  		   if (log.isDetailed()) logDetailed("Statement: "+statement );
 		   if (log.isDetailed() && statement != null) logDetailed("Statement has SQL: "+statement.hasSQL() );
   		
 		   if(statement != null && statement.hasSQL()) {
   			String cmd = statement.getSQL();
    		  	if (log.isDetailed()) logDetailed("Trying: "+cmd);
    		  	stdIn.write(cmd.getBytes());
    		  	if (log.isDetailed()) logDetailed("Successfull: "+cmd);
   		}	    	
		  	 		   
		   stdIn.flush();
		   stdIn.close();
		    // wait for the process to finish and check for any error...

		   int exitVal = p.waitFor();
		   logBasic(BaseMessages.getString(PKG, "MonetDBBulkLoader.Log.ExitValuePsqlPath", "" + exitVal)); //$NON-NLS-1$
	
    	}
    	catch(Exception e) {
    		throw new KettleException("An error occurred writing data to the mclient process", e);
    	}		
    	
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:35,代码来源:MonetDBBulkLoader.java


示例16: getTableDdl

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public SQLStatement getTableDdl( TransMeta transMeta, String stepname, boolean autoSchema, MonetDBBulkLoaderData data ) throws KettleException
{

		String name = stepname; // new name might not yet be linked to other steps!
		StepMeta stepMeta = new StepMeta(BaseMessages.getString(PKG, "MonetDBBulkLoaderDialog.StepMeta.Title"), name, this); //$NON-NLS-1$
		RowMetaInterface prev = transMeta.getPrevStepFields(stepname);

		SQLStatement sql = getSQLStatements(transMeta, stepMeta, prev, autoSchema, data);
		return sql;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:MonetDBBulkLoaderMeta.java


示例17: getTransSQL

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
/**
 * Get & show the SQL required to run the loaded transformation...
 * 
 */
public void getTransSQL(TransMeta transMeta)
{
	GetSQLProgressDialog pspd = new GetSQLProgressDialog(spoon.getShell(), transMeta);
	List<SQLStatement> stats = pspd.open();
	if (stats != null) // null means error, but we already displayed the
	// error
	{
		if (stats.size() > 0)
		{
			SQLStatementsDialog ssd = new SQLStatementsDialog(spoon.getShell(), Variables
					.getADefaultVariableSpace(), SWT.NONE, stats);
			String sn = ssd.open();

            if (sn != null)
            {
                StepMeta esi = transMeta.findStep(sn);
                if (esi != null)
                {
                    spoon.delegates.steps.editStep(transMeta,esi);
                }
            }
		} else
		{
			MessageBox mb = new MessageBox(spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION);
			mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.NoSQLNeedEexecuted.Message"));
			mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.NoSQLNeedEexecuted.Title"));// "SQL"
			mb.open();
		}
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:35,代码来源:SpoonDBDelegate.java


示例18: getSQL

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
private String getSQL()
{
	StringBuffer sql = new StringBuffer();
	
	int idx[] = wFields.table.getSelectionIndices();
	
	// None selected: don't waste users time: select them all!
	if (idx.length==0) 
	{
		idx=new int[stats.size()];
		for (int i=0;i<stats.size();i++) idx[i]=i;
	}
	
	for (int i=0;i<idx.length;i++)
	{
		SQLStatement stat = (SQLStatement)stats.get(idx[i]);
		DatabaseMeta di = stat.getDatabase();
		if (i > 0)
		    sql.append("-------------------------------------------------------------------------------------------").append(Const.CR);
		sql.append(BaseMessages.getString(PKG, "SQLStatementDialog.Log.Step", stat.getStepname()));
		sql.append(BaseMessages.getString(PKG, "SQLStatementDialog.Log.Connection", (di != null ? di.getName() : BaseMessages.getString(PKG, "SQLStatementDialog.Log.Undefined"))));
		if (stat.hasSQL())
		{
			sql.append("-- SQL                  : ");
			sql.append(stat.getSQL()).append(Const.CR);
		}
		if (stat.hasError())
		{
			sql.append(BaseMessages.getString(PKG, "SQLStatementDialog.Log.Error", stat.getError()));
		}
	}

	return sql.toString();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:35,代码来源:SQLStatementsDialog.java


示例19: SQLStatementsDialog

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public SQLStatementsDialog( Shell parent, VariableSpace space, int style, List<SQLStatement> stats ) {
  super( parent, style );
  this.stats = stats;
  this.props = PropsUI.getInstance();
  this.variables = space;

  this.stepname = null;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:9,代码来源:SQLStatementsDialog.java


示例20: getTableDdl

import org.pentaho.di.core.SQLStatement; //导入依赖的package包/类
public SQLStatement getTableDdl( TransMeta transMeta, String stepname, boolean autoSchema, MonetDBBulkLoaderData data, boolean safeMode ) throws KettleException
{

		String name = stepname; // new name might not yet be linked to other steps!
		StepMeta stepMeta = new StepMeta(BaseMessages.getString(PKG, "MonetDBBulkLoaderDialog.StepMeta.Title"), name, this); //$NON-NLS-1$
		RowMetaInterface prev = transMeta.getPrevStepFields(stepname);

		SQLStatement sql = getSQLStatements(transMeta, stepMeta, prev, autoSchema, data, safeMode);
		return sql;
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:11,代码来源:MonetDBBulkLoaderMeta.java



注:本文中的org.pentaho.di.core.SQLStatement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ElGamalParameter类代码示例发布时间:2022-05-23
下一篇:
Java ApplicationConfigurationType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap