diff --git a/sqlor/dbpools.py b/sqlor/dbpools.py index f24beb3..de9c9ae 100755 --- a/sqlor/dbpools.py +++ b/sqlor/dbpools.py @@ -345,13 +345,7 @@ class DBPools: kw['sor'] = sor try: desc = await func(dbname,NS,*args,**kw) - total = await sor.record_count(desc,NS) - recs = await sor.pagingdata(desc,NS) - data = { - "total":total, - "rows":recs - } - return DictObject(**data) + return await sor.runSQLPaging(desc,NS) except Exception as e: print('error',e) raise e diff --git a/sqlor/sor.py b/sqlor/sor.py index 035f7e1..49108e3 100755 --- a/sqlor/sor.py +++ b/sqlor/sor.py @@ -373,6 +373,15 @@ class SQLor(object): t = c.recs[0]['rcnt'] 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): paging_desc = {} paging_desc.update(desc)