From 74c3b0dc29487ae7539d14b14846d46c988b2ff6 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 29 Aug 2019 15:28:59 +0800 Subject: [PATCH] bugfix --- sqlor/dbpools.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/sqlor/dbpools.py b/sqlor/dbpools.py index d30924a..5ae67d1 100644 --- a/sqlor/dbpools.py +++ b/sqlor/dbpools.py @@ -213,11 +213,17 @@ class DBPools: sor = await self.getSqlor(dbname) try: ret = await func(sor,dbname,*args,**kw) - await sor.conn.commit() + try: + await sor.conn.commit() + except: + pass return ret except Exception as e: print('error',sor) - sor.conn.rollback() + try: + await sor.conn.rollback() + except: + pass raise e finally: await self.freeSqlor(sor) @@ -232,14 +238,20 @@ class DBPools: try: desc = await func(dbname,NS,callback=callback,**kw) ret = await sor.runSQL(desc,NS,callback,**kw) - await sor.conn.commit() + try: + await sor.conn.commit() + except: + pass if NS.get('dummy'): return NS['dummy'] else: return [] except Exception as e: print('error:',e) - await sor.conn.rollback() + try: + await sor.conn.rollback() + except: + pass raise e finally: await self.freeSqlor(sor)