experimental support for MSSQL pagination
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.3.0 (2012-12-04 10:55:53) rc1
|
||||
Version 2.3.0 (2012-12-04 18:29:48) rc1
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
# http://code.google.com/p/web2py/issues/detail?id=1170
|
||||
#
|
||||
# Copyright (C) <2012> Alan Etkin <spametki@gmail.com>
|
||||
# Adnan Smajlovic
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -2978,6 +2978,7 @@ class MSSQLAdapter(BaseAdapter):
|
||||
what = 'LEN'
|
||||
return "%s(%s)" % (what, self.expand(first))
|
||||
|
||||
|
||||
def select_limitby(self, sql_s, sql_f, sql_t, sql_w, sql_o, limitby):
|
||||
if limitby:
|
||||
(lmin, lmax) = limitby
|
||||
@@ -3119,6 +3120,17 @@ class MSSQLAdapter(BaseAdapter):
|
||||
return BaseAdapter.represent(self, obj, fieldtype)
|
||||
|
||||
|
||||
class MSSQL3Adapter(MSSQLAdapter):
|
||||
""" experimental support for pagination in MSSQL"""
|
||||
def select_limitby(self, sql_s, sql_f, sql_t, sql_w, sql_o, limitby):
|
||||
if limitby:
|
||||
(lmin, lmax) = limitby
|
||||
return 'SELECT %s FROM (SELECT %s ROW_NUMBER() over (order by id) AS w_row, %s FROM %s%s%s) TMP WHERE w_row BETWEEN %i AND %s;' % (sql_f,sql_s,sql_f,sql_t,sql_w,sql_o,lmin,lmax)
|
||||
return 'SELECT %s %s FROM %s%s%s;' % (sql_s,sql_f,sql_t,sql_w,sql_o)
|
||||
def rowslice(self,rows,minimum=0,maximum=None):
|
||||
return rows
|
||||
|
||||
|
||||
class MSSQL2Adapter(MSSQLAdapter):
|
||||
drivers = ('pyodbc',)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user