This commit is contained in:
yumoqing 2019-10-23 16:32:18 +08:00
parent 0bfb03da9f
commit 00884f64a4
2 changed files with 0 additions and 18 deletions

View File

@ -259,9 +259,7 @@ class CRUD(object):
@self.pool.inSqlor @self.pool.inSqlor
async def main(dbname,NS,**kw): async def main(dbname,NS,**kw):
print('here2')
p = await self.primaryKey(**kw) p = await self.primaryKey(**kw)
print('here3')
if NS.get('__id') is not None: if NS.get('__id') is not None:
NS[p[0]['field_name']] = NS['__id'] NS[p[0]['field_name']] = NS['__id']
del NS['__id'] del NS['__id']
@ -274,18 +272,12 @@ class CRUD(object):
data = self.oa.execute(self.dbname+'_'+self.tablename,'beforeRetrieve',NS) data = self.oa.execute(self.dbname+'_'+self.tablename,'beforeRetrieve',NS)
if NS.get('page'): if NS.get('page'):
print('here4')
data = await pagingdata(self.dbname,data,**kw) data = await pagingdata(self.dbname,data,**kw)
print('here5')
else: else:
print('here6')
data = await retrieve(self.dbname,data,**kw) data = await retrieve(self.dbname,data,**kw)
print('here7')
data = self.oa.execute(self.dbname+'_'+self.tablename,'afterRetrieve',data) data = self.oa.execute(self.dbname+'_'+self.tablename,'afterRetrieve',data)
print('here8')
return data return data
print('here1')
return await main(self.dbname,NS,**kw) return await main(self.dbname,NS,**kw)
async def U(self,data, **kw): async def U(self,data, **kw):

View File

@ -259,29 +259,20 @@ class DBPools:
def runSQL(self,func): def runSQL(self,func):
@wraps(func) @wraps(func)
async def wrap_func(dbname,NS,*args,**kw): async def wrap_func(dbname,NS,*args,**kw):
print('runSQL:1')
sor, commit = await self.useOrGetSor(dbname,**kw) sor, commit = await self.useOrGetSor(dbname,**kw)
print('runSQL:2')
kw['sor'] = sor kw['sor'] = sor
ret = None ret = None
try: try:
print('runSQL:3')
desc = await func(dbname,NS,*args,**kw) desc = await func(dbname,NS,*args,**kw)
print('runSQL:4')
callback = kw.get('callback',None) callback = kw.get('callback',None)
kw1 = {} kw1 = {}
[ kw1.update({k:v}) for k,v in kw.items() if k!='callback' ] [ kw1.update({k:v}) for k,v in kw.items() if k!='callback' ]
print('runSQL:5')
ret = await sor.runSQL(desc,NS,callback,**kw1) ret = await sor.runSQL(desc,NS,callback,**kw1)
print('runSQL:6')
if commit: if commit:
try: try:
print('runSQL:7')
await sor.conn.commit() await sor.conn.commit()
print('runSQL:8')
except: except:
pass pass
print('runSQL:9')
if NS.get('dummy'): if NS.get('dummy'):
return NS['dummy'] return NS['dummy']
else: else:
@ -297,7 +288,6 @@ class DBPools:
raise e raise e
finally: finally:
if commit: if commit:
print('runSQL:10')
await self.freeSqlor(sor) await self.freeSqlor(sor)
return wrap_func return wrap_func