This commit is contained in:
yumoqing 2023-04-04 18:04:35 +08:00
parent 3710a7f811
commit 300e0745b0

View File

@ -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 = []