bugfix
This commit is contained in:
parent
0bfb03da9f
commit
00884f64a4
@ -259,9 +259,7 @@ class CRUD(object):
|
||||
|
||||
@self.pool.inSqlor
|
||||
async def main(dbname,NS,**kw):
|
||||
print('here2')
|
||||
p = await self.primaryKey(**kw)
|
||||
print('here3')
|
||||
if NS.get('__id') is not None:
|
||||
NS[p[0]['field_name']] = NS['__id']
|
||||
del NS['__id']
|
||||
@ -274,18 +272,12 @@ class CRUD(object):
|
||||
|
||||
data = self.oa.execute(self.dbname+'_'+self.tablename,'beforeRetrieve',NS)
|
||||
if NS.get('page'):
|
||||
print('here4')
|
||||
data = await pagingdata(self.dbname,data,**kw)
|
||||
print('here5')
|
||||
else:
|
||||
print('here6')
|
||||
data = await retrieve(self.dbname,data,**kw)
|
||||
print('here7')
|
||||
data = self.oa.execute(self.dbname+'_'+self.tablename,'afterRetrieve',data)
|
||||
print('here8')
|
||||
return data
|
||||
|
||||
print('here1')
|
||||
return await main(self.dbname,NS,**kw)
|
||||
|
||||
async def U(self,data, **kw):
|
||||
|
@ -259,29 +259,20 @@ class DBPools:
|
||||
def runSQL(self,func):
|
||||
@wraps(func)
|
||||
async def wrap_func(dbname,NS,*args,**kw):
|
||||
print('runSQL:1')
|
||||
sor, commit = await self.useOrGetSor(dbname,**kw)
|
||||
print('runSQL:2')
|
||||
kw['sor'] = sor
|
||||
ret = None
|
||||
try:
|
||||
print('runSQL:3')
|
||||
desc = await func(dbname,NS,*args,**kw)
|
||||
print('runSQL:4')
|
||||
callback = kw.get('callback',None)
|
||||
kw1 = {}
|
||||
[ kw1.update({k:v}) for k,v in kw.items() if k!='callback' ]
|
||||
print('runSQL:5')
|
||||
ret = await sor.runSQL(desc,NS,callback,**kw1)
|
||||
print('runSQL:6')
|
||||
if commit:
|
||||
try:
|
||||
print('runSQL:7')
|
||||
await sor.conn.commit()
|
||||
print('runSQL:8')
|
||||
except:
|
||||
pass
|
||||
print('runSQL:9')
|
||||
if NS.get('dummy'):
|
||||
return NS['dummy']
|
||||
else:
|
||||
@ -297,7 +288,6 @@ class DBPools:
|
||||
raise e
|
||||
finally:
|
||||
if commit:
|
||||
print('runSQL:10')
|
||||
await self.freeSqlor(sor)
|
||||
return wrap_func
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user