lib/compiler.js
function _columns() {
    var distinct = false;
    if (this.onlyUnions()) {
      return '';
    }
    var columns = this.grouped.columns || [];
    var i = -1,
        sql = [];
    if (columns) {
      while (++i < columns.length) {
        var stmt = columns[i];
        if (stmt.distinct) {
          distinct = true;
        }
        if (stmt.type === 'aggregate') {
          sql.push(this.aggregate(stmt));
        } else if (stmt.value && stmt.value.length > 0) {
          sql.push(this.formatter.columnize(stmt.value));
        }
      }
    }
    if (sql.length === 0) {
      sql = ['*'];
    }
    return 'select ' + (distinct ? 'distinct ' : '') + sql.join(', ') + (this.tableName ? ' from ' + this.tableName : '');
  }
function _columns() {
    var distinct = false;
    if (this.onlyUnions()) {
      return '';
    }
    var columns = this.grouped.columns || [];
    var i = -1,
        sql = [];
    if (columns) {
      while (++i < columns.length) {
        var stmt = columns[i];
        if (stmt.distinct) {
          distinct = true;
        }
        if (stmt.type === 'aggregate') {
          sql.push(this.aggregate(stmt));
        } else if (stmt.value && stmt.value.length > 0) {
          sql.push(this.formatter.columnize(stmt.value));
        }
      }
    }
    if (sql.length === 0) {
      sql = ['*'];
    }
    return 'select ' + (distinct ? 'distinct ' : '') + sql.join(', ') + (this.tableName ? ' from ' + this.tableName : '');
  }
function _columns ( ) { var distinct = false ; if ( this . onlyUnions ( ) ) { return '' ; } var columns = this . grouped . columns || [ ] ; var i = - 1 , sql = [ ] ; if ( columns ) { while ( ++ i < columns . length ) { var stmt = columns [ i ] ; if ( stmt . distinct ) { distinct = true ; } if ( stmt . type === 'aggregate' ) { sql . push ( this . aggregate ( stmt ) ) ; } else if ( stmt . value && stmt . value . length > 0 ) { sql . push ( this . formatter . columnize ( stmt . value ) ) ; } } } if ( sql . length === 0 ) { sql = [ '*' ] ; } return 'select ' + ( distinct ? 'distinct ' : '' ) + sql . join ( ', ' ) + ( this . tableName ? ' from ' + this . tableName : '' ) ; }
Compiles the columns in the query, specifying if an item was distinct.
Compiles the columns in the query specifying if an item was distinct .