fixed issue 1246 with a nested select
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.4.5-stable+timestamp.2013.04.05.15.59.29
|
Version 2.4.5-stable+timestamp.2013.04.06.09.37.36
|
||||||
|
|||||||
+9
-7
@@ -2121,13 +2121,15 @@ class SQLFORM(FORM):
|
|||||||
if subquery:
|
if subquery:
|
||||||
dbset = dbset(subquery)
|
dbset = dbset(subquery)
|
||||||
try:
|
try:
|
||||||
if left or groupby:
|
if groupby:
|
||||||
if groupby:
|
c = 'count(*)'
|
||||||
c = 'count(distinct %s)' % str(groupby)
|
nrows = db.executesql(
|
||||||
else:
|
'select count(*) from (%s);' %
|
||||||
c = 'count(*)'
|
dbset._select(c, left=left, cacheable=True,
|
||||||
nrows = dbset.select(c, left=left, cacheable=True,
|
groupby=groupby)[:-1])[0][0]
|
||||||
groupby=groupby).first()[c]
|
elif left:
|
||||||
|
c = 'count(*)'
|
||||||
|
nrows = dbset.select(c, left=left, cacheable=True).first()[c]
|
||||||
elif dbset._db._adapter.dbengine=='google:datastore':
|
elif dbset._db._adapter.dbengine=='google:datastore':
|
||||||
#if we don't set a limit, this can timeout for a large table
|
#if we don't set a limit, this can timeout for a large table
|
||||||
nrows = dbset.db._adapter.count(dbset.query, limit=1000)
|
nrows = dbset.db._adapter.count(dbset.query, limit=1000)
|
||||||
|
|||||||
Reference in New Issue
Block a user