Java Code Examples for org.pentaho.di.core.RowMetaAndData#isNumeric()
The following examples show how to use
org.pentaho.di.core.RowMetaAndData#isNumeric() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KettleDatabaseRepositoryConnectionDelegate.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public synchronized ObjectId getIDWithValue( String tablename, String idfield, String lookupfield, String value, String lookupkey, ObjectId key ) throws KettleException { RowMetaAndData par = new RowMetaAndData(); par.addValue( new ValueMetaString( "value" ), value ); par.addValue( new ValueMetaInteger( "key" ), new LongObjectId( key ) ); RowMetaAndData result = getOneRow( "SELECT " + idfield + " FROM " + tablename + " WHERE " + lookupfield + " = ? AND " + lookupkey + " = ?", par .getRowMeta(), par.getData() ); if ( result != null && result.getRowMeta() != null && result.getData() != null && result.isNumeric( 0 ) ) { return new LongObjectId( result.getInteger( 0, 0 ) ); } return null; }
Example 2
Source File: KettleDatabaseRepositoryConnectionDelegate.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public synchronized ObjectId getIDWithValue( String tablename, String idfield, String[] lookupkey, ObjectId[] key ) throws KettleException { RowMetaAndData par = new RowMetaAndData(); String sql = "SELECT " + idfield + " FROM " + tablename + " "; for ( int i = 0; i < lookupkey.length; i++ ) { if ( i == 0 ) { sql += "WHERE "; } else { sql += "AND "; } par.addValue( new ValueMetaInteger( lookupkey[ i ] ), new LongObjectId( key[ i ] ) ); sql += lookupkey[ i ] + " = ? "; } RowMetaAndData result = getOneRow( sql, par.getRowMeta(), par.getData() ); if ( result != null && result.getRowMeta() != null && result.getData() != null && result.isNumeric( 0 ) ) { return new LongObjectId( result.getInteger( 0, 0 ) ); } return null; }
Example 3
Source File: KettleDatabaseRepositoryConnectionDelegate.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public synchronized LongObjectId getIDWithValue( String tablename, String idfield, String lookupfield, String value, String[] lookupkey, ObjectId[] key ) throws KettleException { RowMetaAndData par = new RowMetaAndData(); par.addValue( new ValueMetaString( lookupfield ), value ); String sql = "SELECT " + idfield + " FROM " + tablename + " WHERE " + lookupfield + " = ? "; for ( int i = 0; i < lookupkey.length; i++ ) { par.addValue( new ValueMetaInteger( lookupkey[ i ] ), new LongObjectId( key[ i ] ) ); sql += "AND " + lookupkey[ i ] + " = ? "; } RowMetaAndData result = getOneRow( sql, par.getRowMeta(), par.getData() ); if ( result != null && result.getRowMeta() != null && result.getData() != null && result.isNumeric( 0 ) ) { return new LongObjectId( result.getInteger( 0, 0 ) ); } return null; }
Example 4
Source File: KettleDatabaseRepositoryConnectionDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public synchronized LongObjectId getIDWithValue( String tablename, String idfield, String lookupfield, String value ) throws KettleException { RowMetaAndData par = new RowMetaAndData(); par.addValue( new ValueMetaString( "value" ), value ); RowMetaAndData result = getOneRow( "SELECT " + idfield + " FROM " + tablename + " WHERE " + lookupfield + " = ?", par.getRowMeta(), par .getData() ); if ( result != null && result.getRowMeta() != null && result.getData() != null && result.isNumeric( 0 ) ) { return new LongObjectId( result.getInteger( 0, 0 ) ); } return null; }
Example 5
Source File: KettleDatabaseRepositoryConditionDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public synchronized ObjectId lookupValue( String name, String type, String value_str, boolean isnull ) throws KettleException { RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_VALUE_NAME ), name ); table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_VALUE_VALUE_TYPE ), type ); table .addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_VALUE_VALUE_STR ), value_str ); table.addValue( new ValueMetaBoolean( KettleDatabaseRepository.FIELD_VALUE_IS_NULL ), Boolean .valueOf( isnull ) ); String sql = "SELECT " + quote( KettleDatabaseRepository.FIELD_VALUE_ID_VALUE ) + " FROM " + quoteTable( KettleDatabaseRepository.TABLE_R_VALUE ) + " "; sql += "WHERE " + quote( KettleDatabaseRepository.FIELD_VALUE_NAME ) + " = ? "; sql += "AND " + quote( KettleDatabaseRepository.FIELD_VALUE_VALUE_TYPE ) + " = ? "; sql += "AND " + quote( KettleDatabaseRepository.FIELD_VALUE_VALUE_STR ) + " = ? "; sql += "AND " + quote( KettleDatabaseRepository.FIELD_VALUE_IS_NULL ) + " = ? "; RowMetaAndData result = repository.connectionDelegate.getOneRow( sql, table.getRowMeta(), table.getData() ); if ( result != null && result.getData() != null && result.isNumeric( 0 ) ) { return new LongObjectId( result.getInteger( 0, 0L ) ); } else { return null; } }
Example 6
Source File: KettleDatabaseRepository.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public synchronized ObjectId getRootDirectoryID() throws KettleException { RowMetaAndData result = connectionDelegate.getOneRow( "SELECT " + quote( KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY ) + " FROM " + quoteTable( KettleDatabaseRepository.TABLE_R_DIRECTORY ) + " WHERE " + quote( KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY_PARENT ) + " = 0" ); if ( result != null && result.isNumeric( 0 ) ) { return new LongObjectId( result.getInteger( 0, -1 ) ); } return null; }