Skip to content

Commit

Permalink
MONDRIAN: olap4j metadata calls return only columns recognized by ola…
Browse files Browse the repository at this point in the history
…p4j (not

    all columns returned by XMLA driver); specify SOAP as response mime type.

[git-p4: depot-paths = "//open/mondrian-release/3.2/": change = 13407]
  • Loading branch information
julianhyde committed Feb 22, 2010
1 parent d5ddfb9 commit 5be2bb6
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/main/mondrian/xmla/XmlaUtil.java
Expand Up @@ -438,17 +438,26 @@ protected Connection getConnection(
new DefaultXmlaResponse(
new ByteArrayOutputStream(),
Charset.defaultCharset().name(),
null),
Enumeration.ResponseMimeType.SOAP),
rowList);
MetadataRowset result = new MetadataRowset();
final List<RowsetDefinition.Column> colDefs =
new ArrayList<RowsetDefinition.Column>();
for (RowsetDefinition.Column columnDefinition
: rowsetDefinition.columnDefinitions)
{
if (columnDefinition.type == RowsetDefinition.Type.Rowset) {
// olap4j does not support the extended columns, e.g.
// Cube.Dimensions
continue;
}
colDefs.add(columnDefinition);
}
for (Rowset.Row row : rowList) {
Object[] values =
new Object[rowsetDefinition.columnDefinitions.length];
Object[] values = new Object[colDefs.size()];
int k = -1;
for (RowsetDefinition.Column columnDefinition
: rowsetDefinition.columnDefinitions)
{
Object o = row.get(columnDefinition.name);
for (RowsetDefinition.Column colDef : colDefs) {
Object o = row.get(colDef.name);
if (o instanceof List) {
o = toString((List<String>) o);
} else if (o instanceof String[]) {
Expand All @@ -458,10 +467,8 @@ protected Connection getConnection(
}
result.rowList.add(Arrays.asList(values));
}
for (RowsetDefinition.Column columnDefinition
: rowsetDefinition.columnDefinitions)
{
String columnName = columnDefinition.name;
for (RowsetDefinition.Column colDef : colDefs) {
String columnName = colDef.name;
if (LOWERCASE_PATTERN.matcher(columnName).matches()) {
columnName = Util.camelToUpper(columnName);
}
Expand Down

0 comments on commit 5be2bb6

Please sign in to comment.