Yes, thank you.
I think this code should be applied to trunk
(NHibernate.Dialect.MsSql2005Dialect):
                public override SqlString GetLimitString(SqlString 
querySqlString,
int offset, int last)
                {


                                if (offset==0)
                                {
                                        return querySqlString.Insert
(GetAfterSelectInsertPoint(querySqlString), " top " + last);
                        }

                        // we have to do this in order to support parameters in 
order
clause, the foramt
                        // that sql 2005 uses for paging means that we move the 
parameters
around, which means,
                        // that positions are lost, so we record them before 
making any
changes.
                        //  NH-1528
                        int parameterPositon = 0;
                        foreach (var part in querySqlString.Parts)
                        {
                                Parameter param = part as Parameter;
                                if (param == null)
                                        continue;
                                param.OriginalPositionInQuery = 
parameterPositon;
                                parameterPositon += 1;
                        }

                        int fromIndex = .... etc.

Method GetAfterSelectInsertPoint in
NHibernate.Dialect.MsSql2000Dialect, should be not static protected or
static internal.


On 31 янв, 14:40, Tuna Toksoz <[email protected]> wrote:
> It is not possible. I guess you can write your own dialect, possibly
> inheriting from 2005 dialect.
>
> override GetLimitString and there you go.
>
> Tuna Toksözhttp://tunatoksoz.comhttp://twitter.com/tehlike
>
> Typos included to enhance the readers attention!
>
>
>
> On Sat, Jan 31, 2009 at 1:37 PM, letov <[email protected]> wrote:
> > Is it possible to work with the two dialects in one session factory
> > and to choose the appropriate to query(session)?  As I understand it
> > is not possible.
> > Maybe there are some workarouds other than using  sql native queries
> > (named)?
>
> > On 31 янв, 04:00, Ayende Rahien <[email protected]> wrote:
> > > Use the Sql 2000 dialect
>
> > > On Fri, Jan 30, 2009 at 4:39 PM, letov <[email protected]> wrote:
>
> > > > My sample code:
>
> > > >            var freeTicket1 = (from ticket in Session.Linq<Ticket>()
> > > > where ticket.IsFree select ticket).FirstOrDefault();
> > > >            var freeTicket2 = (Ticket)Session.CreateQuery("from Ticket
> > > > ticket where ticket.IsFree=1").SetMaxResults(1).UniqueResult();
> > > >            var freeTicket3 = (Ticket)Session.CreateCriteria(typeof
> > > > (Ticket)).Add(Restrictions.Eq("IsFree", true)).SetMaxResults
> > > > (1).UniqueResult();
> > > >            return freeTicket1 ?? freeTicket2 ?? freeTicket3;
>
> > > > SQL for all queries:
>
> > > > SELECT   TOP 1 PK1_2_0_,
> > > >               DT2_2_0_,
> > > >               BLN3_2_0_
> > > > FROM
> > > >         (
> > > >            SELECT ROW_NUMBER ( ) OVER ( ORDER BY
> > > > __hibernate_sort_expr_0__ ) as
> > > >                     row,
> > > >                   query.PK1_2_0_,
> > > >                   query.DT2_2_0_,
> > > >                   query.BLN3_2_0_,
> > > >                   query.__hibernate_sort_expr_0__
> > > >            FROM
> > > >                   (
> > > >                      SELECT this_.PK_TICKET   as PK1_2_0_,
> > > >                             this_.DT_CAPTURE  as DT2_2_0_,
> > > >                             this_.BLN_FREE    as BLN3_2_0_,
> > > >                             CURRENT_TIMESTAMP as
> > > > __hibernate_sort_expr_0__
> > > >                      FROM   COMMON.TBL_TICKET this_
> > > >                      WHERE  this_.BLN_FREE = 1 /* @p0 */
> > > >                   ) query
> > > >         ) page
> > > > WHERE    page.row > 0
> > > > ORDER BY __hibernate_sort_expr_0__
>
> > > > On 30 янв, 23:35, Tuna Toksoz <[email protected]> wrote:
> > > > > .SetMaxResult() ?
>
> > > > > Tuna Toksözhttp://tunatoksoz.comhttp://twitter.com/tehlike
>
> > > > > Typos included to enhance the readers attention!
>
> > > > > On Fri, Jan 30, 2009 at 10:22 PM, letov <[email protected]> wrote:
>
> > > > > > Hello everyone.
> > > > > > Is there a way to get pure "SELECT TOP" on sql server 2005, using
> > hql
> > > > > > or criteria api or nhibernate.linq?
> > > > > > Thanks.- Скрыть цитируемый текст -
>
> > > > > - Показать цитируемый текст -- Скрыть цитируемый текст -
>
> > > - Показать цитируемый текст -- Скрыть цитируемый текст -
>
> - Показать цитируемый текст -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to