Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*******************************************************************************
* Copyright 2013 Francesco Cina'
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.jporm.sql.dsl.query.select;
import java.util.ArrayList;
import java.util.List;
import com.jporm.sql.dsl.dialect.DBProfile;
import com.jporm.sql.dsl.query.ASql;
import com.jporm.sql.dsl.query.select.from.FromImpl;
import com.jporm.sql.dsl.query.select.groupby.GroupBy;
import com.jporm.sql.dsl.query.select.groupby.GroupByImpl;
import com.jporm.sql.dsl.query.select.orderby.OrderBy;
import com.jporm.sql.dsl.query.select.orderby.OrderByImpl;
import com.jporm.sql.dsl.query.select.where.SelectWhere;
import com.jporm.sql.dsl.query.select.where.SelectWhereImpl;
import com.jporm.sql.dsl.query.where.WhereExpressionElement;
/**
*
* @author Francesco Cina
*
* 07/lug/2011
*/
public class SelectImpl extends ASql implements Select {
public static String[] NO_FIELDS = new String[0];
private static String SQL_EXCEPT = "\nEXCEPT \n";
private static String SQL_INTERSECT = "\nINTERSECT \n";
private static String SQL_UNION = "\nUNION \n";
private static String SQL_UNION_ALL = "\nUNION ALL \n";
private final FromImpl from;
private final SelectWhereImpl where;
private final OrderByImpl orderBy;
private final GroupByImpl groupBy;
private final List unions = new ArrayList<>();
private final List unionAlls = new ArrayList<>();
private final List intersects = new ArrayList<>();
private final List excepts = new ArrayList<>();
private final DBProfile dbProfile;
private boolean distinct = false;
private LockMode lockMode = LockMode.NO_LOCK;
private int maxRows = 0;
private int firstRow = -1;
private final String[] selectFields;
public SelectImpl(DBProfile dbProfile, final String[] selectFields, String fromTable, String fromTableAlias ) {
this.dbProfile = dbProfile;
this.selectFields = selectFields;
from = new FromImpl(this, fromTable, fromTableAlias);
where = new SelectWhereImpl(this);
orderBy = new OrderByImpl(this);
groupBy = new GroupByImpl(this);
}
@Override
public void sqlValues(final List