From 300e0745b0b3a758a7743e9a1d06e322c14cec0d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 4 Apr 2023 18:04:35 +0800 Subject: [PATCH] bugfix --- sqlor/sor.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sqlor/sor.py b/sqlor/sor.py index be9732a..9d7f609 100755 --- a/sqlor/sor.py +++ b/sqlor/sor.py @@ -163,7 +163,7 @@ class SQLor(object): default it not support paging """ page = int(NS.get(paging['pagename'],1)) - rows = int(NS.get(paging['rowsname'],10)) + rows = int(NS.get(paging['rowsname'],60)) sort = NS.get(paging.get('sortname','sort'),None) order = NS.get(paging.get('ordername','asc'),'asc') if not sort: @@ -457,6 +457,22 @@ class SQLor(object): callback=lambda x:ret.append(x)) return ret + async def sqlPaging(self,sql,ns): + ret = [] + dic = { + "sql_string":sql + } + page = ns.get('page') + if not page: + ns['page'] = 1 + + total = await self.record_count(dic,ns) + rows = await self.pagingdata(dic,ns) + return { + 'total':total, + 'rows':rows + } + async def tables(self): sqlstring = self.tablesSQL() ret = []