Beispiel #1
0
        public static IList <T> QueryPageList <T>(IDialect dialect, ISqlMapper sqlMap, String statementName, Object parameter, int offset, int limit)
        {
            IMappedStatement statement = sqlMap.GetMappedStatement(statementName);

            if (!sqlMap.IsSessionStarted)
            {
                sqlMap.OpenConnection();
            }
            RequestScope request = statement.Statement.Sql.GetRequestScope(statement, parameter, sqlMap.LocalSession);

            request.PreparedStatement.PreparedSql = dialect.GetLimitString(request.PreparedStatement.PreparedSql, offset, limit);
            //Console.WriteLine(dialect.GetType().FullName + "------" + request.PreparedStatement.PreparedSql);
            statement.PreparedCommand.Create(request, sqlMap.LocalSession, statement.Statement, parameter);
            return(RunQueryForList <T>(request, sqlMap.LocalSession, parameter, statement.Statement));
        }