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

br.com.objectos.way.sql.Var2SelectWhere2 Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
/*
 * 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.way.sql;

import br.com.objectos.way.db.Condition;
import br.com.objectos.way.db.ConditionOperand;
import br.com.objectos.way.db.Dialect;
import br.com.objectos.way.db.Order;
import br.com.objectos.way.db.Orderable;
import br.com.objectos.way.db.ParameterBinder;
import br.com.objectos.way.db.SelectBuilder;
import br.com.objectos.way.db.Selectable;
import br.com.objectos.way.db.StringTypeColumn;

/**
 * @author [email protected] (Marcio Endo)
 */
public class Var2SelectWhere2
    extends SelectNode>
    implements VarSelectWhere, Var2> {

  private final Keyword keyword;
  private final Condition condition;

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

  @Override
  public  VarSelectWhereMore, ?> and(X column) {
    throw new UnsupportedOperationException();
  }

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

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

  @Override
  public Var2SelectOrderBy2 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 Var2SelectOrderBy2 orderBy0(Order... columns) {
    return new Var2SelectOrderBy2<>(this, columns);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy