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

jaskell.sql.Union Maven / Gradle / Ivy

Go to download

This is a utils library for java 8 project. It include parsec combinators and sql generators library.

There is a newer version: 2.9.2
Show newest version
package jaskell.sql;

import jaskell.script.Directive;
import jaskell.script.Parameter;

import java.util.List;

public class Union extends Query implements ThenSelect {
  Directive _prefix;
  Directive _query;

  public Union() {
  }

  public Union(Query query) {
    this._query = query;
  }

  public All all(Query query) {
    All re = new All();
    re._prefix = this._prefix;
    re._query = query;
    return re;
  }

  @Override
  public String script() {
    if (_query == null) {
      return String.format("%s UNION", _prefix.script());
    } else {
      return String.format("%s UNION %s", _prefix.script(), _query.script());
    }
  }

  @Override
  public List> parameters() {
    List> re = _prefix.parameters();
    re.addAll(_query.parameters());
    return re;
  }

  public static class All extends Union implements ThenSelect {
    @Override
    public String script() {
      return String.format("%s UNION ALL %s", _prefix.script(), _query.script());
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy