I am using Nhibernate 2.1.2 with Sybase 11. Using Sybase11Dialect I get sql errors using SetMaxResults. The same code works fine with SybaseASA10Dialect. The Sybase11 dialect adds a parameter for the TOP value whereas the SybaseASA10Dialect updates the sql directly with Select TOP 500 starting at 1. The issues appears to be in PrepareQueryCommand in loader.cs. The count parameter is set correctly in BindLimitParameters but then it gets wiped out in the next call which is to BindParameterValues. BindParameterValues is getting the value of 1 for the next parameter to bind which is correct but the method itself calls queryParameters.BindParameters with a hardcoded zero instead of the passed in starting parameter. This causes the first parameter which is the count to get set to whatever the next parameter is supposed to be.
queryParameters.BindParameters(statement, GetNamedParameterLocs, 0, session); perhaps should be queryParameters.BindParameters(statement, GetNamedParameterLocs, startIndex, session); I am reluctant to make this change in my nhibernate code as I really don't know the full impact of the change. To unsubscribe from this group, send email to nhibernate-development+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
