This commit is contained in:
yumoqing 2023-04-04 10:34:22 +08:00
parent 4bac4349bf
commit 66c7d33e0a

View File

@ -234,18 +234,22 @@ class DBPools:
driver = myImport(dbdesc['driver'])
conn = None
cur = None
desc = dbdesc['kwargs'].copy()
pw = desc.get('password')
if pw:
desc['password'] = unpassword(pw)
if self.isAsyncDriver(dbname):
if dbdesc['driver'] == 'sqlite3':
conn = await driver.connect(dbdesc['kwargs']['dbname'])
conn = await driver.connect(desc['dbname'])
else:
conn = await driver.connect(**dbdesc['kwargs'])
conn = await driver.connect(**desc)
cur = await conn.cursor()
return True,conn,cur
else:
if dbdesc['driver'] == 'sqlite3':
conn = driver.connect(dbdesc['kwargs']['dbname'])
conn = driver.connect(desc['dbname'])
else:
conn = driver.connect(**dbdesc['kwargs'])
conn = driver.connect(**desc)
cur = conn.cursor()
return False,conn,cur