当前位置: 首页>>代码示例>>Java>>正文


Java Result.setNrLinesDeleted方法代码示例

本文整理汇总了Java中org.pentaho.di.core.Result.setNrLinesDeleted方法的典型用法代码示例。如果您正苦于以下问题:Java Result.setNrLinesDeleted方法的具体用法?Java Result.setNrLinesDeleted怎么用?Java Result.setNrLinesDeleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.Result的用法示例。


在下文中一共展示了Result.setNrLinesDeleted方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execStatement

import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execStatement(String sql, RowMetaInterface params, Object[] data) throws KettleDatabaseException
{
       Result result = new Result();
	try
	{
           boolean resultSet;
           int count;
		if (params!=null)
		{
			PreparedStatement prep_stmt = connection.prepareStatement(databaseMeta.stripCR(sql));
			setValues(params, data, prep_stmt); // set the parameters!
			resultSet = prep_stmt.execute();
               count = prep_stmt.getUpdateCount();
			prep_stmt.close();
		}
		else
		{
               String sqlStripped = databaseMeta.stripCR(sql);
               // log.logDetailed(toString(), "Executing SQL Statement: ["+sqlStripped+"]");
			Statement stmt = connection.createStatement();
               resultSet = stmt.execute(sqlStripped);
               count = stmt.getUpdateCount();
			stmt.close();
		}
           if (resultSet)
           {
               // the result is a resultset, but we don't do anything with it!
               // You should have called something else!
               // log.logDetailed(toString(), "What to do with ResultSet??? (count="+count+")");
           }
           else
           {
               if (count > 0)
               {
                   if (sql.toUpperCase().startsWith("INSERT")) result.setNrLinesOutput(count);
                   if (sql.toUpperCase().startsWith("UPDATE")) result.setNrLinesUpdated(count);
                   if (sql.toUpperCase().startsWith("DELETE")) result.setNrLinesDeleted(count);
               }
           }
           
           // See if a cache needs to be cleared...
           if (sql.toUpperCase().startsWith("ALTER TABLE") || 
               sql.toUpperCase().startsWith("DROP TABLE") ||
               sql.toUpperCase().startsWith("CREATE TABLE")
               )
           {
               DBCache.getInstance().clear(databaseMeta.getName());
           }
	}
	catch(SQLException ex)
	{
		throw new KettleDatabaseException("Couldn't execute SQL: "+sql+Const.CR, ex);
	}
	catch(Exception e)
	{
		throw new KettleDatabaseException("Unexpected error executing SQL: "+Const.CR, e);
	}
       
       return result;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:61,代码来源:Database.java

示例2: execute

import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execute(Result result, int nr, Repository rep, Job parentJob) throws KettleException {
   LogWriter log = LogWriter.getInstance();

   List<RowMetaAndData> rows = result.getRows();
   RowMetaAndData resultRow = null;

   result.setNrErrors(1);
   result.setResult(false);
   
NrErrors=0;
NrSuccess=0;
successConditionBroken=false;
successConditionBrokenExit=false;
limitFolders=Const.toInt(environmentSubstitute(getLimitFolders()),10);


   if (argFromPrevious) {
     if(log.isDetailed())	
   	  log.logDetailed(toString(), Messages.getString("JobEntryDeleteFolders.FoundPreviousRows", String.valueOf((rows != null ? rows.size() : 0)))); //$NON-NLS-1$
   }

   if (argFromPrevious && rows != null){
     for (int iteration = 0; iteration < rows.size() && !parentJob.isStopped(); iteration++) {
	if(successConditionBroken){
		log.logError(toString(), Messages.getString("JobEntryDeleteFolders.Error.SuccessConditionbroken",""+NrErrors));
		result.setNrErrors(NrErrors);
		result.setNrLinesDeleted(NrSuccess);
		return result;
	}
   	resultRow = rows.get(iteration);
       String args_previous = resultRow.getString(0, null);
       if(!Const.isEmpty(args_previous)){
        if(deleteFolder(args_previous)){
        	updateSuccess();
        }else {
        	updateErrors();	
        }
       }else{
       	// empty filename !
       	log.logError(toString(), Messages.getString("JobEntryDeleteFolders.Error.EmptyLine"));
       }
     }
   } else if (arguments != null) {
     for (int i = 0; i < arguments.length && !parentJob.isStopped(); i++) {
 		if(successConditionBroken)
	{
		log.logError(toString(), Messages.getString("JobEntryDeleteFolders.Error.SuccessConditionbroken",""+NrErrors));
		result.setNrErrors(NrErrors);
		result.setNrLinesDeleted(NrSuccess);
		return result;
	}
 		String realfilename=environmentSubstitute(arguments[i]);
    if(!Const.isEmpty(realfilename))
    {
   	  if(deleteFolder(realfilename)){
         	updateSuccess();
         }else {
       	  updateErrors();
         }  
    }else{
        // empty filename !
        log.logError(toString(), Messages.getString("JobEntryDeleteFolders.Error.EmptyLine"));
   }
     }
   }
  
if(log.isDetailed()){
	log.logDetailed(toString(), "=======================================");
	log.logDetailed(toString(), Messages.getString("JobEntryDeleteFolders.Log.Info.NrError","" + NrErrors));
	log.logDetailed(toString(), Messages.getString("JobEntryDeleteFolders.Log.Info.NrDeletedFolders","" + NrSuccess));
	log.logDetailed(toString(), "=======================================");
}
   
result.setNrErrors(NrErrors);
result.setNrLinesDeleted(NrSuccess);
if(getSuccessStatus())	result.setResult(true);

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

示例3: execute

import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execute(Result result, int nr) throws KettleException {
   List<RowMetaAndData> rows = result.getRows();
   RowMetaAndData resultRow = null;

   result.setNrErrors(1);
   result.setResult(false);
   
NrErrors=0;
NrSuccess=0;
successConditionBroken=false;
successConditionBrokenExit=false;
limitFolders=Const.toInt(environmentSubstitute(getLimitFolders()),10);


   if (argFromPrevious) {
     if(log.isDetailed())	
   	  logDetailed(BaseMessages.getString(PKG, "JobEntryDeleteFolders.FoundPreviousRows", String.valueOf((rows != null ? rows.size() : 0)))); //$NON-NLS-1$
   }

   if (argFromPrevious && rows != null){
     for (int iteration = 0; iteration < rows.size() && !parentJob.isStopped(); iteration++) {
	if(successConditionBroken){
		logError(BaseMessages.getString(PKG, "JobEntryDeleteFolders.Error.SuccessConditionbroken",""+NrErrors));
		result.setNrErrors(NrErrors);
		result.setNrLinesDeleted(NrSuccess);
		return result;
	}
   	resultRow = rows.get(iteration);
       String args_previous = resultRow.getString(0, null);
       if(!Const.isEmpty(args_previous)){
        if(deleteFolder(args_previous)){
        	updateSuccess();
        }else {
        	updateErrors();	
        }
       }else{
       	// empty filename !
       	logError(BaseMessages.getString(PKG, "JobEntryDeleteFolders.Error.EmptyLine"));
       }
     }
   } else if (arguments != null) {
     for (int i = 0; i < arguments.length && !parentJob.isStopped(); i++) {
 		if(successConditionBroken)
	{
		logError(BaseMessages.getString(PKG, "JobEntryDeleteFolders.Error.SuccessConditionbroken",""+NrErrors));
		result.setNrErrors(NrErrors);
		result.setNrLinesDeleted(NrSuccess);
		return result;
	}
 		String realfilename=environmentSubstitute(arguments[i]);
    if(!Const.isEmpty(realfilename))
    {
   	  if(deleteFolder(realfilename)){
         	updateSuccess();
         }else {
       	  updateErrors();
         }  
    }else{
        // empty filename !
        logError(BaseMessages.getString(PKG, "JobEntryDeleteFolders.Error.EmptyLine"));
   }
     }
   }
  
if(log.isDetailed()){
	logDetailed("=======================================");
	logDetailed(BaseMessages.getString(PKG, "JobEntryDeleteFolders.Log.Info.NrError","" + NrErrors));
	logDetailed(BaseMessages.getString(PKG, "JobEntryDeleteFolders.Log.Info.NrDeletedFolders","" + NrSuccess));
	logDetailed("=======================================");
}
   
result.setNrErrors(NrErrors);
result.setNrLinesDeleted(NrSuccess);
if(getSuccessStatus())	result.setResult(true);

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

示例4: execStatement

import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execStatement(String sql, RowMetaInterface params, Object[] data) throws KettleDatabaseException
{
       Result result = new Result();
	try
	{
           boolean resultSet;
           int count;
		if (params!=null)
		{
			PreparedStatement prep_stmt = connection.prepareStatement(databaseMeta.stripCR(sql));
			setValues(params, data, prep_stmt); // set the parameters!
			resultSet = prep_stmt.execute();
               count = prep_stmt.getUpdateCount();
			prep_stmt.close();
		}
		else
		{
               String sqlStripped = databaseMeta.stripCR(sql);
               // log.logDetailed("Executing SQL Statement: ["+sqlStripped+"]");
			Statement stmt = connection.createStatement();
               resultSet = stmt.execute(sqlStripped);
               count = stmt.getUpdateCount();
			stmt.close();
		}
     String upperSql = sql.toUpperCase();
           if (resultSet)
           {
               // the result is a resultset, but we don't do anything with it!
               // You should have called something else!
               // log.logDetailed("What to do with ResultSet??? (count="+count+")");
           }
           else
           {
               if (count > 0)
               {
                   if (upperSql.startsWith("INSERT")) result.setNrLinesOutput(count);
                   else if (upperSql.startsWith("UPDATE")) result.setNrLinesUpdated(count);
                   else if (upperSql.startsWith("DELETE")) result.setNrLinesDeleted(count);
               }
           }
           
           // See if a cache needs to be cleared...
           if (upperSql.startsWith("ALTER TABLE") || 
               upperSql.startsWith("DROP TABLE") ||
               upperSql.startsWith("CREATE TABLE")
               )
           {
               DBCache.getInstance().clear(databaseMeta.getName());
           }
	}
	catch(SQLException ex)
	{
		throw new KettleDatabaseException("Couldn't execute SQL: "+sql+Const.CR, ex);
	}
	catch(Exception e)
	{
		throw new KettleDatabaseException("Unexpected error executing SQL: "+Const.CR, e);
	}
       
       return result;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:62,代码来源:Database.java


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