br.com.objectos.sql.SimpleSelectWhere2 Maven / Gradle / Ivy
/*
* Copyright 2014-2015 Objectos, Fábrica de Software LTDA.
*
* 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 br.com.objectos.sql;
import br.com.objectos.db.Condition;
import br.com.objectos.db.Dialect;
import br.com.objectos.db.IntTypeColumn;
import br.com.objectos.db.LocalDateTypeColumn;
import br.com.objectos.db.Order;
import br.com.objectos.db.Orderable;
import br.com.objectos.db.ParameterBinder;
import br.com.objectos.db.SelectBuilder;
import br.com.objectos.db.Selectable;
import br.com.objectos.db.StringTypeColumn;
/**
* @author [email protected] (Marcio Endo)
*/
public class SimpleSelectWhere2
extends SelectNode>
implements SimpleSelectWhere> {
private final Condition condition;
SimpleSelectWhere2(SelectNode> previous, Condition condition) {
super(previous);
this.condition = condition;
}
@Override
public SimpleSelectWhere2Int and(X column) {
return new SimpleSelectWhere2Int<>(this, Keyword.AND, column);
}
@Override
public SimpleSelectWhere2LocalDate and(X column) {
return new SimpleSelectWhere2LocalDate<>(this, Keyword.AND, column);
}
@Override
public SimpleSelectWhere2String and(X column) {
return new SimpleSelectWhere2String<>(this, Keyword.AND, column);
}
@Override
public SimpleSelectQuery2 compile(Dialect dialect) {
return new SimpleSelectQuery2<>(dialect, this);
}
@Override
public SimpleSelectOrderBy2 orderBy(Orderable o1) {
return orderBy(o1.asc());
}
@Override
public SimpleSelectOrderBy2 orderBy(Order o1) {
return orderBy0(o1);
}
@Override
ParameterBinder bind0(ParameterBinder binder) {
condition.bind(binder);
return binder;
}
@Override
SelectBuilder write0(SelectBuilder sql) {
return sql.where(condition);
}
private SimpleSelectOrderBy2 orderBy0(Order... columns) {
return new SimpleSelectOrderBy2<>(this, columns);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy