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

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

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

Database.commit介绍

[英]Perform a commit the connection if this is supported by the database
[中]如果数据库支持,请执行提交连接

代码示例

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

  1. private void disconnectDb( Database db ) throws KettleDatabaseException {
  2. if ( db == null ) {
  3. return;
  4. }
  5. if ( !db.isAutoCommit() ) {
  6. db.commit( true );
  7. }
  8. db.disconnect();
  9. }

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

  1. /**
  2. * A MySQL InnoDB hack really... Doesn't like a lock in case there's been a read in another session. It considers it
  3. * an open transaction.
  4. *
  5. * @throws KettleDatabaseException
  6. */
  7. public void closeReadTransaction() throws KettleDatabaseException {
  8. if ( databaseMeta.isMySQLVariant() && !database.isAutoCommit() ) {
  9. database.commit();
  10. }
  11. }

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

  1. commit();
  2. } else {
  3. commit();

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

  1. commit();
  2. ps.clearBatch();
  3. } else {
  4. commit();

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

  1. debug = "insertRow executeBatch commit";
  2. ps.executeBatch();
  3. commit();
  4. ps.clearBatch();
  5. } else {
  6. debug = "insertRow normal commit";
  7. commit();

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

  1. public synchronized void commit() throws KettleException {
  2. try {
  3. closeJobAttributeInsertPreparedStatement();
  4. closeStepAttributeInsertPreparedStatement();
  5. closeTransAttributeInsertPreparedStatement();
  6. if ( !database.isAutoCommit() ) {
  7. database.commit();
  8. }
  9. // Also, clear the counters, reducing the risk of collisions!
  10. //
  11. Counters.getInstance().clear();
  12. } catch ( KettleException dbe ) {
  13. throw new KettleException( "Unable to commit repository connection", dbe );
  14. }
  15. }

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

  1. public void dispose( StepMetaInterface smi, StepDataInterface sdi ) {
  2. meta = (CombinationLookupMeta) smi;
  3. data = (CombinationLookupData) sdi;
  4. if ( data.db != null ) {
  5. try {
  6. if ( !data.db.isAutoCommit() ) {
  7. if ( getErrors() == 0 ) {
  8. data.db.commit();
  9. } else {
  10. data.db.rollback();
  11. }
  12. }
  13. } catch ( KettleDatabaseException e ) {
  14. logError( BaseMessages.getString( PKG, "CombinationLookup.Log.UnexpectedError" ) + " : " + e.toString() );
  15. } finally {
  16. data.db.disconnect();
  17. }
  18. }
  19. super.dispose( smi, sdi );
  20. }

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

  1. @Override
  2. public void dispose( StepMetaInterface smi, StepDataInterface sdi ) {
  3. meta = (DimensionLookupMeta) smi;
  4. data = (DimensionLookupData) sdi;
  5. if ( data.db != null ) {
  6. try {
  7. if ( !data.db.isAutoCommit() ) {
  8. if ( getErrors() == 0 ) {
  9. data.db.commit();
  10. } else {
  11. data.db.rollback();
  12. }
  13. }
  14. } catch ( KettleDatabaseException e ) {
  15. logError( BaseMessages.getString( PKG, "DimensionLookup.Log.ErrorOccurredInProcessing" ) + e.getMessage() );
  16. } finally {
  17. data.db.disconnect();
  18. }
  19. }
  20. super.dispose( smi, sdi );
  21. }
  22. }

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

  1. public void commit( boolean force ) throws KettleDatabaseException {
  2. try {
  3. // Don't do the commit, wait until the end of the transformation.
  4. // When the last database copy (opened counter) is about to be closed, we
  5. // do a commit
  6. // There is one catch, we need to catch the rollback
  7. // The transformation will stop everything and then we'll do the rollback.
  8. // The flag is in "performRollback", private only
  9. //
  10. if ( !Utils.isEmpty( connectionGroup ) && !force ) {
  11. return;
  12. }
  13. if ( getDatabaseMetaData().supportsTransactions() ) {
  14. if ( log.isDebug() ) {
  15. log.logDebug( "Commit on database connection [" + toString() + "]" );
  16. }
  17. connection.commit();
  18. nrExecutedCommits++;
  19. } else {
  20. if ( log.isDetailed() ) {
  21. log.logDetailed( "No commit possible on database connection [" + toString() + "]" );
  22. }
  23. }
  24. } catch ( Exception e ) {
  25. if ( databaseMeta.supportsEmptyTransactions() ) {
  26. throw new KettleDatabaseException( "Error comitting connection", e );
  27. }
  28. }
  29. }

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

  1. commit();
  2. } catch ( KettleDatabaseException ex ) {

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

  1. public void dispose( StepMetaInterface smi, StepDataInterface sdi ) {
  2. meta = (DBProcMeta) smi;
  3. data = (DBProcData) sdi;
  4. if ( data.db != null ) {
  5. // CHE: Properly close the callable statement
  6. try {
  7. data.db.closeProcedureStatement();
  8. } catch ( KettleDatabaseException e ) {
  9. logError( BaseMessages.getString( PKG, "DBProc.Log.CloseProcedureError" ) + e.getMessage() );
  10. }
  11. try {
  12. if ( !meta.isAutoCommit() ) {
  13. data.db.commit();
  14. }
  15. } catch ( KettleDatabaseException e ) {
  16. logError( BaseMessages.getString( PKG, "DBProc.Log.CommitError" ) + e.getMessage() );
  17. } finally {
  18. data.db.disconnect();
  19. }
  20. }
  21. super.dispose( smi, sdi );
  22. }

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

  1. public void dispose( StepMetaInterface smi, StepDataInterface sdi ) {
  2. meta = (DeleteMeta) smi;
  3. data = (DeleteData) sdi;
  4. if ( data.db != null ) {
  5. try {
  6. if ( !data.db.isAutoCommit() ) {
  7. if ( getErrors() == 0 ) {
  8. data.db.commit();
  9. } else {
  10. data.db.rollback();
  11. }
  12. }
  13. data.db.closeUpdate();
  14. } catch ( KettleDatabaseException e ) {
  15. logError( BaseMessages.getString( PKG, "Delete.Log.UnableToCommitUpdateConnection" )
  16. + data.db + "] :" + e.toString() );
  17. setErrors( 1 );
  18. } finally {
  19. data.db.disconnect();
  20. }
  21. }
  22. super.dispose( smi, sdi );
  23. }

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

  1. public void dispose( StepMetaInterface smi, StepDataInterface sdi ) {
  2. meta = (InsertUpdateMeta) smi;
  3. data = (InsertUpdateData) sdi;
  4. if ( data.db != null ) {
  5. try {
  6. if ( !data.db.isAutoCommit() ) {
  7. if ( getErrors() == 0 ) {
  8. data.db.commit();
  9. } else {
  10. data.db.rollback();
  11. }
  12. }
  13. data.db.closeUpdate();
  14. data.db.closeInsert();
  15. } catch ( KettleDatabaseException e ) {
  16. logError( BaseMessages.getString( PKG, "InsertUpdate.Log.UnableToCommitConnection" ) + e.toString() );
  17. setErrors( 1 );
  18. } finally {
  19. data.db.disconnect();
  20. }
  21. }
  22. super.dispose( smi, sdi );
  23. }

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

  1. @Override
  2. public void dispose( StepMetaInterface smi, StepDataInterface sdi ) {
  3. meta = (ExecSQLRowMeta) smi;
  4. data = (ExecSQLRowData) sdi;
  5. if ( log.isBasic() ) {
  6. logBasic( BaseMessages.getString( PKG, "ExecSQLRow.Log.FinishingReadingQuery" ) );
  7. }
  8. if ( data.db != null ) {
  9. try {
  10. if ( !data.db.isAutoCommit() ) {
  11. if ( getErrors() == 0 ) {
  12. data.db.commit();
  13. } else {
  14. data.db.rollback();
  15. }
  16. }
  17. } catch ( KettleDatabaseException e ) {
  18. logError( BaseMessages.getString( PKG, "Update.Log.UnableToCommitUpdateConnection" )
  19. + data.db + "] :" + e.toString() );
  20. setErrors( 1 );
  21. } finally {
  22. data.db.disconnect();
  23. }
  24. }
  25. super.dispose( smi, sdi );
  26. }

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

  1. /**
  2. * Execute fastload.
  3. *
  4. * @throws KettleException
  5. * ...
  6. */
  7. public void execute() throws KettleException {
  8. if ( this.meta.getTruncateTable().getValue() ) {
  9. Database db = new Database( this, this.meta.getDbMeta() );
  10. db.connect();
  11. db.truncateTable( this.meta.getTargetTable().getValue() );
  12. db.commit();
  13. db.disconnect();
  14. }
  15. startFastLoad();
  16. if ( this.meta.getUseControlFile().getValue() ) {
  17. this.invokeLoadingControlFile();
  18. } else {
  19. this.invokeLoadingCommand();
  20. }
  21. }

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

  1. } finally {
  2. if ( !db.isAutoCommit() ) {
  3. db.commit( true );

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

  1. repository.connectionDelegate.getDatabase().commit();

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

  1. database.commit( true );
  2. log.logBasic( BaseMessages.getString( PKG, "Trans.Exception.TransactionsCommittedOnConnection", database
  3. .toString() ) );

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

  1. data.db.commit();

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

  1. if ( !data.db.isAutoCommit() ) {
  2. if ( meta.getCommitSize() == 1 ) {
  3. data.db.commit();
  4. } else if ( getLinesWritten() % meta.getCommitSize() == 0 ) {
  5. data.db.commit();

相关文章