Skip to content

Commit

Permalink
Parser and parse tree model can now handle key path expressions,
Browse files Browse the repository at this point in the history
including compound keys such as [Customers].[State].&[CA]&[USA].
Fixes bug 2782515, "Parser cannot handle &key in member names".


git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@228 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
julianhyde committed May 8, 2009
1 parent 39cd229 commit a40886c
Show file tree
Hide file tree
Showing 9 changed files with 497 additions and 187 deletions.
7 changes: 3 additions & 4 deletions src/org/olap4j/driver/xmla/XmlaOlap4jCube.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// Copyright (C) 2007-2008 Julian Hyde
// Copyright (C) 2007-2009 Julian Hyde
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/
Expand Down Expand Up @@ -52,7 +52,6 @@ class XmlaOlap4jCube implements Cube, Named
* @param olap4jSchema Schema
* @param name Name
* @param description Description
* @param connection
*/
XmlaOlap4jCube(
XmlaOlap4jSchema olap4jSchema,
Expand Down Expand Up @@ -201,7 +200,7 @@ public Member lookupMember(String... nameParts) throws OlapException {
List<IdentifierNode.Segment> segmentList =
new ArrayList<IdentifierNode.Segment>();
for (String namePart : nameParts) {
segmentList.add(new IdentifierNode.Segment(namePart));
segmentList.add(new IdentifierNode.NameSegment(namePart));
}
return lookupMember(segmentList);
}
Expand Down Expand Up @@ -247,7 +246,7 @@ public List<Member> lookupMembers(
if (buf.length() > 0) {
buf.append('.');
}
buf.append(new IdentifierNode.Segment(namePart));
buf.append(new IdentifierNode.NameSegment(namePart));
}
final String uniqueName = buf.toString();
final List<XmlaOlap4jMember> list =
Expand Down
15 changes: 11 additions & 4 deletions src/org/olap4j/mdx/DefaultMdxValidatorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// Copyright (C) 2007-2008 Julian Hyde
// Copyright (C) 2007-2009 Julian Hyde
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/
Expand Down Expand Up @@ -33,6 +33,11 @@ class DefaultMdxValidatorImpl
private Stack<Boolean> scalarStack = new Stack<Boolean>();
private final SelectNode selectNode;

/**
* Creates a DefaultMdxValidatorImpl.
*
* @param selectNode Root of parse tree
*/
protected DefaultMdxValidatorImpl(SelectNode selectNode) {
this.selectNode = selectNode;
}
Expand Down Expand Up @@ -177,10 +182,12 @@ public ParseTreeNode acceptScalar(ParseTreeNode node) {
public ParseTreeNode accept(IdentifierNode identifier) {
if (identifier.getSegmentList().size() == 1) {
final IdentifierNode.Segment s = identifier.getSegmentList().get(0);
if (s.quoting == IdentifierNode.Quoting.UNQUOTED &&
isReserved(s.name)) {
if (s.getQuoting() == IdentifierNode.Quoting.UNQUOTED
&& isReserved(s.getName()))
{
return LiteralNode.createSymbol(
s.getRegion(), s.name.toUpperCase());
s.getRegion(),
s.getName().toUpperCase());
}
}
final ParseTreeNode element =
Expand Down
Loading

0 comments on commit a40886c

Please sign in to comment.