This commit is contained in:
yumoqing 2024-07-23 18:06:48 +08:00
parent 34121108d1
commit 68d04054ca

View File

@ -14,7 +14,7 @@ from appPublic.unicoding import uDict
from appPublic.myTE import MyTemplateEngine 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 appPublic.registerfunction import RegisterCoroutine from appPublic.registerfunction import RegisterFunction
from appPublic.log import info from appPublic.log import info
from .filter import DBFilter from .filter import DBFilter
@ -607,7 +607,7 @@ class SQLor(object):
fns = ','.join(fields) fns = ','.join(fields)
vfns = ','.join(['${%s}$' % n for n in fields ]) vfns = ','.join(['${%s}$' % n for n in fields ])
sql = 'insert into %s.%s (%s) values (%s)' % (self.dbname, tablename,fns,vfns) sql = 'insert into %s.%s (%s) values (%s)' % (self.dbname, tablename,fns,vfns)
rf = RegisterCoroutine() rf = RegisterFunction()
rfname = f'{self.dbname}:{tablename}:c:before' rfname = f'{self.dbname}:{tablename}:c:before'
ns = await rf.exe(rfname, ns) ns = await rf.exe(rfname, ns)
r = await self.runSQL({'sql_string':sql},ns,None) r = await self.runSQL({'sql_string':sql},ns,None)
@ -657,7 +657,7 @@ class SQLor(object):
u_str = ','.join(u) u_str = ','.join(u)
sql = 'update %s.%s set %s where %s' % (self.dbname, tablename, sql = 'update %s.%s set %s where %s' % (self.dbname, tablename,
u_str,c_str) u_str,c_str)
rf = RegisterCoroutine() rf = RegisterFunction()
ns = await rf.exe(f'{self.dbname}:{tablename}:u:before',ns) ns = await rf.exe(f'{self.dbname}:{tablename}:u:before',ns)
if func: if func:
ns = func(ns) ns = func(ns)
@ -672,7 +672,7 @@ class SQLor(object):
c = [ '%s = ${%s}$' % (i,i) for i in condi ] c = [ '%s = ${%s}$' % (i,i) for i in condi ]
c_str = ' and '.join(c) c_str = ' and '.join(c)
sql = 'delete from %s.%s where %s' % (self.dbname, tablename,c_str) sql = 'delete from %s.%s where %s' % (self.dbname, tablename,c_str)
rf = RegisterCoroutine() rf = RegisterFunction()
ns = await rf.exe(f'{self.dbname}:{tablename}:d:before', ns) ns = await rf.exe(f'{self.dbname}:{tablename}:d:before', ns)
r = await self.runSQL({'sql_string':sql},ns,None) r = await self.runSQL({'sql_string':sql},ns,None)
ns = await rf.get(f'{self.dbname}:{tablename}:d:after', ns) ns = await rf.get(f'{self.dbname}:{tablename}:d:after', ns)