Skip to content

Commit 1fb426e

Browse files
committed
1 parent 8d8c0e4 commit 1fb426e

File tree

2 files changed

+71
-6
lines changed

2 files changed

+71
-6
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* #%L
3+
* JSQLParser library
4+
* %%
5+
* Copyright (C) 2004 - 2015 JSQLParser
6+
* %%
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Lesser General Public License as
9+
* published by the Free Software Foundation, either version 2.1 of the
10+
* License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Lesser Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Lesser Public
18+
* License along with this program. If not, see
19+
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
20+
* #L%
21+
*/
22+
/*
23+
* Copyright (C) 2015 JSQLParser.
24+
*
25+
* This library is free software; you can redistribute it and/or
26+
* modify it under the terms of the GNU Lesser General Public
27+
* License as published by the Free Software Foundation; either
28+
* version 2.1 of the License, or (at your option) any later version.
29+
*
30+
* This library is distributed in the hope that it will be useful,
31+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
32+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33+
* Lesser General Public License for more details.
34+
*
35+
* You should have received a copy of the GNU Lesser General Public
36+
* License along with this library; if not, write to the Free Software
37+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
38+
* MA 02110-1301 USA
39+
*/
40+
package net.sf.jsqlparser.statement.merge;
41+
42+
/**
43+
*
44+
* @author toben
45+
*/
46+
public class MergeUpdate {
47+
48+
}

src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -542,17 +542,34 @@ Statement Merge() : {
542542

543543
{ return merge; }
544544
}
545-
546-
void MergeUpdateClause() : {}
545+
546+
MergeUpdate MergeUpdateClause() : {
547+
MergeUpdate mu = new MergeUpdate();
548+
List<Column> columns = new ArrayList<Column>();
549+
List<Expression> expList = new ArrayList<Expression>();
550+
Columns col;
551+
Expression exp;
552+
Expression condition;
553+
}
547554
{
548555
<K_WHEN> <K_MATCHED> <K_THEN> <K_UPDATE>
549556
<K_SET>
550-
Column() "=" SimpleExpression() ("," Column() "=" SimpleExpression() )*
551-
[ <K_WHERE> Condition() ]
552-
[ <K_DELETE> <K_WHERE> Condition() ]
557+
col = Column() "=" exp = SimpleExpression()
558+
{ columns.add(col); expList.add(exp); }
559+
("," col = Column() "=" exp = SimpleExpression() { columns.add(col); expList.add(exp); } )*
560+
561+
{ mu.setColumns(columns); mu.setExpressions(expList); }
562+
563+
[ <K_WHERE> condition = Condition() { mu.setWhereCondition(condition); }]
564+
[ <K_DELETE> <K_WHERE> condition = Condition() { mu.setDeleteWhereCondition(condition); } ]
565+
566+
{ return mu; }
553567
}
554568

555-
void MergeInsertClause() : {}
569+
void MergeInsertClause() : {
570+
List<Column> columns = new ArrayList<Column>();
571+
List<Expression> expList = new ArrayList<Expression>();
572+
}
556573
{
557574
<K_WHEN> <K_NOT> <K_MATCHED> <K_THEN>
558575
<K_INSERT> "(" Column() ("," Column() )* ")" <K_VALUES>

0 commit comments

Comments
 (0)