lib/compiler.js
function _union() {
    var onlyUnions = this.onlyUnions();
    var unions = this.grouped.union;
    if (!unions) {
      return '';
    }
    var sql = '';
    for (var i = 0, l = unions.length; i < l; i++) {
      var union = unions[i];
      if (i > 0) {
        sql += ' ';
      }
      if (i > 0 || !onlyUnions) {
        sql += union.clause + ' ';
      }
      var statement = this.formatter.rawOrFn(union.value);
      if (statement) {
        if (union.wrap) {
          sql += '(';
        }
        sql += statement;
        if (union.wrap) {
          sql += ')';
        }
      }
    }
    return sql;
  }
function _union() {
    var onlyUnions = this.onlyUnions();
    var unions = this.grouped.union;
    if (!unions) {
      return '';
    }
    var sql = '';
    for (var i = 0, l = unions.length; i < l; i++) {
      var union = unions[i];
      if (i > 0) {
        sql += ' ';
      }
      if (i > 0 || !onlyUnions) {
        sql += union.clause + ' ';
      }
      var statement = this.formatter.rawOrFn(union.value);
      if (statement) {
        if (union.wrap) {
          sql += '(';
        }
        sql += statement;
        if (union.wrap) {
          sql += ')';
        }
      }
    }
    return sql;
  }
function _union ( ) { var onlyUnions = this . onlyUnions ( ) ; var unions = this . grouped . union ; if ( ! unions ) { return '' ; } var sql = '' ; for ( var i = 0 , l = unions . length ; i < l ; i ++ ) { var union = unions [ i ] ; if ( i > 0 ) { sql += ' ' ; } if ( i > 0 || ! onlyUnions ) { sql += union . clause + ' ' ; } var statement = this . formatter . rawOrFn ( union . value ) ; if ( statement ) { if ( union . wrap ) { sql += '(' ; } sql += statement ; if ( union . wrap ) { sql += ')' ; } } } return sql ; }
Compile the "union" queries attached to the main query.
Compile the union queries attached to the main query .