org.pentaho.di.core.database.Database.truncateTable()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中org.pentaho.di.core.database.Database.truncateTable()方法的一些代码示例,展示了Database.truncateTable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Database.truncateTable()方法的具体详情如下:
包路径:org.pentaho.di.core.database.Database
类名称:Database
方法名:truncateTable

Database.truncateTable介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testTruncateTable_off() throws Exception {
 tableOutputSpy.truncateTable();
 verify( db, never() ).truncateTable( anyString(), anyString() );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testTruncateTable_on() throws Exception {
 when( tableOutputMeta.truncateTable() ).thenReturn( true );
 when( tableOutputSpy.getCopy() ).thenReturn( 0 );
 when( tableOutputSpy.getUniqueStepNrAcrossSlaves() ).thenReturn( 0 );
 tableOutputSpy.truncateTable();
 verify( db ).truncateTable( anyString(), anyString() );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testTruncateTable_on_PartitionId() throws Exception {
 when( tableOutputMeta.truncateTable() ).thenReturn( true );
 when( tableOutputSpy.getCopy() ).thenReturn( 1 );
 when( tableOutputSpy.getUniqueStepNrAcrossSlaves() ).thenReturn( 0 );
 when( tableOutputSpy.getPartitionID() ).thenReturn( "partition id" );
 tableOutputSpy.truncateTable();
 verify( db ).truncateTable( anyString(), anyString() );
}

代码示例来源:origin: pentaho/pentaho-kettle

private boolean truncateTables( String tablename, String schemaname, Database db ) {
 boolean retval = false;
 try {
  // check if table exists!
  if ( db.checkTableExists( schemaname, tablename ) ) {
   if ( !Utils.isEmpty( schemaname ) ) {
    db.truncateTable( schemaname, tablename );
   } else {
    db.truncateTable( tablename );
   }
   if ( log.isDetailed() ) {
    logDetailed( BaseMessages.getString( PKG, "JobEntryTruncateTables.Log.TableTruncated", tablename ) );
   }
   retval = true;
  } else {
   logError( BaseMessages.getString( PKG, "JobEntryTruncateTables.Error.CanNotFindTable", tablename ) );
  }
 } catch ( Exception e ) {
  logError( BaseMessages.getString( PKG, "JobEntryTruncateTables.Error.CanNotTruncateTables", tablename, e
   .toString() ) );
 }
 return retval;
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public boolean truncateTable() {
 TableOutputMeta meta = getMeta();
 TableOutputData data = getData();
 try {
  data.db.truncateTable( environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta
   .getTableName() ) );
  util.updateMetadata( meta, -1 );
  return true;
 } catch ( KettleDatabaseException e ) {
  message = "Could not truncate table: " + meta.getTableName();
  logError( message, e );
 }
 return false;
}

代码示例来源:origin: pentaho/pentaho-kettle

void truncateTable() throws KettleDatabaseException {
 if ( !meta.isPartitioningEnabled() && !meta.isTableNameInField() ) {
  // Only the first one truncates in a non-partitioned step copy
  //
  if ( meta.truncateTable()
   && ( ( getCopy() == 0 && getUniqueStepNrAcrossSlaves() == 0 ) || !Utils.isEmpty( getPartitionID() ) ) ) {
   data.db.truncateTable( environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta
    .getTableName() ) );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Execute fastload.
 *
 * @throws KettleException
 *           ...
 */
public void execute() throws KettleException {
 if ( this.meta.getTruncateTable().getValue() ) {
  Database db = new Database( this, this.meta.getDbMeta() );
  db.connect();
  db.truncateTable( this.meta.getTargetTable().getValue() );
  db.commit();
  db.disconnect();
 }
 startFastLoad();
 if ( this.meta.getUseControlFile().getValue() ) {
  this.invokeLoadingControlFile();
 } else {
  this.invokeLoadingCommand();
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

try {
 database.connect();
 database.truncateTable( schemaTable );
} catch ( Exception e ) {
 new ErrorDialog( jobGraph.getShell(),

代码示例来源:origin: pentaho/pentaho-kettle

try {
 database.connect();
 database.truncateTable( schemaTable );
} catch ( Exception e ) {
 new ErrorDialog( transGraph.getShell(),

相关文章

微信公众号

最新文章

更多