(20250107) Added connection closing method to AsyncMySQL.
This commit is contained in:
@@ -154,6 +154,21 @@ class AsyncMySQL:
|
||||
# Done here:
|
||||
return False if self.__pool is None else True
|
||||
|
||||
async def disconnect(self) -> bool:
|
||||
|
||||
try:
|
||||
|
||||
# Try to close the pool and wait for the process to complete:
|
||||
self.__pool.close()
|
||||
await self.__pool.wait_closed()
|
||||
|
||||
# In case of any exception:
|
||||
except Exception as exception:
|
||||
self.__printer(exception)
|
||||
|
||||
# Done here:
|
||||
return False if self.__pool is None else True
|
||||
|
||||
async def ensure_connection(self):
|
||||
|
||||
"""
|
||||
@@ -361,7 +376,7 @@ class AsyncMySQL:
|
||||
async def execute_many(
|
||||
self,
|
||||
query: str,
|
||||
data: List[tuple],
|
||||
data: List[tuple | List],
|
||||
commit: bool = True,
|
||||
return_exception: bool = False
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user