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

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

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

Database.isAutoCommit介绍

暂无

代码示例

代码示例来源: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. public synchronized void disconnect() {
  2. try {
  3. repository.connectionDelegate.closeStepAttributeLookupPreparedStatement();
  4. repository.connectionDelegate.closeTransAttributeLookupPreparedStatement();
  5. repository.connectionDelegate.closeLookupJobEntryAttribute();
  6. for ( String sql : sqlMap.keySet() ) {
  7. PreparedStatement ps = sqlMap.get( sql );
  8. try {
  9. ps.close();
  10. } catch ( SQLException e ) {
  11. log.logError( "Error closing prepared statement: " + sql, e );
  12. }
  13. }
  14. if ( !database.isAutoCommit() ) {
  15. commit();
  16. }
  17. repository.setConnected( false );
  18. } catch ( KettleException dbe ) {
  19. log.logError( "Error disconnecting from database : " + dbe.getMessage() );
  20. } finally {
  21. database.disconnect();
  22. sqlMap.clear();
  23. }
  24. }

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

  1. if ( !isAutoCommit() ) {
  2. if ( useBatchInsert ) {
  3. debug = "insertRow add batch";
  4. if ( !isAutoCommit() && ( written % commitsize ) == 0 ) {
  5. if ( useBatchInsert ) {
  6. isBatchUpdate = true;

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

  1. try {
  2. if ( ps != null ) {
  3. if ( !isAutoCommit() ) {

代码示例来源: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. try {
  2. if ( ps != null ) {
  3. if ( !isAutoCommit() ) {

代码示例来源: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 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. if ( getConnection().getAutoCommit() != isAutoCommit() ) {
  2. setAutoCommit( isAutoCommit() );

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

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

代码示例来源: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. * 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. "Trans.Exception.UnableToWriteLogChannelInformationToLogTable" ), e );
  2. } finally {
  3. if ( !db.isAutoCommit() ) {
  4. db.commit( true );

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

  1. if ( !ldb.isAutoCommit() ) {
  2. ldb.commitLog( true, transMeta.getTransLogTable() );

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

  1. data.result = data.db.execStatements( data.sql );
  2. if ( !data.db.isAutoCommit() ) {
  3. data.db.commit();

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

  1. if ( !data.db.isAutoCommit() ) {
  2. if ( meta.getCommitSize() == 1 ) {
  3. data.db.commit();

相关文章