possible fix for Issue 1426:Count(*) query is incorrect when SQLFORM.grid() contains groupby parameter, thanks daveshih01
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.4.5-stable+timestamp.2013.04.03.16.48.32
|
Version 2.4.5-stable+timestamp.2013.04.04.21.10.38
|
||||||
|
|||||||
+4
-1
@@ -2122,7 +2122,10 @@ class SQLFORM(FORM):
|
|||||||
dbset = dbset(subquery)
|
dbset = dbset(subquery)
|
||||||
try:
|
try:
|
||||||
if left or groupby:
|
if left or groupby:
|
||||||
c = 'count(*)'
|
if groupby:
|
||||||
|
c = 'count(distinct %s)' % str(groupby)
|
||||||
|
else:
|
||||||
|
c = 'count(*)'
|
||||||
nrows = dbset.select(c, left=left, cacheable=True,
|
nrows = dbset.select(c, left=left, cacheable=True,
|
||||||
groupby=groupby).first()[c]
|
groupby=groupby).first()[c]
|
||||||
elif dbset._db._adapter.dbengine=='google:datastore':
|
elif dbset._db._adapter.dbengine=='google:datastore':
|
||||||
|
|||||||
Reference in New Issue
Block a user