use of org.pentaho.commons.connection.IPentahoMetaData in project pentaho-platform by pentaho.
the class FilterDefinition method populate.
public boolean populate(final Map parameterProviders, final String[] value) {
// TODO apply session-based security
// TODO support static lists of values
defaultValue = value;
resultSet = getResultSet(parameterProviders);
if (resultSet != null) {
// find the column that we have been told to you
IPentahoMetaData metaData = resultSet.getMetaData();
nameColumnNo = metaData.getColumnIndex(descriptionItem);
valueColumnNo = metaData.getColumnIndex(valueItem);
}
return (resultSet != null);
}
use of org.pentaho.commons.connection.IPentahoMetaData in project pentaho-platform by pentaho.
the class HQLResultSet method memoryCopy.
public IPentahoResultSet memoryCopy() {
try {
IPentahoMetaData localMetadata = getMetaData();
Object[][] columnHeaders = localMetadata.getColumnHeaders();
MemoryMetaData cachedMetaData = new MemoryMetaData(columnHeaders, null);
MemoryResultSet cachedResultSet = new MemoryResultSet(cachedMetaData);
Object[] rowObjects = next();
while (rowObjects != null) {
cachedResultSet.addRow(rowObjects);
rowObjects = next();
}
return cachedResultSet;
} finally {
close();
}
}
use of org.pentaho.commons.connection.IPentahoMetaData in project pentaho-platform by pentaho.
the class MDXResultSet method memoryCopy.
public IPentahoResultSet memoryCopy() {
try {
IPentahoMetaData metadata = getMetaData();
Object[][] columnHeaders = metadata.getColumnHeaders();
Object[][] rowHeaders = metadata.getRowHeaders();
MemoryMetaData cachedMetaData = new MemoryMetaData(columnHeaders, rowHeaders);
MemoryResultSet cachedResultSet = new MemoryResultSet(cachedMetaData);
Object[] rowObjects = next();
while (rowObjects != null) {
cachedResultSet.addRow(rowObjects);
rowObjects = next();
}
return cachedResultSet;
} finally {
close();
}
}
use of org.pentaho.commons.connection.IPentahoMetaData in project pentaho-platform by pentaho.
the class XQResultSet method memoryCopy.
public IPentahoResultSet memoryCopy() {
try {
IPentahoMetaData metadata = getMetaData();
Object[][] columnHeaders = metadata.getColumnHeaders();
MemoryMetaData cachedMetaData = new MemoryMetaData(columnHeaders, null);
// set column types of cachedMetaData
String[] columnTypeClones = new String[columnTypes.length];
System.arraycopy(columnTypes, 0, columnTypeClones, 0, columnTypes.length);
cachedMetaData.setColumnTypes(columnTypeClones);
MemoryResultSet cachedResultSet = new MemoryResultSet(cachedMetaData);
Object[] rowObjects = next();
while (rowObjects != null) {
cachedResultSet.addRow(rowObjects);
rowObjects = next();
}
return cachedResultSet;
} finally {
close();
}
}
use of org.pentaho.commons.connection.IPentahoMetaData in project pentaho-platform by pentaho.
the class SQLResultSetTest method testMemoryCopy_setMetadaMemory.
@Test
public void testMemoryCopy_setMetadaMemory() throws SQLException {
IPentahoMetaData metadata = new MemoryMetaData(mock(MemoryMetaData.class));
SQLResultSet resultSet = new SQLResultSet(nativeResultSet, nativeConnection);
resultSet.setMetaData(metadata);
IPentahoResultSet memoryCopyResultSet = resultSet.memoryCopy();
assertEquals(metadata.getClass(), memoryCopyResultSet.getMetaData().getClass());
}
Aggregations