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

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

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

Database.setCommit介绍

[英]Specify after how many rows a commit needs to occur when inserting or updating values.
[中]指定插入或更新值时需要提交的行数。

代码示例

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

  1. public synchronized void setAutoCommit( boolean autocommit ) {
  2. if ( !autocommit ) {
  3. database.setCommit( 99999999 );
  4. } else {
  5. database.setCommit( 0 );
  6. }
  7. }

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

  1. @Override
  2. public Long getNextBatchId( DatabaseMeta dbm, Database ldb,
  3. String schemaName, String tableName, String fieldName ) throws KettleDatabaseException {
  4. // Always take off autocommit.
  5. ldb.setCommit( 10 );
  6. //
  7. // Temporary work-around to handle batch-id from extended options
  8. // Eventually want this promoted to proper dialogs and such
  9. //
  10. Map<String, String> connectionExtraOptions = this.getExtraOptions();
  11. String sequenceProp = this.getPluginId() + "." + SEQUENCE_FOR_BATCH_ID;
  12. String autoIncSQLProp = this.getPluginId() + "." + AUTOINCREMENT_SQL_FOR_BATCH_ID;
  13. if ( connectionExtraOptions != null ) {
  14. if ( this.supportsSequences() && connectionExtraOptions.containsKey( sequenceProp ) ) {
  15. return getNextBatchIdUsingSequence( connectionExtraOptions.get( sequenceProp ), schemaName, dbm, ldb );
  16. } else if ( this.supportsAutoInc() && connectionExtraOptions.containsKey( autoIncSQLProp ) ) {
  17. return getNextBatchIdUsingAutoIncSQL( connectionExtraOptions.get( autoIncSQLProp ), dbm, ldb );
  18. }
  19. }
  20. return getNextBatchIdUsingLockTables( dbm, ldb, schemaName, tableName, fieldName );
  21. }

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

  1. db.shareVariablesWith( this );
  2. db.connect();
  3. db.setCommit( logCommitSize );

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

  1. ldb.shareVariablesWith( this );
  2. ldb.connect();
  3. ldb.setCommit( logCommitSize );

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

  1. private void connectDatabase( Database database ) throws KettleDatabaseException {
  2. database.shareVariablesWith( this );
  3. if ( getTransMeta().isUsingUniqueConnections() ) {
  4. synchronized ( getTrans() ) {
  5. database.connect( getTrans().getTransactionId(), getPartitionID() );
  6. }
  7. } else {
  8. database.connect( getPartitionID() );
  9. }
  10. database.setCommit( 100 ); // we never get a commit, but it just turns off auto-commit.
  11. if ( log.isDetailed() ) {
  12. logDetailed( BaseMessages.getString( PKG, "DatabaseLookup.Log.ConnectedToDatabase" ) );
  13. }
  14. }
  15. }

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

  1. /**
  2. * Writes step information to a step logging table (if one has been configured).
  3. *
  4. * @throws KettleException if any errors occur during logging
  5. */
  6. protected void writeStepLogInformation() throws KettleException {
  7. Database db = null;
  8. StepLogTable stepLogTable = getTransMeta().getStepLogTable();
  9. try {
  10. db = createDataBase( stepLogTable.getDatabaseMeta() );
  11. db.shareVariablesWith( this );
  12. db.connect();
  13. db.setCommit( logCommitSize );
  14. for ( StepMetaDataCombi combi : getSteps() ) {
  15. db.writeLogRecord( stepLogTable, LogStatus.START, combi, null );
  16. }
  17. db.cleanupLogRecords( stepLogTable );
  18. } catch ( Exception e ) {
  19. throw new KettleException( BaseMessages.getString( PKG,
  20. "Trans.Exception.UnableToWriteStepInformationToLogTable" ), e );
  21. } finally {
  22. disconnectDb( db );
  23. }
  24. }

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

  1. /**
  2. * Writes information to Job Log table. Cleans old records, in case job is finished.
  3. */
  4. protected void writeLogTableInformation( JobLogTable jobLogTable, LogStatus status ) throws KettleJobException,
  5. KettleDatabaseException {
  6. boolean cleanLogRecords = status.equals( LogStatus.END );
  7. String tableName = jobLogTable.getActualTableName();
  8. DatabaseMeta logcon = jobLogTable.getDatabaseMeta();
  9. Database ldb = createDataBase( logcon );
  10. ldb.shareVariablesWith( this );
  11. try {
  12. ldb.connect();
  13. ldb.setCommit( logCommitSize );
  14. ldb.writeLogRecord( jobLogTable, status, this, null );
  15. if ( cleanLogRecords ) {
  16. ldb.cleanupLogRecords( jobLogTable );
  17. }
  18. } catch ( KettleDatabaseException dbe ) {
  19. addErrors( 1 );
  20. throw new KettleJobException( "Unable to end processing by writing log record to table " + tableName, dbe );
  21. } finally {
  22. if ( !ldb.isAutoCommit() ) {
  23. ldb.commitLog( true, jobLogTable );
  24. }
  25. ldb.disconnect();
  26. }
  27. }

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

  1. /**
  2. * Write job entry log information.
  3. *
  4. * @throws KettleException
  5. * the kettle exception
  6. */
  7. protected void writeJobEntryLogInformation() throws KettleException {
  8. Database db = null;
  9. JobEntryLogTable jobEntryLogTable = getJobMeta().getJobEntryLogTable();
  10. try {
  11. db = createDataBase( jobEntryLogTable.getDatabaseMeta() );
  12. db.shareVariablesWith( this );
  13. db.connect();
  14. db.setCommit( logCommitSize );
  15. for ( JobEntryCopy copy : getJobMeta().getJobCopies() ) {
  16. db.writeLogRecord( jobEntryLogTable, LogStatus.START, copy, this );
  17. }
  18. db.cleanupLogRecords( jobEntryLogTable );
  19. } catch ( Exception e ) {
  20. throw new KettleException( BaseMessages.getString( PKG, "Job.Exception.UnableToJobEntryInformationToLogTable" ),
  21. e );
  22. } finally {
  23. if ( !db.isAutoCommit() ) {
  24. db.commitLog( true, jobEntryLogTable );
  25. }
  26. db.disconnect();
  27. }
  28. }

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

  1. logDetailed( BaseMessages.getString( PKG, "CombinationLookup.Log.ConnectedToDB" ) );
  2. data.db.setCommit( meta.getCommitSize() );

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

  1. logDetailed( BaseMessages.getString( PKG, "DBProc.Log.AutoCommit" ) );
  2. data.db.setCommit( 9999 );

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

  1. db.shareVariablesWith( this );
  2. db.connect();
  3. db.setCommit( logCommitSize );

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

  1. public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
  2. meta = (InsertUpdateMeta) smi;
  3. data = (InsertUpdateData) sdi;
  4. if ( super.init( smi, sdi ) ) {
  5. try {
  6. if ( meta.getDatabaseMeta() == null ) {
  7. logError( BaseMessages.getString( PKG, "InsertUpdate.Init.ConnectionMissing", getStepname() ) );
  8. return false;
  9. }
  10. data.db = new Database( this, meta.getDatabaseMeta() );
  11. data.db.shareVariablesWith( this );
  12. if ( getTransMeta().isUsingUniqueConnections() ) {
  13. synchronized ( getTrans() ) {
  14. data.db.connect( getTrans().getTransactionId(), getPartitionID() );
  15. }
  16. } else {
  17. data.db.connect( getPartitionID() );
  18. }
  19. data.db.setCommit( meta.getCommitSize( this ) );
  20. return true;
  21. } catch ( KettleException ke ) {
  22. logError( BaseMessages.getString( PKG, "InsertUpdate.Log.ErrorOccurredDuringStepInitialize" )
  23. + ke.getMessage() );
  24. }
  25. }
  26. return false;
  27. }

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

  1. db.shareVariablesWith( this );
  2. db.connect();
  3. db.setCommit( logCommitSize );

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

  1. data.db.setCommit( 100 ); // we never get a commit, but it just turns off auto-commit.

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

  1. data.db.setCommit( meta.getCommitSize( this ) );

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

  1. data.db.setCommit( meta.getCommitSize( this ) );

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

  1. data.db.setCommit( 100 ); // needed for PGSQL it seems...

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

  1. data.db.setCommit( meta.getCommitSize() );

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

  1. data.db.connect( getPartitionID() );
  2. data.db.setCommit( data.commitSize );

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

  1. logDetailed( BaseMessages.getString( PKG, "DimensionLookup.Log.ConnectedToDB" ) );
  2. data.db.setCommit( meta.getCommitSize() );

相关文章