Skip to content

Commit

Permalink
cleanup xmla driver, verify additional connection properties against …
Browse files Browse the repository at this point in the history
…DISCOVER_PROPERTIES

git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@505 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
pstoellberger committed Feb 16, 2012
1 parent 047ad63 commit 1e15147
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ abstract class XmlaOlap4jConnection implements OlapConnection {

private final URL serverUrlObject;

private HashSet<String> olap4jDatabaseProperties;

/**
* This is a private property used for development only.
* Enabling it makes the connection print out all queries
Expand Down Expand Up @@ -255,6 +257,22 @@ public void setSessionId(String sessionId) {
null, null, null, null, null, null),
new XmlaOlap4jConnection.DatabaseHandler(),
null);

this.olap4jDatabaseProperties = new HashSet<String>();
final ResultSet rs =
this.olap4jDatabaseMetaData.getDatabaseProperties(null, null);
try {
while (rs.next()) {
String property =
rs.getString(XmlaConstants.Literal.PROPERTY_NAME.name());
if (property != null) {
property = property.toUpperCase();
olap4jDatabaseProperties.add(property);
}
}
} finally {
rs.close();
}
}

/**
Expand Down Expand Up @@ -326,13 +344,15 @@ String makeConnectionPropertyList() {
XmlaOlap4jDriver.Property.valueOf(prop);
continue;
} catch (IllegalArgumentException e) {
buf.append(" <");
xmlEncode(buf, prop);
buf.append(">");
xmlEncode(buf, databaseProperties.get(prop));
buf.append("</");
xmlEncode(buf, prop);
buf.append(">\n");
if (olap4jDatabaseProperties.contains(prop)) {
buf.append(" <");
xmlEncode(buf, prop);
buf.append(">");
xmlEncode(buf, databaseProperties.get(prop));
buf.append("</");
xmlEncode(buf, prop);
buf.append(">\n");
}
}
}
return buf.toString();
Expand Down

0 comments on commit 1e15147

Please sign in to comment.