![JAR search and dependency download from the Maven repository](/logo.png)
net.sf.jsqlparser.statement.select.Pivot Maven / Gradle / Ivy
The newest version!
/*
* #%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
* .
* #L%
*/
package net.sf.jsqlparser.statement.select;
import net.sf.jsqlparser.schema.Column;
import java.util.List;
import net.sf.jsqlparser.expression.Alias;
public class Pivot {
private List functionItems;
private List forColumns;
private List singleInItems;
private List multiInItems;
private Alias alias;
public void accept(PivotVisitor pivotVisitor) {
pivotVisitor.visit(this);
}
public List getSingleInItems() {
return singleInItems;
}
public void setSingleInItems(List singleInItems) {
this.singleInItems = singleInItems;
}
public List getMultiInItems() {
return multiInItems;
}
public void setMultiInItems(List multiInItems) {
this.multiInItems = multiInItems;
}
public List getFunctionItems() {
return functionItems;
}
public void setFunctionItems(List functionItems) {
this.functionItems = functionItems;
}
public List getForColumns() {
return forColumns;
}
public void setForColumns(List forColumns) {
this.forColumns = forColumns;
}
public List> getInItems() {
return singleInItems == null ? multiInItems : singleInItems;
}
public Alias getAlias() {
return alias;
}
public void setAlias(Alias alias) {
this.alias = alias;
}
@Override
public String toString() {
return "PIVOT ("
+ PlainSelect.getStringList(functionItems)
+ " FOR " + PlainSelect.
getStringList(forColumns, true, forColumns != null && forColumns.size() > 1)
+ " IN " + PlainSelect.getStringList(getInItems(), true, true) + ")"
+ (alias!=null?alias.toString():"");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy