Changeset 2812


Ignore:
Timestamp:
Oct 27, 2006, 12:58:29 PM (17 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #414: Experiment explorer not working in Postgres

Location:
trunk/src/core/net/sf/basedb/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/ItemContext.java

    r2754 r2812  
    10541054    if (sortProperties != null)
    10551055    {
     1056      boolean selectSortProperties =
     1057        query.isDistinct() && HibernateUtil.getDbEngine().selectOrderByColumnsIfDistinct();
     1058      int sortIndex = 0;
    10561059      String[] sp = sortProperties.split(",");
    10571060      for (String sortProperty : sp)
     
    10611064        {
    10621065          query.order(SortDirection.ASC == getSortDirection() ? Orders.asc(sortby) : Orders.desc(sortby));
     1066          if (selectionList == null || !selectionList.contains(sortProperty))
     1067          {
     1068            // We must add the sort property to the selection list
     1069            query.select(Selects.expression(sortby, "sorted" + sortIndex));
     1070          }
    10631071        }
     1072        sortIndex++;
    10641073      }
    10651074    }
  • trunk/src/core/net/sf/basedb/core/dbengine/AbstractDbEngine.java

    r2804 r2812  
    9393  }
    9494  /**
     95    Returns FALSE.
     96  */
     97  public boolean selectOrderByColumnsIfDistinct()
     98  {
     99    return false;
     100  }
     101
     102  /**
    95103    Return <code>LN(&lt;value&gt;)</code>.
    96104  */
  • trunk/src/core/net/sf/basedb/core/dbengine/DbEngine.java

    r2804 r2812  
    179179 
    180180  /**
     181    If the database requires that columns appearing in the
     182    ORDER BY part of the query must also be part of the SELECT
     183    list when using the DISTINCT keyword.
     184    @return TRUE if order by columns must be selected, FALSE otherwise
     185  */
     186  public boolean selectOrderByColumnsIfDistinct();
     187 
     188  /**
    181189    If we need to check for invalid arguments to numerical
    182190    functions to avoid exceptions from the database. Postgres,
  • trunk/src/core/net/sf/basedb/core/dbengine/PostgresDbEngine.java

    r2804 r2812  
    186186    return true;
    187187  }
     188  /**
     189    Returns TRUE.
     190  */
     191  public boolean selectOrderByColumnsIfDistinct()
     192  {
     193    return true;
     194  }
    188195  // -------------------------------------------
    189196 
Note: See TracChangeset for help on using the changeset viewer.