本文整理了Java中org.pentaho.di.core.database.Database.setValues()
方法的一些代码示例,展示了Database.setValues()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Database.setValues()
方法的具体详情如下:
包路径:org.pentaho.di.core.database.Database
类名称:Database
方法名:setValues
[英]Sets the values of the preparedStatement pstmt.
[中]设置preparedStatement pstmt的值。
代码示例来源:origin: pentaho/pentaho-kettle
public void setValuesInsert( RowMetaInterface rowMeta, Object[] data ) throws KettleDatabaseException {
setValues( rowMeta, data, prepStatementInsert );
}
代码示例来源:origin: pentaho/pentaho-kettle
public void setValues( RowMetaInterface rowMeta, Object[] data ) throws KettleDatabaseException {
setValues( rowMeta, data, pstmt );
}
代码示例来源:origin: pentaho/pentaho-kettle
public void setValuesUpdate( RowMetaInterface rowMeta, Object[] data ) throws KettleDatabaseException {
setValues( rowMeta, data, prepStatementUpdate );
}
代码示例来源:origin: pentaho/pentaho-kettle
public void setValuesLookup( RowMetaInterface rowMeta, Object[] data ) throws KettleDatabaseException {
setValues( rowMeta, data, prepStatementLookup );
}
代码示例来源:origin: pentaho/pentaho-kettle
public void performDelete( String sql, ObjectId... ids ) throws KettleException {
try {
PreparedStatement ps = getPreparedStatement( sql );
RowMetaAndData param = getParameterMetaData( ids );
database.setValues( param, ps );
ps.execute();
} catch ( SQLException e ) {
throw new KettleException( "Unable to perform delete with SQL: " + sql + ", ids=" + Arrays.toString( ids ), e );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public void setValues( RowMetaAndData row ) throws KettleDatabaseException {
setValues( row.getRowMeta(), row.getData() );
}
代码示例来源:origin: pentaho/pentaho-kettle
public void setValuesInsert( RowMetaAndData row ) throws KettleDatabaseException {
setValues( row.getRowMeta(), row.getData(), prepStatementInsert );
}
代码示例来源:origin: pentaho/pentaho-kettle
public void setValues( RowMetaAndData row, PreparedStatement ps ) throws KettleDatabaseException {
setValues( row.getRowMeta(), row.getData(), ps );
}
代码示例来源:origin: pentaho/pentaho-kettle
if ( params != null ) {
PreparedStatement prep_stmt = connection.prepareStatement( databaseMeta.stripCR( sql ) );
setValues( params, data, prep_stmt ); // set the parameters!
resultSet = prep_stmt.execute();
count = prep_stmt.getUpdateCount();
代码示例来源:origin: pentaho/pentaho-kettle
setValues( r, new Object[] { name } );
代码示例来源:origin: pentaho/pentaho-kettle
public RowMetaAndData getJobAttributeRow( ObjectId id_job, int nr, String code ) throws KettleException {
RowMetaAndData par = new RowMetaAndData();
par.addValue( new ValueMetaInteger(
KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_ID_JOB ), id_job );
par.addValue(
new ValueMetaString( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_CODE ), code );
par.addValue(
new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_NR ),
new Long( nr ) );
if ( psJobAttributesLookup == null ) {
setLookupJobAttribute();
}
database.setValues( par, psJobAttributesLookup );
return callRead( new Callable<RowMetaAndData>() {
@Override public RowMetaAndData call() throws Exception {
Object[] r = database.getLookup( psJobAttributesLookup );
if ( r == null ) {
return null;
}
return new RowMetaAndData( database.getReturnRowMeta(), r );
}
} );
}
代码示例来源:origin: pentaho/pentaho-kettle
public RowMetaAndData getTransAttributeRow( ObjectId id_transformation, int nr, String code ) throws KettleException {
RowMetaAndData par = new RowMetaAndData();
par.addValue(
new ValueMetaInteger(
KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_ID_TRANSFORMATION ),
id_transformation );
par.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_CODE ), code );
par.addValue( new ValueMetaInteger(
KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_NR ), new Long( nr ) );
if ( psTransAttributesLookup == null ) {
setLookupTransAttribute();
}
database.setValues( par, psTransAttributesLookup );
return callRead( new Callable<RowMetaAndData>() {
@Override public RowMetaAndData call() throws Exception {
Object[] r = database.getLookup( psTransAttributesLookup );
if ( r == null ) {
return null;
}
return new RowMetaAndData( database.getReturnRowMeta(), r );
}
} );
}
代码示例来源:origin: pentaho/pentaho-kettle
private RowMetaAndData getStepAttributeRow( ObjectId id_step, int nr, String code ) throws KettleException {
RowMetaAndData par = new RowMetaAndData();
par.addValue( new ValueMetaInteger(
KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_ID_STEP ), id_step );
par.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_CODE ), code );
par.addValue(
new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_ATTRIBUTE_NR ),
new Long( nr ) );
if ( psStepAttributesLookup == null ) {
setLookupStepAttribute();
}
database.setValues( par.getRowMeta(), par.getData(), psStepAttributesLookup );
return callRead( new Callable<RowMetaAndData>() {
@Override public RowMetaAndData call() throws Exception {
Object[] lookup = database.getLookup( psStepAttributesLookup );
return new RowMetaAndData( database.getReturnRowMeta(), lookup );
}
} );
}
代码示例来源:origin: pentaho/pentaho-kettle
private RowMetaAndData getJobEntryAttributeRow( ObjectId id_jobentry, int nr, String code ) throws KettleException {
RowMetaAndData par = new RowMetaAndData();
par.addValue(
new ValueMetaInteger(
KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_ID_JOBENTRY ),
id_jobentry );
par.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_CODE ), code );
par.addValue( new ValueMetaInteger(
KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_NR ), new Long( nr ) );
if ( pstmt_entry_attributes == null ) {
setLookupJobEntryAttribute();
}
database.setValues( par.getRowMeta(), par.getData(), pstmt_entry_attributes );
return callRead( new Callable<RowMetaAndData>() {
@Override public RowMetaAndData call() throws Exception {
Object[] lookup = database.getLookup( pstmt_entry_attributes );
return new RowMetaAndData( database.getReturnRowMeta(), lookup );
}
} );
}
代码示例来源:origin: pentaho/pentaho-kettle
private synchronized void deleteValues( RowMetaInterface rowMeta, Object[] row ) throws KettleException {
// OK, now do the lookup.
// We need the lookupvalues for that.
Object[] deleteRow = new Object[data.deleteParameterRowMeta.size()];
int deleteIndex = 0;
for ( int i = 0; i < meta.getKeyStream().length; i++ ) {
if ( data.keynrs[i] >= 0 ) {
deleteRow[deleteIndex] = row[data.keynrs[i]];
deleteIndex++;
}
if ( data.keynrs2[i] >= 0 ) {
deleteRow[deleteIndex] = row[data.keynrs2[i]];
deleteIndex++;
}
}
data.db.setValues( data.deleteParameterRowMeta, deleteRow, data.prepStatementDelete );
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "Delete.Log.SetValuesForDelete", data.deleteParameterRowMeta
.getString( deleteRow ), rowMeta.getString( row ) ) );
}
data.db.insertRow( data.prepStatementDelete );
incrementLinesUpdated();
}
代码示例来源: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
setValues( params, data ); // set the dates etc!
log.snap( Metrics.METRIC_DATABASE_SQL_VALUES_STOP, databaseMeta.getName() );
代码示例来源:origin: pentaho/pentaho-kettle
setValues( params, data, ps ); // set the parameters!
log.snap( Metrics.METRIC_DATABASE_SQL_VALUES_STOP, databaseMeta.getName() );
内容来源于网络,如有侵权,请联系作者删除!