Exemple #1
0
        public IDetachedQuery TransformToRowCount()
        {
            Select s = new Select("count(*)");

            s.SetFrom(from.FromWhereClause());
            DetachedQuery result = new DetachedQuery(s.Clause);

            result.CopyParametersFrom(this);
            return(result);
        }
 protected override IDetachedQuery GetDetachedQuery()
 {
     if (origin != null)
     {
         var result = new DetachedQuery("select count(*) " + origin.Hql);
         result.CopyParametersFrom(origin);
         return(result);
     }
     return(detachedQuery);
 }
        protected override IDetachedQuery GetRowCountQuery()
        {
            if (!detachedQuery.Hql.StartsWith("from", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new HibernateException(string.Format("Can't trasform the HQL to it's counter, the query must start with 'from' clause:{0}", detachedQuery.Hql));
            }
            var result = new DetachedQuery("select count(*) " + detachedQuery.Hql);

            result.CopyParametersFrom(detachedQuery);
            return(result);
        }