-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multi value expression for insert included
- Loading branch information
Showing
8 changed files
with
182 additions
and
48 deletions.
There are no files selected for viewing
64 changes: 33 additions & 31 deletions
64
src/main/java/net/sf/jsqlparser/expression/operators/relational/ItemsListVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
/* ================================================================ | ||
* JSQLParser : java based sql parser | ||
* ================================================================ | ||
* | ||
* Project Info: http://jsqlparser.sourceforge.net | ||
* Project Lead: Leonardo Francalanci (leoonardoo@yahoo.it); | ||
* | ||
* (C) Copyright 2004, by Leonardo Francalanci | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under the terms | ||
* of the GNU Lesser General Public License as published by the Free Software Foundation; | ||
* either version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License along with this | ||
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
* Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
package net.sf.jsqlparser.expression.operators.relational; | ||
|
||
import net.sf.jsqlparser.statement.select.SubSelect; | ||
|
||
public interface ItemsListVisitor { | ||
public void visit(SubSelect subSelect); | ||
|
||
public void visit(ExpressionList expressionList); | ||
} | ||
/* ================================================================ | ||
* JSQLParser : java based sql parser | ||
* ================================================================ | ||
* | ||
* Project Info: http://jsqlparser.sourceforge.net | ||
* Project Lead: Leonardo Francalanci (leoonardoo@yahoo.it); | ||
* | ||
* (C) Copyright 2004, by Leonardo Francalanci | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under the terms | ||
* of the GNU Lesser General Public License as published by the Free Software Foundation; | ||
* either version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License along with this | ||
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
* Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
package net.sf.jsqlparser.expression.operators.relational; | ||
|
||
import net.sf.jsqlparser.statement.select.SubSelect; | ||
|
||
public interface ItemsListVisitor { | ||
public void visit(SubSelect subSelect); | ||
|
||
public void visit(ExpressionList expressionList); | ||
|
||
public void visit(MultiExpressionList multiExprList); | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/net/sf/jsqlparser/expression/operators/relational/MultiExpressionList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2013 toben. | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301 USA | ||
*/ | ||
package net.sf.jsqlparser.expression.operators.relational; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
/** | ||
* A list of ExpressionList items. e.g. multi values of insert statements. This one allows | ||
* only equally sized ExpressionList. | ||
* @author toben | ||
*/ | ||
public class MultiExpressionList implements ItemsList { | ||
|
||
List<ExpressionList> exprList; | ||
|
||
public MultiExpressionList() { | ||
this.exprList = new ArrayList<ExpressionList>(); | ||
} | ||
|
||
@Override | ||
public void accept(ItemsListVisitor itemsListVisitor) { | ||
itemsListVisitor.visit(this); | ||
} | ||
|
||
public List<ExpressionList> getExprList() { | ||
return exprList; | ||
} | ||
|
||
public void addExpressionList(ExpressionList el) { | ||
if (!exprList.isEmpty()) { | ||
if (exprList.get(0).getExpressions().size() != el.getExpressions().size()) { | ||
throw new IllegalArgumentException("different count of parameters"); | ||
} | ||
} | ||
exprList.add(el); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder b = new StringBuilder(); | ||
for (Iterator<ExpressionList> it = exprList.iterator(); it.hasNext() ;) { | ||
b.append(it.next().toString()); | ||
if (it.hasNext()) b.append(", "); | ||
} | ||
return b.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters