use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.
the class DatabaseIT method testDatabaseCasing.
@Test
public void testDatabaseCasing() throws Exception {
String tableName = "mIxCaSiNG";
Database db = setupDatabase();
db.connect();
RowMetaInterface rm = new RowMeta();
ValueMetaInterface[] valuesMeta = { new ValueMetaInteger("ID"), new ValueMetaInteger("DLR_CD") };
for (int i = 0; i < valuesMeta.length; i++) {
valuesMeta[i].setLength(8);
valuesMeta[i].setPrecision(0);
rm.addValueMeta(valuesMeta[i]);
}
String createStatement = db.getCreateTableStatement(tableName, rm, null, false, null, true);
db.execStatement(createStatement);
// Make sure that the tablename is of mixed case
assertFalse(tableName.equals(tableName.toLowerCase()));
assertTrue(db.checkTableExists(tableName));
assertEquals(false, db.checkTableExists("unknown"));
// We're testing here whether tables names are case insensitive.
// If this would fail, it can either be a problem with PDI or
// be a problem with a new H2 JDBC driver.
assertTrue(db.checkTableExists(tableName.toLowerCase()));
db.disconnect();
}
use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.
the class DatabaseIT method testBatchCommit.
@Test
public void testBatchCommit() throws Exception {
String tableName = "CommitTest";
Database db = setupDatabase();
db.connect();
RowMetaInterface rm = new RowMeta();
ValueMetaInterface[] valuesMeta = { new ValueMetaInteger("ID"), new ValueMetaInteger("VALUE") };
for (int i = 0; i < valuesMeta.length; i++) {
valuesMeta[i].setLength(8);
valuesMeta[i].setPrecision(0);
rm.addValueMeta(valuesMeta[i]);
}
String createStatement = db.getCreateTableStatement(tableName, rm, null, false, null, true);
db.execStatement(createStatement);
int insertSize = 3;
db.setCommit(insertSize - 1);
fillDbInBatch(tableName, db, insertSize);
db.truncateTable(tableName);
insertSize = 3;
db.setCommit(insertSize);
fillDbInBatch(tableName, db, insertSize);
db.disconnect();
}
use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.
the class CloneRowMeta method getFields.
public void getFields(RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
// Output field (boolean) ?
if (addcloneflag) {
String realfieldValue = space.environmentSubstitute(cloneflagfield);
if (!Utils.isEmpty(realfieldValue)) {
ValueMetaInterface v = new ValueMetaBoolean(realfieldValue);
v.setOrigin(origin);
rowMeta.addValueMeta(v);
}
}
// Output clone row number
if (addclonenum) {
String realfieldValue = space.environmentSubstitute(clonenumfield);
if (!Utils.isEmpty(realfieldValue)) {
ValueMetaInterface v = new ValueMetaInteger(realfieldValue);
v.setOrigin(origin);
rowMeta.addValueMeta(v);
}
}
}
use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.
the class ClosureGeneratorMeta method getFields.
@Override
public void getFields(RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
// The output for the closure table is:
//
// - parentId
// - childId
// - distance
//
// Nothing else.
//
RowMetaInterface result = new RowMeta();
ValueMetaInterface parentValueMeta = row.searchValueMeta(parentIdFieldName);
if (parentValueMeta != null) {
result.addValueMeta(parentValueMeta);
}
ValueMetaInterface childValueMeta = row.searchValueMeta(childIdFieldName);
if (childValueMeta != null) {
result.addValueMeta(childValueMeta);
}
ValueMetaInterface distanceValueMeta = new ValueMetaInteger(distanceFieldName);
distanceValueMeta.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH);
result.addValueMeta(distanceValueMeta);
row.clear();
row.addRowMeta(result);
}
use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.
the class InjectorIT method createRowMetaInterface.
public RowMetaInterface createRowMetaInterface() {
RowMetaInterface rm = new RowMeta();
ValueMetaInterface[] valuesMeta = { new ValueMetaString("field1"), new ValueMetaInteger("field2"), new ValueMetaNumber("field3"), new ValueMetaDate("field4"), new ValueMetaBoolean("field5"), new ValueMetaBigNumber("field6"), new ValueMetaBigNumber("field7") };
for (int i = 0; i < valuesMeta.length; i++) {
rm.addValueMeta(valuesMeta[i]);
}
return rm;
}
Aggregations