/// <summary>
        /// Get the aliases of the columns constrained
        /// by this criterion (for use in ORDER BY clause).
        /// </summary>
        public string[] GetColumnAliasesUsingProjection(ICriteria subcriteria, string propertyName)
        {
            //first look for a reference to a projection alias
            IProjection projection = rootCriteria.Projection;

            string[] projectionColumns = projection == null ? null : projection.GetColumnAliases(propertyName, 0);

            if (projectionColumns == null)
            {
                //it does not refer to an alias of a projection,
                //look for a property
                try
                {
                    return(GetColumns(subcriteria, propertyName));
                }
                catch (HibernateException)
                {
                    //not found in inner query , try the outer query
                    if (outerQueryTranslator != null)
                    {
                        return(outerQueryTranslator.GetColumnAliasesUsingProjection(subcriteria, propertyName));
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            else
            {
                //it refers to an alias of a projection
                return(projectionColumns);
            }
        }
        public SqlString ToSqlString(ICriteria criteria, int loc, ICriteriaQuery criteriaQuery, IDictionary <string, IFilter> enabledFilters)
        {
            SqlStringBuilder buf = new SqlStringBuilder();

            for (int i = 0; i < Length; i++)
            {
                IProjection proj = this[i];
                buf.Add(proj.ToSqlString(criteria, loc, criteriaQuery, enabledFilters));
                loc += proj.GetColumnAliases(loc, criteria, criteriaQuery).Length;
                if (i < elements.Count - 1)
                {
                    buf.Add(", ");
                }
            }
            return(buf.ToSqlString());
        }
        /// <summary>
        /// Get the aliases of the columns constrained
        /// by this criterion (for use in ORDER BY clause).
        /// </summary>
        public string[] GetColumnAliasesUsingProjection(ICriteria subcriteria, string propertyName)
        {
            //first look for a reference to a projection alias
            IProjection projection = rootCriteria.Projection;

            string[] projectionColumns = null;

            if (projection != null)
            {
                projectionColumns = projection.GetColumnAliases(propertyName, 0, subcriteria, this);
            }

            if (projectionColumns == null)
            {
                //it does not refer to an alias of a projection,
                //look for a property
                return(GetColumnsUsingProjection(subcriteria, propertyName));
            }
            else
            {
                //it refers to an alias of a projection
                return(projectionColumns);
            }
        }
Esempio n. 4
0
 public virtual string[] GetColumnAliases(int loc)
 {
     return(projection.GetColumnAliases(loc));
 }
Esempio n. 5
0
 public string[] GetColumnAliases(int position, ICriteria criteria, ICriteriaQuery criteriaQuery)
 {
     return(projection.GetColumnAliases(position, criteria, criteriaQuery));
 }
Esempio n. 6
0
 private static string[] GetColumnAliases(string alias, int position, ICriteria criteria, ICriteriaQuery criteriaQuery, IProjection projection)
 {
     return(projection is IEnhancedProjection
                         ? ((IEnhancedProjection)projection).GetColumnAliases(alias, position, criteria, criteriaQuery)
                         : projection.GetColumnAliases(alias, position));
 }