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

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

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

Database.getInsertStatement介绍

暂无

代码示例

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

  1. public String getInsertStatement( String tableName, RowMetaInterface fields ) {
  2. return getInsertStatement( null, tableName, fields );
  3. }

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

  1. /**
  2. * Prepare inserting values into a table, using the fields & values in a Row
  3. *
  4. * @param rowMeta The metadata row to determine which values need to be inserted
  5. * @param schemaName The name of the schema in which we want to insert rows
  6. * @param tableName The name of the table in which we want to insert rows
  7. * @throws KettleDatabaseException if something went wrong.
  8. */
  9. public void prepareInsert( RowMetaInterface rowMeta, String schemaName, String tableName )
  10. throws KettleDatabaseException {
  11. if ( rowMeta.size() == 0 ) {
  12. throw new KettleDatabaseException( "No fields in row, can't insert!" );
  13. }
  14. String ins = getInsertStatement( schemaName, tableName, rowMeta );
  15. if ( log.isDetailed() ) {
  16. log.logDetailed( "Preparing statement: " + Const.CR + ins );
  17. }
  18. prepStatementInsert = prepareSQL( ins );
  19. }

代码示例来源: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. String sql =
  2. data.db
  3. .getInsertStatement( environmentSubstitute( meta.getSchemaName() ), tableName, data.insertRowMeta );
  4. if ( log.isDetailed() ) {
  5. logDetailed( "Prepared statement : " + sql );

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

  1. data.insertStatement = data.preparedStatements.get( data.realSchemaTable + "insert" );
  2. if ( data.insertStatement == null ) {
  3. String sql = data.db.getInsertStatement( data.realSchemaName, data.realTableName, data.insertRowMeta );

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

  1. String sql = data.db.getInsertStatement( data.realSchemaName, data.realTableName, data.insertRowMeta );

相关文章