bugfix
This commit is contained in:
parent
fb8153cc3a
commit
c3d7ffc118
@ -70,7 +70,8 @@ class SqlorPool:
|
||||
yielded_sqlor = None
|
||||
for s in sqlors:
|
||||
if not s.used:
|
||||
if self.test_sqlor(s):
|
||||
flg = self.test_sqlor(s):
|
||||
if flg:
|
||||
yielded_sqlor = s
|
||||
else:
|
||||
self.sqlors = [ x for x in self.sqlors if x != s ]
|
||||
@ -118,7 +119,9 @@ class DBPools:
|
||||
sqlor = None
|
||||
try:
|
||||
async with pool.context() as sqlor:
|
||||
sqlor.enter()
|
||||
yield sqlor
|
||||
sqlor.exit()
|
||||
if sqlor and sqlor.dataChanged:
|
||||
await sqlor.commit()
|
||||
except Exception as e:
|
||||
|
||||
@ -152,10 +152,20 @@ WHERE
|
||||
"""
|
||||
dbdesc = self.dbdesc
|
||||
self.conn = await aiomysql.connect(**dbdesc)
|
||||
self.cur = await self.conn.cursor()
|
||||
self.dbname = dbdesc.get('db')
|
||||
|
||||
async def close(self):
|
||||
await self.cursor.close()
|
||||
await self.conn.close()
|
||||
|
||||
async def enter(self):
|
||||
self.cur = await self.conn.cursor()
|
||||
|
||||
async def exit(self):
|
||||
try:
|
||||
await self.cur.fetchall()
|
||||
self.cur.close()
|
||||
except:
|
||||
pass
|
||||
self.cur = None
|
||||
|
||||
|
||||
@ -90,6 +90,12 @@ class SQLor(object):
|
||||
self.dataChanged = False
|
||||
self.metadatas={}
|
||||
|
||||
async def enter(self):
|
||||
pass
|
||||
|
||||
async def exit(self):
|
||||
pass
|
||||
|
||||
def unpassword(self):
|
||||
if self.dbdesc.password:
|
||||
key=getConfig().password_key
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user