mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql server sql parser support xml path.
This commit is contained in:
@@ -27,6 +27,7 @@ public class SQLServerSelect extends SQLSelect implements SQLServerObject {
|
||||
|
||||
private boolean forBrowse;
|
||||
private List<String> forXmlOptions = new ArrayList<String>(4);
|
||||
private SQLExpr xmlPath;
|
||||
|
||||
private SQLExpr rowCount;
|
||||
private SQLExpr offset;
|
||||
@@ -69,6 +70,17 @@ public class SQLServerSelect extends SQLSelect implements SQLServerObject {
|
||||
}
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public SQLExpr getXmlPath() {
|
||||
return xmlPath;
|
||||
}
|
||||
|
||||
public void setXmlPath(SQLExpr xmlPath) {
|
||||
if (xmlPath != null) {
|
||||
xmlPath.setParent(this);
|
||||
}
|
||||
this.xmlPath = xmlPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
+3
@@ -76,6 +76,9 @@ public class SQLServerSelectParser extends SQLSelectParser {
|
||||
} else {
|
||||
select.getForXmlOptions().add("ELEMENTS");
|
||||
}
|
||||
} else if (identifierEquals("PATH")) {
|
||||
SQLExpr xmlPath = this.exprParser.expr();
|
||||
select.setXmlPath(xmlPath);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
+6
@@ -469,6 +469,12 @@ public class SQLServerOutputVisitor extends SQLASTOutputVisitor implements SQLSe
|
||||
}
|
||||
}
|
||||
|
||||
if (x.getXmlPath() != null) {
|
||||
println();
|
||||
print0(ucase ? "FOR XML " : "for xml ");
|
||||
x.getXmlPath().accept(this);
|
||||
}
|
||||
|
||||
if (x.getOffset() != null) {
|
||||
println();
|
||||
print0(ucase ? "OFFSET " : "offset ");
|
||||
|
||||
Reference in New Issue
Block a user