本文整理了Java中org.pentaho.di.core.database.Database.getInsertStatement()
方法的一些代码示例,展示了Database.getInsertStatement()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Database.getInsertStatement()
方法的具体详情如下:
包路径:org.pentaho.di.core.database.Database
类名称:Database
方法名:getInsertStatement
暂无
代码示例来源:origin: pentaho/pentaho-kettle
public String getInsertStatement( String tableName, RowMetaInterface fields ) {
return getInsertStatement( null, tableName, fields );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Prepare inserting values into a table, using the fields & values in a Row
*
* @param rowMeta The metadata row to determine which values need to be inserted
* @param schemaName The name of the schema in which we want to insert rows
* @param tableName The name of the table in which we want to insert rows
* @throws KettleDatabaseException if something went wrong.
*/
public void prepareInsert( RowMetaInterface rowMeta, String schemaName, String tableName )
throws KettleDatabaseException {
if ( rowMeta.size() == 0 ) {
throw new KettleDatabaseException( "No fields in row, can't insert!" );
}
String ins = getInsertStatement( schemaName, tableName, rowMeta );
if ( log.isDetailed() ) {
log.logDetailed( "Preparing statement: " + Const.CR + ins );
}
prepStatementInsert = prepareSQL( ins );
}
代码示例来源:origin: pentaho/pentaho-kettle
public synchronized ObjectId insertTransAttribute( ObjectId id_transformation, long nr, String code,
long value_num, String value_str ) throws KettleException {
ObjectId id = getNextTransAttributeID();
RowMetaAndData table = new RowMetaAndData();
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_ID_TRANS_ATTRIBUTE ), id );
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_ID_TRANSFORMATION ),
id_transformation );
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_NR ), new Long( nr ) );
table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_CODE ), code );
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_VALUE_NUM ),
new Long( value_num ) );
table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_VALUE_STR ), value_str );
/*
* If we have prepared the insert, we don't do it again. We asume that all the step insert statements come one after
* the other.
*/
if ( psTransAttributesInsert == null ) {
String sql =
database.getInsertStatement( KettleDatabaseRepository.TABLE_R_TRANS_ATTRIBUTE, table.getRowMeta() );
psTransAttributesInsert = database.prepareSQL( sql );
}
database.setValues( table, psTransAttributesInsert );
database.insertRow( psTransAttributesInsert, useBatchProcessing );
if ( log.isDebug() ) {
log.logDebug( "saved transformation attribute [" + code + "]" );
}
return id;
}
代码示例来源:origin: pentaho/pentaho-kettle
public synchronized ObjectId insertJobAttribute( ObjectId id_job, long nr, String code, long value_num,
String value_str ) throws KettleException {
ObjectId id = getNextJobAttributeID();
// System.out.println("Insert job attribute : id_job="+id_job+", code="+code+", value_str="+value_str);
RowMetaAndData table = new RowMetaAndData();
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_ID_JOB_ATTRIBUTE ), id );
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_ID_JOB ), id_job );
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_NR ), new Long( nr ) );
table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_CODE ), code );
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_VALUE_NUM ),
new Long( value_num ) );
table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_VALUE_STR ), value_str );
/*
* If we have prepared the insert, we don't do it again. We asume that all the step insert statements come one after
* the other.
*/
if ( psJobAttributesInsert == null ) {
String sql =
database.getInsertStatement( KettleDatabaseRepository.TABLE_R_JOB_ATTRIBUTE, table.getRowMeta() );
psJobAttributesInsert = database.prepareSQL( sql );
}
database.setValues( table, psJobAttributesInsert );
database.insertRow( psJobAttributesInsert, useBatchProcessing );
if ( log.isDebug() ) {
log.logDebug( "saved job attribute [" + code + "]" );
}
return id;
}
代码示例来源:origin: pentaho/pentaho-kettle
public synchronized ObjectId insertStepAttribute( ObjectId id_transformation, ObjectId id_step, long nr,
String code, double value_num, String value_str )
throws KettleException {
ObjectId id = getNextStepAttributeID();
RowMetaAndData table = new RowMetaAndData();
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_ID_STEP_ATTRIBUTE ), id );
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_ID_TRANSFORMATION ),
id_transformation );
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_ID_STEP ), id_step );
table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_NR ), new Long( nr ) );
table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_CODE ), code );
table.addValue( new ValueMetaNumber( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_VALUE_NUM ),
new Double( value_num ) );
table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_VALUE_STR ), value_str );
/*
* If we have prepared the insert, we don't do it again. We assume that all the step insert statements come one
* after the other.
*/
if ( psStepAttributesInsert == null ) {
String sql =
database.getInsertStatement( KettleDatabaseRepository.TABLE_R_STEP_ATTRIBUTE, table.getRowMeta() );
psStepAttributesInsert = database.prepareSQL( sql );
}
database.setValues( table, psStepAttributesInsert );
database.insertRow( psStepAttributesInsert, useBatchProcessing );
if ( log.isDebug() ) {
log.logDebug( "saved attribute [" + code + "]" );
}
return id;
}
代码示例来源:origin: pentaho/pentaho-kettle
String sql =
data.db
.getInsertStatement( environmentSubstitute( meta.getSchemaName() ), tableName, data.insertRowMeta );
if ( log.isDetailed() ) {
logDetailed( "Prepared statement : " + sql );
代码示例来源:origin: pentaho/pentaho-kettle
data.insertStatement = data.preparedStatements.get( data.realSchemaTable + "insert" );
if ( data.insertStatement == null ) {
String sql = data.db.getInsertStatement( data.realSchemaName, data.realTableName, data.insertRowMeta );
代码示例来源:origin: pentaho/pentaho-kettle
String sql = data.db.getInsertStatement( data.realSchemaName, data.realTableName, data.insertRowMeta );
内容来源于网络,如有侵权,请联系作者删除!