bugfix
This commit is contained in:
parent
86a8c6c61a
commit
549c8dbb28
1
sqlor/const.py
Normal file
1
sqlor/const.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
ROWS=100
|
@ -1,5 +1,6 @@
|
|||||||
# -*- coding:utf8 -*-
|
# -*- coding:utf8 -*-
|
||||||
from .dbpools import DBPools
|
from .dbpools import DBPools
|
||||||
|
from .const import ROWS
|
||||||
from .filter import DBFilter
|
from .filter import DBFilter
|
||||||
from appPublic.objectAction import ObjectAction
|
from appPublic.objectAction import ObjectAction
|
||||||
from appPublic.dictObject import DictObject
|
from appPublic.dictObject import DictObject
|
||||||
@ -31,7 +32,7 @@ class DatabaseNotfound(Exception):
|
|||||||
return f'{self.dbname} not found'
|
return f'{self.dbname} not found'
|
||||||
|
|
||||||
class CRUD(object):
|
class CRUD(object):
|
||||||
def __init__(self,dbname,tablename,rows=10):
|
def __init__(self,dbname,tablename,rows=ROWS):
|
||||||
self.pool = DBPools()
|
self.pool = DBPools()
|
||||||
if dbname not in self.pool.databases.keys():
|
if dbname not in self.pool.databases.keys():
|
||||||
raise DatabaseNotfound(dbname)
|
raise DatabaseNotfound(dbname)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding:utf8 -*-
|
# -*- coding:utf8 -*-
|
||||||
|
from dbpools import ROWS
|
||||||
from appPublic.argsConvert import ArgsConvert,ConditionConvert
|
from appPublic.argsConvert import ArgsConvert,ConditionConvert
|
||||||
|
|
||||||
from .sor import SQLor
|
from .sor import SQLor
|
||||||
@ -75,7 +76,7 @@ class MySqlor(SQLor):
|
|||||||
default it not support paging
|
default it not support paging
|
||||||
"""
|
"""
|
||||||
page = int(NS.get(paging['pagename'],1))
|
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)
|
sort = NS.get(paging.get('sortname','sort'),None)
|
||||||
order = NS.get(paging.get('ordername','asc'),'asc')
|
order = NS.get(paging.get('ordername','asc'),'asc')
|
||||||
if not sort:
|
if not sort:
|
||||||
|
@ -14,6 +14,7 @@ from appPublic.myTE import MyTemplateEngine
|
|||||||
from appPublic.objectAction import ObjectAction
|
from appPublic.objectAction import ObjectAction
|
||||||
from appPublic.argsConvert import ArgsConvert,ConditionConvert
|
from appPublic.argsConvert import ArgsConvert,ConditionConvert
|
||||||
from .filter import DBFilter
|
from .filter import DBFilter
|
||||||
|
from .const import *
|
||||||
|
|
||||||
def db_type_2_py_type(o):
|
def db_type_2_py_type(o):
|
||||||
if isinstance(o,decimal.Decimal):
|
if isinstance(o,decimal.Decimal):
|
||||||
@ -169,7 +170,7 @@ class SQLor(object):
|
|||||||
default it not support paging
|
default it not support paging
|
||||||
"""
|
"""
|
||||||
page = int(NS.get(paging['pagename'],1))
|
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)
|
sort = NS.get(paging.get('sortname','sort'),None)
|
||||||
order = NS.get(paging.get('ordername','asc'),'asc')
|
order = NS.get(paging.get('ordername','asc'),'asc')
|
||||||
if not sort:
|
if not sort:
|
||||||
|
Loading…
Reference in New Issue
Block a user