add runSQL, runSQLPaging function

This commit is contained in:
yumoqing 2019-11-28 14:58:06 +08:00
parent f95b2a059d
commit eec5507b5d

View File

@ -18,7 +18,6 @@ from .mysqlor import MySqlor
from .aiomysqlor import AioMysqlor
from .aiopostgresqlor import AioPostgresqlor
def sqlorFactory(dbdesc):
driver = dbdesc.get('driver',dbdesc)
def findSubclass(name,klass):
@ -370,3 +369,29 @@ class DBPools:
return ret
return await _getTableForignKeys(dbname,{},tblname,**kw)
async def runSQL(dbname,sql,ns={},sor=None):
pool = DBPools()
@pool.runSQL
async def desc(dbname,ns,*args,**kw):
return {
"sql_string":sql
}
kw = {
'sor':sor
}
x = await desc(dbname,ns,**kw)
return x
async def runSQLPaging(dbname,sql,ns={},sor=None):
pool = DBPools()
@pool.runSQLPaging
async def desc(dbname,ns,*args,**kw):
return {
"sql_string":sql
}
kw = {
"sor":sor
}
x = await desc(dbname, ns, **kw)
return x