Exemple #1
0
  final FieldList getSelect1() {
    if (getSelect0().isEmpty()) {
      FieldList result = new SelectFieldList();

      // [#109] [#489]: SELECT * is only applied when at least one table
      // from the table source is "unknown", i.e. not generated from a
      // physical table. Otherwise, the fields are selected explicitly
      if (knownTableSource()) {
        for (TableLike<?> table : getFrom()) {
          for (Field<?> field : table.asTable().fields()) {
            result.add(field);
          }
        }
      }

      // The default is SELECT 1, when projections and table sources are
      // both empty
      if (getFrom().isEmpty()) {
        result.add(one());
      }

      return result;
    }

    return getSelect0();
  }
Exemple #2
0
  SelectQueryImpl(Configuration configuration, TableLike<? extends R> from, boolean distinct) {
    super(configuration);

    this.distinct = distinct;
    this.select = new SelectFieldList();
    this.from = new TableList();
    this.condition = new ConditionProviderImpl();
    this.connectBy = new ConditionProviderImpl();
    this.connectByStartWith = new ConditionProviderImpl();
    this.groupBy = new QueryPartList<GroupField>();
    this.having = new ConditionProviderImpl();
    this.orderBy = new SortFieldList();
    this.limit = new Limit();

    if (from != null) {
      this.from.add(from.asTable());
    }

    this.forUpdateOf = new FieldList();
    this.forUpdateOfTables = new TableList();
  }
Exemple #3
0
 @Override
 public final void addFrom(Collection<? extends TableLike<?>> f) {
   for (TableLike<?> provider : f) {
     getFrom().add(provider.asTable());
   }
 }