Skip to content

Commit

Permalink
MONDRIAN: improved ConnectStringParser, so that in a "name=value" pai…
Browse files Browse the repository at this point in the history
…r the value can contain a semicolon. This was neccessary, because SqlServer needed "...;SelectMethod=cursor". We now support

escaping the semicolon by a backslash.

[git-p4: depot-paths = "//open/mondrian/": change = 1011]
  • Loading branch information
hhaas committed Dec 9, 2003
1 parent a8ad132 commit ec1217b
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/main/mondrian/olap/Util.java
Expand Up @@ -754,16 +754,28 @@ String parseValue() {
" in '" + s + "'");
}
} else {
String value;
int semi = s.indexOf(';', i);
StringBuffer sbValue = new StringBuffer();
// a jdbc url can contain semicolons (sql server: ...;SelectMethod=cursor)
// in this case the semicolon must be escaped by a backslash
int semi;
while (true) {
semi = s.indexOf(';', i);
if (semi > 0 && s.charAt(semi -1) == '\\') {
sbValue.append(s.substring(i, semi-1));
sbValue.append(";");
i = semi +1; // the semi is escaped
} else
break;
}

if (semi >= 0) {
value = s.substring(i, semi);
sbValue.append(s.substring(i, semi));
i = semi + 1;
} else {
value = s.substring(i);
sbValue.append(s.substring(i));
i = n;
}
return value.trim();
return sbValue.toString().trim();
}
}
/**
Expand Down

0 comments on commit ec1217b

Please sign in to comment.