-
-
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.
- Loading branch information
Showing
24 changed files
with
606 additions
and
54 deletions.
There are no files selected for viewing
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
91 changes: 91 additions & 0 deletions
91
src/main/java/net/sf/jsqlparser/expression/operators/relational/NamedExpressionList.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,91 @@ | ||
/* | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2013 JSQLParser | ||
* %% | ||
* This program 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 program 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 General Lesser Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Lesser Public | ||
* License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.expression.operators.relational; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import net.sf.jsqlparser.expression.Expression; | ||
|
||
/** | ||
* A list of named expressions, as in | ||
* as in select substr('xyzzy' from 2 for 3) | ||
*/ | ||
public class NamedExpressionList implements ItemsList { | ||
|
||
private List<Expression> expressions; | ||
private List<String> names; | ||
|
||
public NamedExpressionList() { | ||
} | ||
|
||
public NamedExpressionList(List<Expression> expressions) { | ||
this.expressions = expressions; | ||
} | ||
|
||
public NamedExpressionList(Expression ... expressions) { | ||
this.expressions = Arrays.asList(expressions); | ||
} | ||
|
||
public List<Expression> getExpressions() { | ||
return expressions; | ||
} | ||
|
||
public List<String> getNames() { | ||
return names; | ||
} | ||
|
||
|
||
public void setExpressions(List<Expression> list) { | ||
expressions = list; | ||
} | ||
|
||
public void setNames(List<String> list) { | ||
names = list; | ||
} | ||
|
||
|
||
@Override | ||
public void accept(ItemsListVisitor itemsListVisitor) { | ||
itemsListVisitor.visit(this); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
|
||
StringBuilder ret = new StringBuilder(); | ||
ret.append("("); | ||
for(int i=0; i<expressions.size(); i++){ | ||
if(i>0){ | ||
ret.append(" "); | ||
} | ||
if(! names.get(i).equals("")){ | ||
ret.append(names.get(i)).append(" ").append(expressions.get(i)); | ||
}else{ | ||
ret.append(expressions.get(i)); | ||
} | ||
} | ||
ret.append(")"); | ||
|
||
return ret.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
76 changes: 76 additions & 0 deletions
76
src/main/java/net/sf/jsqlparser/statement/comment/Comment.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,76 @@ | ||
/* | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2017 JSQLParser | ||
* %% | ||
* This program 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 program 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 General Lesser Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Lesser Public | ||
* License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.statement.comment; | ||
|
||
import net.sf.jsqlparser.expression.StringValue; | ||
import net.sf.jsqlparser.schema.Column; | ||
import net.sf.jsqlparser.schema.Table; | ||
import net.sf.jsqlparser.statement.Statement; | ||
import net.sf.jsqlparser.statement.StatementVisitor; | ||
|
||
public class Comment implements Statement { | ||
|
||
private Table table; | ||
private Column column; | ||
private StringValue comment; | ||
|
||
@Override | ||
public void accept(StatementVisitor statementVisitor) { | ||
statementVisitor.visit(this); | ||
} | ||
|
||
public Table getTable() { | ||
return table; | ||
} | ||
|
||
public void setTable(Table table) { | ||
this.table = table; | ||
} | ||
|
||
public Column getColumn() { | ||
return column; | ||
} | ||
|
||
public void setColumn(Column column) { | ||
this.column = column; | ||
} | ||
|
||
public StringValue getComment() { | ||
return comment; | ||
} | ||
|
||
public void setComment(StringValue comment) { | ||
this.comment = comment; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String sql = "COMMENT ON "; | ||
if (table != null) { | ||
sql += "TABLE " + table + " "; | ||
} else if (column != null) { | ||
sql += "COLUMN " + column + " "; | ||
} | ||
sql += "IS " + comment; | ||
return sql; | ||
} | ||
} |
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
Oops, something went wrong.