Changeset 7550 for branches/3.13-stable


Ignore:
Timestamp:
Dec 11, 2018, 2:18:39 PM (3 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #2140: Hql.sharedTo() generates incorrect HQL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.13-stable/src/core/net/sf/basedb/core/query/SharedToRestriction.java

    r6844 r7550  
    112112          sb.append("where " + users.toQl(query, dc));
    113113          sb.append(")");
    114           if (groups != null) sb.append(sharedTo ? " OR " : " AND ");
    115114        }
    116115        if (groups != null)
    117116        {
     117          if (users != null) sb.append(sharedTo ? " OR " : " AND ");
    118118          sb.append(root).append(".itemKey ").append(sharedTo ? "IN (" : "NOT IN (");
    119119          sb.append("select ik.id from GroupData grp JOIN grp.itemKeys ik ");
     
    125125      if (projects != null)
    126126      {
    127         if (sb.length() > 0) sb.append(sharedTo ? " OR " : " AND ");
     127        if (users != null || groups != null) sb.append(sharedTo ? " OR " : " AND ");
    128128        sb.append("(");
    129129        if (!sharedTo)
     
    176176          sb.append("where " + users.toString());
    177177          sb.append(")");
    178           if (groups != null) sb.append(sharedTo ? " OR " : " AND ");
    179178        }
    180179        if (groups != null)
    181180        {
     181          if (users != null) sb.append(sharedTo ? " OR " : " AND ");
    182182          sb.append("itemKey ").append(sharedTo ? "IN (" : "NOT IN (");
    183183          sb.append("select ik.id from GroupData grp JOIN grp.itemKeys ik ");
     
    189189      if (projects != null)
    190190      {
    191         if (sb.length() > 0) sb.append(sharedTo ? " OR " : " AND ");
     191        if (users != null || groups != null) sb.append(sharedTo ? " OR " : " AND ");
    192192        sb.append("(");
    193193        if (!sharedTo)
Note: See TracChangeset for help on using the changeset viewer.