This commit is contained in:
yumoqing 2020-10-20 10:30:46 +08:00
parent cc9e37d644
commit 4101ffb5af
2 changed files with 10 additions and 7 deletions

View File

@ -345,13 +345,7 @@ class DBPools:
kw['sor'] = sor kw['sor'] = sor
try: try:
desc = await func(dbname,NS,*args,**kw) desc = await func(dbname,NS,*args,**kw)
total = await sor.record_count(desc,NS) return await sor.runSQLPaging(desc,NS)
recs = await sor.pagingdata(desc,NS)
data = {
"total":total,
"rows":recs
}
return DictObject(**data)
except Exception as e: except Exception as e:
print('error',e) print('error',e)
raise e raise e

View File

@ -373,6 +373,15 @@ class SQLor(object):
t = c.recs[0]['rcnt'] t = c.recs[0]['rcnt']
return t return t
async def runSQLPaging(self,desc,NS):
total = await self.record_count(desc,NS)
recs = await self.pagingdata(desc,NS)
data = {
"total":total,
"rows":recs
}
return DictObject(**data)
async def pagingdata(self,desc,NS): async def pagingdata(self,desc,NS):
paging_desc = {} paging_desc = {}
paging_desc.update(desc) paging_desc.update(desc)