Skip to content

Commit

Permalink
Support update from RID set
Browse files Browse the repository at this point in the history
eg. UPDATE [#9:0, #9:1] set foo = ‘bar’
  • Loading branch information
luigidellaquila committed Nov 29, 2015
1 parent 33e345d commit a2aa864
Show file tree
Hide file tree
Showing 5 changed files with 2,217 additions and 2,094 deletions.
22 changes: 20 additions & 2 deletions core/src/main/grammar/OrientSQL.jjt
Expand Up @@ -1215,7 +1215,8 @@ ODeleteEdgeStatement DeleteEdgeWhereStatement():
}

OUpdateEdgeStatement UpdateEdgeStatement():
{ OUpdateOperations lastOperations; }
{ OUpdateOperations lastOperations;
ORid lastRid;}
{
(
<UPDATE>
Expand All @@ -1229,6 +1230,14 @@ OUpdateEdgeStatement UpdateEdgeStatement():
|
jjtThis.targetIndex = IndexIdentifier()
|
(
<LBRACKET> {jjtThis.targetRids = new ArrayList<ORid>();}
lastRid = Rid() { jjtThis.targetRids.add(lastRid); }
(
<COMMA> lastRid = Rid() { jjtThis.targetRids.add(lastRid); }
)* <RBRACKET>
)
|
(
<LPAREN>
jjtThis.targetQuery = QueryStatement()
Expand All @@ -1253,7 +1262,8 @@ OUpdateEdgeStatement UpdateEdgeStatement():
}

OUpdateStatement UpdateStatement():
{ OUpdateOperations lastOperations; }
{ OUpdateOperations lastOperations;
ORid lastRid;}
{
(
<UPDATE>
Expand All @@ -1266,6 +1276,14 @@ OUpdateStatement UpdateStatement():
|
jjtThis.targetIndex = IndexIdentifier()
|
(
<LBRACKET> {jjtThis.targetRids = new ArrayList<ORid>();}
lastRid = Rid() { jjtThis.targetRids.add(lastRid); }
(
<COMMA> lastRid = Rid() { jjtThis.targetRids.add(lastRid); }
)* <RBRACKET>
)
|
(
<LPAREN>
jjtThis.targetQuery = QueryStatement()
Expand Down
Expand Up @@ -8,6 +8,7 @@

public class OUpdateStatement extends OStatement {
protected ORid targetRid;
protected List<ORid> targetRids;
protected OIdentifier targetClass;
protected OCluster targetCluster;
protected OIndexIdentifier targetIndex;
Expand Down Expand Up @@ -40,6 +41,15 @@ public void toString(Map<Object, Object> params, StringBuilder builder) {
builder.append(getStatementType());
if (targetRid != null) {
targetRid.toString(params, builder);
}else if (targetRids != null) {
builder.append("[");
for(int i=0;i< targetRids.size();i++){
if(i>0){
builder.append(", ");
}
builder.append(targetRids.get(i));
}
builder.append("]");
} else if (targetClass != null) {
targetClass.toString(params, builder);
} else if (targetCluster != null) {
Expand Down

0 comments on commit a2aa864

Please sign in to comment.