All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.objectos.sql.Var1SelectWhere2 Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 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.ConditionOperand;
import br.com.objectos.db.Dialect;
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 Var1SelectWhere2
    extends SelectNode>
    implements VarSelectWhere, Var1> {

  private final Keyword keyword;
  private final Condition condition;

  Var1SelectWhere2(SelectNode> previous, Keyword keyword, Condition condition) {
    super(previous);
    this.keyword = keyword;
    this.condition = condition;
  }

  @Override
  public  Var2SelectWhere2MoreString and(X2 column) {
    return new Var2SelectWhere2MoreString<>(this, Keyword.AND, column);
  }

  @Override
  public Var1SelectQuery2 compile(Dialect dialect) {
    return new Var1SelectQuery2<>(dialect, this);
  }

  @Override
  public Var1SelectOrderBy2 orderBy(Orderable o1) {
    return orderBy0(o1.asc());
  }

  @Override
  public Var1SelectOrderBy2 orderBy(Order o1) {
    return orderBy0(o1);
  }

  @Override
  ParameterBinder bind0(ParameterBinder binder) {
    condition.bind(binder);
    return binder;
  }

  @Override
  SelectBuilder write0(SelectBuilder sql) {
    return keyword.write(sql, condition);
  }

  private Var1SelectOrderBy2 orderBy0(Order... columns) {
    return new Var1SelectOrderBy2<>(this, columns);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy