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

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

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

Database.setValues介绍

[英]Sets the values of the preparedStatement pstmt.
[中]设置preparedStatement pstmt的值。

代码示例

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

  1. public void setValuesInsert( RowMetaInterface rowMeta, Object[] data ) throws KettleDatabaseException {
  2. setValues( rowMeta, data, prepStatementInsert );
  3. }

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

  1. public void setValues( RowMetaInterface rowMeta, Object[] data ) throws KettleDatabaseException {
  2. setValues( rowMeta, data, pstmt );
  3. }

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

  1. public void setValuesUpdate( RowMetaInterface rowMeta, Object[] data ) throws KettleDatabaseException {
  2. setValues( rowMeta, data, prepStatementUpdate );
  3. }

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

  1. public void setValuesLookup( RowMetaInterface rowMeta, Object[] data ) throws KettleDatabaseException {
  2. setValues( rowMeta, data, prepStatementLookup );
  3. }

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

  1. public void performDelete( String sql, ObjectId... ids ) throws KettleException {
  2. try {
  3. PreparedStatement ps = getPreparedStatement( sql );
  4. RowMetaAndData param = getParameterMetaData( ids );
  5. database.setValues( param, ps );
  6. ps.execute();
  7. } catch ( SQLException e ) {
  8. throw new KettleException( "Unable to perform delete with SQL: " + sql + ", ids=" + Arrays.toString( ids ), e );
  9. }
  10. }

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

  1. public void setValues( RowMetaAndData row ) throws KettleDatabaseException {
  2. setValues( row.getRowMeta(), row.getData() );
  3. }

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

  1. public void setValuesInsert( RowMetaAndData row ) throws KettleDatabaseException {
  2. setValues( row.getRowMeta(), row.getData(), prepStatementInsert );
  3. }

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

  1. public void setValues( RowMetaAndData row, PreparedStatement ps ) throws KettleDatabaseException {
  2. setValues( row.getRowMeta(), row.getData(), ps );
  3. }

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

  1. if ( params != null ) {
  2. PreparedStatement prep_stmt = connection.prepareStatement( databaseMeta.stripCR( sql ) );
  3. setValues( params, data, prep_stmt ); // set the parameters!
  4. resultSet = prep_stmt.execute();
  5. count = prep_stmt.getUpdateCount();

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

  1. setValues( r, new Object[] { name } );

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

  1. public RowMetaAndData getJobAttributeRow( ObjectId id_job, int nr, String code ) throws KettleException {
  2. RowMetaAndData par = new RowMetaAndData();
  3. par.addValue( new ValueMetaInteger(
  4. KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_ID_JOB ), id_job );
  5. par.addValue(
  6. new ValueMetaString( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_CODE ), code );
  7. par.addValue(
  8. new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_NR ),
  9. new Long( nr ) );
  10. if ( psJobAttributesLookup == null ) {
  11. setLookupJobAttribute();
  12. }
  13. database.setValues( par, psJobAttributesLookup );
  14. return callRead( new Callable<RowMetaAndData>() {
  15. @Override public RowMetaAndData call() throws Exception {
  16. Object[] r = database.getLookup( psJobAttributesLookup );
  17. if ( r == null ) {
  18. return null;
  19. }
  20. return new RowMetaAndData( database.getReturnRowMeta(), r );
  21. }
  22. } );
  23. }

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

  1. public RowMetaAndData getTransAttributeRow( ObjectId id_transformation, int nr, String code ) throws KettleException {
  2. RowMetaAndData par = new RowMetaAndData();
  3. par.addValue(
  4. new ValueMetaInteger(
  5. KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_ID_TRANSFORMATION ),
  6. id_transformation );
  7. par.addValue( new ValueMetaString(
  8. KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_CODE ), code );
  9. par.addValue( new ValueMetaInteger(
  10. KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_NR ), new Long( nr ) );
  11. if ( psTransAttributesLookup == null ) {
  12. setLookupTransAttribute();
  13. }
  14. database.setValues( par, psTransAttributesLookup );
  15. return callRead( new Callable<RowMetaAndData>() {
  16. @Override public RowMetaAndData call() throws Exception {
  17. Object[] r = database.getLookup( psTransAttributesLookup );
  18. if ( r == null ) {
  19. return null;
  20. }
  21. return new RowMetaAndData( database.getReturnRowMeta(), r );
  22. }
  23. } );
  24. }

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

  1. private RowMetaAndData getStepAttributeRow( ObjectId id_step, int nr, String code ) throws KettleException {
  2. RowMetaAndData par = new RowMetaAndData();
  3. par.addValue( new ValueMetaInteger(
  4. KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_ID_STEP ), id_step );
  5. par.addValue( new ValueMetaString(
  6. KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_CODE ), code );
  7. par.addValue(
  8. new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_NR ),
  9. new Long( nr ) );
  10. if ( psStepAttributesLookup == null ) {
  11. setLookupStepAttribute();
  12. }
  13. database.setValues( par.getRowMeta(), par.getData(), psStepAttributesLookup );
  14. return callRead( new Callable<RowMetaAndData>() {
  15. @Override public RowMetaAndData call() throws Exception {
  16. Object[] lookup = database.getLookup( psStepAttributesLookup );
  17. return new RowMetaAndData( database.getReturnRowMeta(), lookup );
  18. }
  19. } );
  20. }

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

  1. private RowMetaAndData getJobEntryAttributeRow( ObjectId id_jobentry, int nr, String code ) throws KettleException {
  2. RowMetaAndData par = new RowMetaAndData();
  3. par.addValue(
  4. new ValueMetaInteger(
  5. KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_ID_JOBENTRY ),
  6. id_jobentry );
  7. par.addValue( new ValueMetaString(
  8. KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_CODE ), code );
  9. par.addValue( new ValueMetaInteger(
  10. KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_NR ), new Long( nr ) );
  11. if ( pstmt_entry_attributes == null ) {
  12. setLookupJobEntryAttribute();
  13. }
  14. database.setValues( par.getRowMeta(), par.getData(), pstmt_entry_attributes );
  15. return callRead( new Callable<RowMetaAndData>() {
  16. @Override public RowMetaAndData call() throws Exception {
  17. Object[] lookup = database.getLookup( pstmt_entry_attributes );
  18. return new RowMetaAndData( database.getReturnRowMeta(), lookup );
  19. }
  20. } );
  21. }

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

  1. private synchronized void deleteValues( RowMetaInterface rowMeta, Object[] row ) throws KettleException {
  2. // OK, now do the lookup.
  3. // We need the lookupvalues for that.
  4. Object[] deleteRow = new Object[data.deleteParameterRowMeta.size()];
  5. int deleteIndex = 0;
  6. for ( int i = 0; i < meta.getKeyStream().length; i++ ) {
  7. if ( data.keynrs[i] >= 0 ) {
  8. deleteRow[deleteIndex] = row[data.keynrs[i]];
  9. deleteIndex++;
  10. }
  11. if ( data.keynrs2[i] >= 0 ) {
  12. deleteRow[deleteIndex] = row[data.keynrs2[i]];
  13. deleteIndex++;
  14. }
  15. }
  16. data.db.setValues( data.deleteParameterRowMeta, deleteRow, data.prepStatementDelete );
  17. if ( log.isDebug() ) {
  18. logDebug( BaseMessages.getString( PKG, "Delete.Log.SetValuesForDelete", data.deleteParameterRowMeta
  19. .getString( deleteRow ), rowMeta.getString( row ) ) );
  20. }
  21. data.db.insertRow( data.prepStatementDelete );
  22. incrementLinesUpdated();
  23. }

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

  1. public synchronized ObjectId insertTransAttribute( ObjectId id_transformation, long nr, String code,
  2. long value_num, String value_str ) throws KettleException {
  3. ObjectId id = getNextTransAttributeID();
  4. RowMetaAndData table = new RowMetaAndData();
  5. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_ID_TRANS_ATTRIBUTE ), id );
  6. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_ID_TRANSFORMATION ),
  7. id_transformation );
  8. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_NR ), new Long( nr ) );
  9. table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_CODE ), code );
  10. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_VALUE_NUM ),
  11. new Long( value_num ) );
  12. table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_VALUE_STR ), value_str );
  13. /*
  14. * If we have prepared the insert, we don't do it again. We asume that all the step insert statements come one after
  15. * the other.
  16. */
  17. if ( psTransAttributesInsert == null ) {
  18. String sql =
  19. database.getInsertStatement( KettleDatabaseRepository.TABLE_R_TRANS_ATTRIBUTE, table.getRowMeta() );
  20. psTransAttributesInsert = database.prepareSQL( sql );
  21. }
  22. database.setValues( table, psTransAttributesInsert );
  23. database.insertRow( psTransAttributesInsert, useBatchProcessing );
  24. if ( log.isDebug() ) {
  25. log.logDebug( "saved transformation attribute [" + code + "]" );
  26. }
  27. return id;
  28. }

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

  1. public synchronized ObjectId insertJobAttribute( ObjectId id_job, long nr, String code, long value_num,
  2. String value_str ) throws KettleException {
  3. ObjectId id = getNextJobAttributeID();
  4. // System.out.println("Insert job attribute : id_job="+id_job+", code="+code+", value_str="+value_str);
  5. RowMetaAndData table = new RowMetaAndData();
  6. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_ID_JOB_ATTRIBUTE ), id );
  7. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_ID_JOB ), id_job );
  8. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_NR ), new Long( nr ) );
  9. table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_CODE ), code );
  10. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_VALUE_NUM ),
  11. new Long( value_num ) );
  12. table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_VALUE_STR ), value_str );
  13. /*
  14. * If we have prepared the insert, we don't do it again. We asume that all the step insert statements come one after
  15. * the other.
  16. */
  17. if ( psJobAttributesInsert == null ) {
  18. String sql =
  19. database.getInsertStatement( KettleDatabaseRepository.TABLE_R_JOB_ATTRIBUTE, table.getRowMeta() );
  20. psJobAttributesInsert = database.prepareSQL( sql );
  21. }
  22. database.setValues( table, psJobAttributesInsert );
  23. database.insertRow( psJobAttributesInsert, useBatchProcessing );
  24. if ( log.isDebug() ) {
  25. log.logDebug( "saved job attribute [" + code + "]" );
  26. }
  27. return id;
  28. }

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

  1. public synchronized ObjectId insertStepAttribute( ObjectId id_transformation, ObjectId id_step, long nr,
  2. String code, double value_num, String value_str )
  3. throws KettleException {
  4. ObjectId id = getNextStepAttributeID();
  5. RowMetaAndData table = new RowMetaAndData();
  6. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_ID_STEP_ATTRIBUTE ), id );
  7. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_ID_TRANSFORMATION ),
  8. id_transformation );
  9. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_ID_STEP ), id_step );
  10. table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_NR ), new Long( nr ) );
  11. table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_CODE ), code );
  12. table.addValue( new ValueMetaNumber( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_VALUE_NUM ),
  13. new Double( value_num ) );
  14. table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_VALUE_STR ), value_str );
  15. /*
  16. * If we have prepared the insert, we don't do it again. We assume that all the step insert statements come one
  17. * after the other.
  18. */
  19. if ( psStepAttributesInsert == null ) {
  20. String sql =
  21. database.getInsertStatement( KettleDatabaseRepository.TABLE_R_STEP_ATTRIBUTE, table.getRowMeta() );
  22. psStepAttributesInsert = database.prepareSQL( sql );
  23. }
  24. database.setValues( table, psStepAttributesInsert );
  25. database.insertRow( psStepAttributesInsert, useBatchProcessing );
  26. if ( log.isDebug() ) {
  27. log.logDebug( "saved attribute [" + code + "]" );
  28. }
  29. return id;
  30. }

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

  1. setValues( params, data ); // set the dates etc!
  2. log.snap( Metrics.METRIC_DATABASE_SQL_VALUES_STOP, databaseMeta.getName() );

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

  1. setValues( params, data, ps ); // set the parameters!
  2. log.snap( Metrics.METRIC_DATABASE_SQL_VALUES_STOP, databaseMeta.getName() );

相关文章