Merge pull request #157 from niphlod/issue/orderby_limitby_groupby
fixed bug introduced with commit "no more removal of ORDERBY in MSSQL"
This commit is contained in:
10
gluon/dal.py
10
gluon/dal.py
@@ -567,7 +567,7 @@ class ConnectionPool(object):
|
||||
""" this actually does not make the folder. it has to be there """
|
||||
self.folder = getattr(THREAD_LOCAL,'folder','')
|
||||
|
||||
if (os.path.isabs(self.folder) and
|
||||
if (os.path.isabs(self.folder) and
|
||||
isinstance(self, UseDatabaseStoredFile) and
|
||||
self.folder.startswith(os.getcwd())):
|
||||
self.folder = os.path.relpath(self.folder, os.getcwd())
|
||||
@@ -1676,7 +1676,7 @@ class BaseAdapter(ConnectionPool):
|
||||
sql_o += ' ORDER BY %s' % self.RANDOM()
|
||||
else:
|
||||
sql_o += ' ORDER BY %s' % self.expand(orderby)
|
||||
if (limitby and not groupby and tablenames and orderby_on_limitby):
|
||||
if (limitby and not groupby and tablenames and orderby_on_limitby and not orderby):
|
||||
sql_o += ' ORDER BY %s' % ', '.join(['%s.%s'%(t,x) for t in tablenames for x in (hasattr(self.db[t],'_primarykey') and self.db[t]._primarykey or [self.db[t]._id.name])])
|
||||
# oracle does not support limitby
|
||||
sql = self.select_limitby(sql_s, sql_f, sql_t, sql_w, sql_o, limitby)
|
||||
@@ -8367,7 +8367,7 @@ class Table(object):
|
||||
self._references = []
|
||||
for field in self:
|
||||
fieldname = field.name
|
||||
field_type = field.type
|
||||
field_type = field.type
|
||||
if isinstance(field_type,str) and field_type[:10] == 'reference ':
|
||||
ref = field_type[10:].strip()
|
||||
if not ref.strip():
|
||||
@@ -8375,7 +8375,7 @@ class Table(object):
|
||||
if '.' in ref:
|
||||
rtablename, rfieldname = ref.split('.',1)
|
||||
else:
|
||||
rtablename, rfieldname = ref, None
|
||||
rtablename, rfieldname = ref, None
|
||||
if not rtablename in db:
|
||||
pr[rtablename] = pr.get(rtablename,[]) + [field]
|
||||
continue
|
||||
@@ -8398,7 +8398,7 @@ class Table(object):
|
||||
field.referent = None
|
||||
for referee in pr.get(self._tablename,[]):
|
||||
self._referenced_by.append(referee)
|
||||
|
||||
|
||||
def _filter_fields(self, record, id=False):
|
||||
return dict([(k, v) for (k, v) in record.iteritems() if k
|
||||
in self.fields and (self[k].type!='id' or id)])
|
||||
|
||||
Reference in New Issue
Block a user