From 549c8dbb285355698fe2e58d39d9063aadf76b36 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 20 Apr 2023 14:44:55 +0800 Subject: [PATCH] bugfix --- sqlor/const.py | 1 + sqlor/crud.py | 3 ++- sqlor/mysqlor.py | 3 ++- sqlor/sor.py | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 sqlor/const.py diff --git a/sqlor/const.py b/sqlor/const.py new file mode 100644 index 0000000..988523c --- /dev/null +++ b/sqlor/const.py @@ -0,0 +1 @@ +ROWS=100 diff --git a/sqlor/crud.py b/sqlor/crud.py index c0676bc..b9b9f22 100755 --- a/sqlor/crud.py +++ b/sqlor/crud.py @@ -1,5 +1,6 @@ # -*- coding:utf8 -*- from .dbpools import DBPools +from .const import ROWS from .filter import DBFilter from appPublic.objectAction import ObjectAction from appPublic.dictObject import DictObject @@ -31,7 +32,7 @@ class DatabaseNotfound(Exception): return f'{self.dbname} not found' class CRUD(object): - def __init__(self,dbname,tablename,rows=10): + def __init__(self,dbname,tablename,rows=ROWS): self.pool = DBPools() if dbname not in self.pool.databases.keys(): raise DatabaseNotfound(dbname) diff --git a/sqlor/mysqlor.py b/sqlor/mysqlor.py index f348ccb..3c75be2 100755 --- a/sqlor/mysqlor.py +++ b/sqlor/mysqlor.py @@ -1,4 +1,5 @@ # -*- coding:utf8 -*- +from dbpools import ROWS from appPublic.argsConvert import ArgsConvert,ConditionConvert from .sor import SQLor @@ -75,7 +76,7 @@ class MySqlor(SQLor): 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'],ROWS)) sort = NS.get(paging.get('sortname','sort'),None) order = NS.get(paging.get('ordername','asc'),'asc') if not sort: diff --git a/sqlor/sor.py b/sqlor/sor.py index 12f7d65..a8c2c46 100755 --- a/sqlor/sor.py +++ b/sqlor/sor.py @@ -14,6 +14,7 @@ from appPublic.myTE import MyTemplateEngine from appPublic.objectAction import ObjectAction from appPublic.argsConvert import ArgsConvert,ConditionConvert from .filter import DBFilter +from .const import * def db_type_2_py_type(o): if isinstance(o,decimal.Decimal): @@ -169,7 +170,7 @@ class SQLor(object): default it not support paging """ page = int(NS.get(paging['pagename'],1)) - rows = int(NS.get(paging['rowsname'],60)) + rows = int(NS.get(paging['rowsname'],ROWS)) sort = NS.get(paging.get('sortname','sort'),None) order = NS.get(paging.get('ordername','asc'),'asc') if not sort: