use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class Props method convertArguments.
public static final String[] convertArguments(RowMetaAndData row) {
String[] args = new String[10];
for (int i = 0; i < row.size(); i++) {
ValueMetaInterface valueMeta = row.getValueMeta(i);
int argNr = getArgumentNumber(valueMeta);
if (argNr >= 0 && argNr < 10) {
try {
args[argNr] = row.getString(i, "");
} catch (KettleValueException e) {
// Should never happen
args[argNr] = "";
}
}
}
return args;
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlBitToPentahoBoolean.
@Test
public void testMetdataPreviewSqlBitToPentahoBoolean() throws SQLException, KettleDatabaseException {
doReturn(Types.BIT).when(resultSet).getInt("DATA_TYPE");
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isBoolean());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlVarcharToPentahoString.
@Test
public void testMetdataPreviewSqlVarcharToPentahoString() throws SQLException, KettleDatabaseException {
doReturn(Types.VARCHAR).when(resultSet).getInt("DATA_TYPE");
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isString());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewUnsupportedSqlTimestamp.
@Test
public void testMetdataPreviewUnsupportedSqlTimestamp() throws SQLException, KettleDatabaseException {
doReturn(Types.TIMESTAMP).when(resultSet).getInt("DATA_TYPE");
doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS");
doReturn(19).when(resultSet).getInt("DECIMAL_DIGITS");
doReturn(false).when(dbMetaMock).supportsTimestampDataType();
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(!valueMeta.isDate());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlBinaryToPentahoBinary.
@Test
public void testMetdataPreviewSqlBinaryToPentahoBinary() throws SQLException, KettleDatabaseException {
doReturn(Types.BINARY).when(resultSet).getInt("DATA_TYPE");
doReturn(mock(PostgreSQLDatabaseMeta.class)).when(dbMetaMock).getDatabaseInterface();
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isBinary());
}
Aggregations